Ejemplo n.º 1
0
        /// <inheritdoc/>
        public void Slew(CrdsEquatorial eq)
        {
            try
            {
                lock (locker)
                {
                    if (telescope != null && telescope.Connected)
                    {
                        UnparkIfPossible();
                        EnableTrackingIfPossible();

                        var eqT = ConvertCoordinatesToTelescopeEpoch(eq);

                        // Slew
                        if (telescope.CanSlewAsync)
                        {
                            telescope.SlewToCoordinatesAsync(eqT.Alpha / 15, eqT.Delta);
                        }
                        else
                        {
                            Task.Run(() => telescope.SlewToCoordinates(eqT.Alpha / 15, eqT.Delta));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError($"Unable to slew telescope: {ex}");
                RaiseOnMessageShow("$Ascom.Messages.UnableSlew");
            }
        }
Ejemplo n.º 2
0
        public bool Goto(double ra, double dec)
        {
            bool bRet = false;

            myTel.SlewToCoordinates(ra, dec);
            if (debug)
            {
                Console.Write("RA = " + myTel.RightAscension);
                Console.WriteLine("    DEC = " + myTel.Declination);
            }
            return(bRet);
        }
Ejemplo n.º 3
0
        public async Task <bool> SlewToCoordinatesAsync(Coordinates coords)
        {
            try {
                coords = coords.Transform(TelescopeInfo.EquatorialSystem);
                if (Telescope?.Connected == true)
                {
                    progress.Report(
                        new ApplicationStatus()
                    {
                        Status = Locale.Loc.Instance["LblSlew"]
                    }
                        );

                    await Task.Run(() => {
                        Telescope.SlewToCoordinates(coords);
                    });

                    await Utility.Utility.Wait(TimeSpan.FromSeconds(profileService.ActiveProfile.TelescopeSettings.SettleTime), default, progress, Locale.Loc.Instance["LblSettle"]);
Ejemplo n.º 4
0
        private void slewEquatorial(double ra, double dec, bool async)
        {
            if (ra > 24 || ra < 0 || Math.Abs(dec) > 90)
            {
                return;
            }
            else if (telescope.CanSlew)
            {
                labelValStatus.Text = "Slewing...";
                setTracking(true);

                if (telescope.CanSlewAsync)
                {
                    telescope.SlewToCoordinatesAsync(ra, dec);
                }
                else
                {
                    telescope.SlewToCoordinates(ra, dec);
                }
                labelValStatus.Text = "Connected";
            }
        }
Ejemplo n.º 5
0
        private void trackSatellites()
        {
            // main function
            // does not loop, is run each time a satellite is tracked, or the second photograph is taken
            // this is to allow the timers to run, as well as to easily allow missed passes

            lbTime.Text           = DateTime.Now.Add(new TimeSpan(offsetHours, offsetMins, 0)).ToString();
            objTelescope.Tracking = true;

            if (idx < nTargets)
            {
                if (imagesCaptured == 0)
                {
                    try
                    {
                        findNextTarget();
                        lbTargetLocked.Text = "Slewing";
                        double offsetRa;
                        // this if statement accounts for the overflow of offsetting RA, which cycles through 0 to 24 to 0
                        if (nextRa > offsetHours + 1.0 / 60.0 * offsetMins)
                        {
                            // RA is offset in the opposite direction to time, as we simulate seeing events occuring later, but want to ensure
                            // that they are above the horizon
                            offsetRa = nextRa - offsetHours - 1.0 / 60.0 * offsetMins;
                        }
                        else
                        {
                            offsetRa = 24 - (offsetHours + 1.0 / 60.0 * offsetMins - nextRa);
                        }
                        try
                        {
                            objTelescope.SlewToCoordinates(offsetRa, nextDec);
                            RunTimer.Start();
                            imagesCaptured = 1;
                        }
                        catch
                        {
                        }
                    }
                    catch
                    {
                        lbWarningText.Text = "All satellite passes have finished";
                    }
                }
                else if (imagesCaptured == 1)
                {
                    goToNextImage();
                    lbTargetLocked.Text = "Slewing";
                    double offsetRa;
                    if (nextRa > offsetHours + 1.0 / 60.0 * offsetMins)
                    {
                        offsetRa = nextRa - offsetHours - 1.0 / 60.0 * offsetMins;
                    }
                    else
                    {
                        offsetRa = 24 - (offsetHours + 1.0 / 60.0 * offsetMins - nextRa);
                    }
                    try
                    {
                        objTelescope.SlewToCoordinates(offsetRa, nextDec);
                        RunTimer.Start();
                        imagesCaptured = 0;
                    }
                    catch
                    {
                    }
                }
            }
        }