//
 // Constructor - Internal prevents public creation
 // of instances. Returned by Telescope.AxisRates.
 //
 internal AxisRates(TelescopeAxes axis)
 {
     this.axis = axis;
     //
     // This collection must hold zero or more Rate objects describing the
     // rates of motion ranges for the Telescope.MoveAxis() method
     // that are supported by your driver. It is OK to leave this
     // array empty, indicating that MoveAxis() is not supported.
     //
     // Note that we are constructing a rate array for the axis passed
     // to the constructor. Thus we switch() below, and each case should
     // initialize the array for the rate for the selected axis.
     //
     switch (axis)
     {
         case TelescopeAxes.axisPrimary:
             // TODO Initialize this array with any Primary axis rates that your driver may provide
             // Example: m_Rates = new Rate[] { new Rate(10.5, 30.2), new Rate(54.0, 43.6) }
             //var sid = Utils.Const.SiderealRateDegPerSec;
             this.rates = new Rate[]
             {
                 new Rate(0, Const.MaxAxisRate),
     /*
                 new Rate(sid / 2, sid / 2),     //Rate 1
                 new Rate(sid, sid),             //Rate 2
                 new Rate(sid * 2, sid * 2),     //Rate 3
                 new Rate(sid * 4, sid * 4),     //Rate 4
                 new Rate(sid * 8, sid * 8),     //Rate 5
                 new Rate(sid * 16, sid * 16),   //Rate 6
                 new Rate(sid * 64, sid * 64),   //Rate 6
                 new Rate(0.5, 0.5),             //Rate 7
                 new Rate(2, 2),                 //Rate 8
                 new Rate(3, 3),                 //Rate 9
      */
             };
             break;
         case TelescopeAxes.axisSecondary:
             // TODO Initialize this array with any Secondary axis rates that your driver may provide
             this.rates = new Rate[]
             {
                 new Rate(0, Const.MaxAxisRate),
             };
             break;
         case TelescopeAxes.axisTertiary:
             // TODO Initialize this array with any Tertiary axis rates that your driver may provide
             this.rates = new Rate[0];
             break;
     }
 }
        public void MoveAxis(TelescopeAxes Axis, double Rate)
        {
            objSerial.Transmit("moveAxis#" + Axis + "#" + Rate + "#");

            tl.LogMessage("MoveAxis", "Rotated " + Axis + " at " + Rate + " Steps/Second");
            //throw new ASCOM.MethodNotImplementedException("MoveAxis");
        }
        public void MoveAxis(TelescopeAxes Axis, double Rate)
        {
            this.isSlewing = true;

            switch (Axis)
            {
            case TelescopeAxes.axisPrimary:
                if (Rate > 0)
                {
                    SerialConnection.Transmit(": E #");
                }
                else if (Rate < 0)
                {
                    SerialConnection.Transmit(": W #");
                }
                break;

            case TelescopeAxes.axisSecondary:
                if (Rate > 0)
                {
                    SerialConnection.Transmit(": N #");
                }
                else if (Rate < 0)
                {
                    SerialConnection.Transmit(": S #");
                }
                break;
            }

            this.isSlewing = false;
        }
Example #4
0
        public IAxisRates AxisRates(TelescopeAxes Axis)
        {
            tl.LogMessage("AxisRates", "Get - " + Axis.ToString());
            AxisRates axisrates = new AxisRates(Axis);

            return(axisrates);
        }
Example #5
0
 public TimedMovementResult(TelescopeAxes axis)
 {
     encoder_angle = new Angle[3];
     time          = new DateTime[3];
     cancelled     = false;
     this.axis     = axis;
 }
Example #6
0
        //
        // Constructor - Internal prevents public creation
        // of instances. Returned by Telescope.AxisRates.
        //
        internal AxisRates(TelescopeAxes axis)
        {
            this.axis = axis;
            //
            // This collection must hold zero or more Rate objects describing the
            // rates of motion ranges for the Telescope.MoveAxis() method
            // that are supported by your driver. It is OK to leave this
            // array empty, indicating that MoveAxis() is not supported.
            //
            // Note that we are constructing a rate array for the axis passed
            // to the constructor. Thus we switch() below, and each case should
            // initialize the array for the rate for the selected axis.
            //
            switch (axis)
            {
            case TelescopeAxes.axisPrimary:
                // TODO Initialize this array with any Primary axis rates that your driver may provide
                // Example: m_Rates = new Rate[] { new Rate(10.5, 30.2), new Rate(54.0, 43.6) }
                this.rates = new Rate[0];
                break;

            case TelescopeAxes.axisSecondary:
                // TODO Initialize this array with any Secondary axis rates that your driver may provide
                this.rates = new Rate[0];
                break;

            case TelescopeAxes.axisTertiary:
                // TODO Initialize this array with any Tertiary axis rates that your driver may provide
                this.rates = new Rate[0];
                break;
            }
        }
Example #7
0
        public bool AxisCanMoveAtRate(TelescopeAxes axis, double rate)
        {
            bool ret = false;

            Slewers.Type otherSlewer = (axis == TelescopeAxes.axisPrimary) ? Slewers.Type.Dec : Slewers.Type.Ra;

            if (!WiseTele.Instance.slewers.Active(otherSlewer))
            {
                return(true);        // the other axis has finished its slew, this axis can use any rate
            }
            if (rate == Const.rateSlew)
            {
                ret = (Interlocked.Read(ref primaryReadyForSlew) == Interlocked.Read(ref secondaryReadyForSlew));
            }
            else if (rate == Const.rateSet)
            {
                ret = (Interlocked.Read(ref primaryReadyForSet) == Interlocked.Read(ref secondaryReadyForSet));
            }
            else if (rate == Const.rateGuide)
            {
                ret = (Interlocked.Read(ref primaryReadyForGuide) == Interlocked.Read(ref secondaryReadyForGuide));
            }

            #region debug
            //debugger.WriteLine(Debugger.DebugLevel.DebugAxes, "AxisCanMoveAtRate: {0} at {1} => {2}",
            //    axis, WiseTele.RateName(rate), ret);
            #endregion
            return(ret);
        }
        public bool CanMoveAxis(TelescopeAxes axis)
        {
            bool                 retval      = false;
            Exception            xcp         = null;
            ActivityMessageTypes messageType = ActivityMessageTypes.Capabilities;

            string axisName = GetNameFromAxis(axis);
            string msg      = String.Format("Calling CanMoveAxis( {0} )", axisName);

            try
            {
                CheckDevice();
                retval = Service.CanMoveAxis(axis);
                msg   += retval.ToString();
            }
            catch (Exception ex)
            {
                xcp  = ex;
                msg += Failed;
                throw;
            }

            finally
            {
                LogActivityLine(messageType, msg);

                if (xcp != null)
                {
                    LogActivityLine(messageType, "CanMoveAxis( {0} ) Exception: {1}", axisName, xcp.Message);
                }
            }

            return(retval);
        }
Example #9
0
        internal AxisRates(TelescopeAxes Axis)
        {
            _axis = Axis;

            // This collection must hold zero or more Rate objects describing the
            // rates of motion ranges for the Telescope.MoveAxis() method
            // that are supported by your driver. It is OK to leave this
            // array empty, indicating that MoveAxis() is not supported.

            switch (_axis)
            {
            case TelescopeAxes.axisPrimary:
                _rates = PrimaryAxisRates;
                break;

            case TelescopeAxes.axisSecondary:
                _rates = SecondaryAxisRates;
                break;

            case TelescopeAxes.axisTertiary:
                _rates = TertiaryAxisRates;
                break;
            }

            _pos = -1;
        }
Example #10
0
        private IRate[] GetAxisRateArrayFromService(TelescopeAxes axis)
        {
            AxisRates rates;

            if (axis == TelescopeAxes.axisPrimary)
            {
                rates = (AxisRates)_svc.MockPrimaryAxisRates;
            }
            else if (axis == TelescopeAxes.axisSecondary)
            {
                rates = (AxisRates)_svc.MockSecondaryAxisRates;
            }
            else
            {
                rates = (AxisRates)_svc.MockTertiaryAxisRates;
            }

            IRate[] rateArr = new IRate[rates.Count];
            int     i       = 0;

            foreach (IRate rate in rates)
            {
                rateArr[i++] = rate;
            }

            return(rateArr);
        }
Example #11
0
        //TODO: Update this to error when at park
        /// <summary>
        /// Move the telescope in one axis at the given rate.
        /// </summary>
        /// <param name="axis">The physical axis about which movement is desired</param>
        /// <param name="rate">The rate of motion (deg/sec) about the specified axis</param>
        public void MoveAxis(TelescopeAxes axis, double rate)
        {
            tl.LogMessage("MoveAxis", "TelescopeAxis - " + axis.ToString() + "Rate - " + rate.ToString());
            //Some checks on given values for API conformity
            if (axis == TelescopeAxes.axisTertiary)
            {
                throw new ASCOM.InvalidValueException("TelescopeAxes", axis.ToString(), "No ternary axis on ST-4");
            }
            IRate axisRate = this.AxisRates(axis)[1];

            if (Math.Abs(rate) > axisRate.Maximum || Math.Abs(rate) < axisRate.Minimum)
            {
                throw new ASCOM.InvalidValueException("AxisRate", rate.ToString(), axisRate.Minimum + ".." + axisRate.Maximum);
            }

            var orientation    = rate < 0 ? Orientation.Minus : Orientation.Plus;
            var axisController = axis == TelescopeAxes.axisPrimary ? raAxisController : decAxisController;

            if (rate == 0)
            {
                axisController.StopSlew();
            }
            else
            {
                axisController.StartSlew(orientation);
            }
        }
Example #12
0
 //
 // Constructor - Internal prevents public creation
 // of instances. Returned by Telescope.AxisRates.
 //
 internal AxisRates(TelescopeAxes Axis)
 {
     m_Axis = Axis;
     //
     // This collection must hold zero or more Rate objects describing the
     // rates of motion ranges for the Telescope.MoveAxis() method
     // that are supported by your driver. It is OK to leave this
     // array empty, indicating that MoveAxis() is not supported.
     //
     // Note that we are constructing a rate array for the axis passed
     // to the constructor. Thus we switch() below, and each case should
     // initialize the array for the rate for the selected axis.
     //
     switch (Axis)
     {
         case TelescopeAxes.axisPrimary:
             // TODO Initialize this array with any Primary axis rates that your driver may provide
             // Example: m_Rates = new Rate[] { new Rate(10.5, 30.2), new Rate(54.0, 43.6) }
             m_Rates = new Rate[0];
             break;
         case TelescopeAxes.axisSecondary:
             // TODO Initialize this array with any Secondary axis rates that your driver may provide
             m_Rates = new Rate[0];
             break;
         case TelescopeAxes.axisTertiary:
             // TODO Initialize this array with any Tertiary axis rates that your driver may provide
             m_Rates = new Rate[0];
             break;
     }
 }
Example #13
0
 public void MoveAxis(TelescopeAxes axis, double rate)
 {
     if (TelescopeInfo.Connected)
     {
         Telescope.MoveAxis(axis, rate);
     }
 }
Example #14
0
 //
 // Constructor - Internal prevents public creation
 // of instances. Returned by Telescope.AxisRates.
 //
 internal AxisRates(TelescopeAxes axis)
 {
     this.axis = axis;
     //
     // This collection must hold zero or more Rate objects describing the
     // rates of motion ranges for the Telescope.MoveAxis() method
     // that are supported by your driver. It is OK to leave this
     // array empty, indicating that MoveAxis() is not supported.
     //
     // Note that we are constructing a rate array for the axis passed
     // to the constructor. Thus we switch() below, and each case should
     // initialize the array for the rate for the selected axis.
     //
     switch (axis)
     {
         case TelescopeAxes.axisPrimary:
             // Example: m_Rates = new Rate[] { new Rate(10.5, 30.2), new Rate(54.0, 43.6) }
             this.rates = new Rate[]{new Rate(0, Constants.DEGREES_PER_SECOND * Constants.MAX_RATE_MULTIPLYER)};
             break;
         case TelescopeAxes.axisSecondary:
             this.rates = new Rate[] { new Rate(0, Constants.DEGREES_PER_SECOND * Constants.MAX_RATE_MULTIPLYER) };
             break;
         case TelescopeAxes.axisTertiary:
             this.rates = new Rate[0];
             break;
     }
 }
Example #15
0
        //
        // Constructor - Internal prevents public creation
        // of instances. Returned by SkyServer.AxisRates.
        //
        public AxisRates(TelescopeAxes axis)
        {
            //
            // This collection must hold zero or more Rate objects describing the
            // rates of motion ranges for the SkyServer.MoveAxis() method
            // that are supported by your driver. It is OK to leave this
            // array empty, indicating that MoveAxis() is not supported.
            //
            // Note that we are constructing a rate array for the axis passed
            // to the constructor. Thus we switch() below, and each case should
            // initialize the array for the rate for the selected axis.
            //
            switch (axis)
            {
            case TelescopeAxes.axisPrimary:
                // Example: m_Rates = new Rate[] { new Rate(10.5, 30.2), new Rate(54.0, 43.6) }
                _mRates = new[] { new Rate(0.0, SkyServer.SlewSpeedEight) };
                break;

            case TelescopeAxes.axisSecondary:
                _mRates = new[] { new Rate(0.0, SkyServer.SlewSpeedEight) };
                break;

            case TelescopeAxes.axisTertiary:
                _mRates = new[] { new Rate(0.0, SkyServer.SlewSpeedEight) };    //Conversions.Sec2ArcSec(SkyServer.SlewSpeedEight)) };
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(axis), axis, null);
            }
            _pos = -1;
        }
Example #16
0
        public void MoveAxis(TelescopeAxes telescopeAxis, double rate)
        {
            traceLogger.LogMessage("MoveAxis", "TelescopeAxis - " + telescopeAxis.ToString() + "Rate - " + rate.ToString());
            //Some checks on given values for API conformity
            if (telescopeAxis == TelescopeAxes.axisTertiary)
            {
                throw new ASCOM.InvalidValueException("TelescopeAxes", telescopeAxis.ToString(), "No ternary axis on ST-4");
            }
            IRate axisRate = this.AxisRates(telescopeAxis)[1];

            if (Math.Abs(rate) > axisRate.Maximum || Math.Abs(rate) < axisRate.Minimum)
            {
                throw new ASCOM.InvalidValueException("AxisRate", rate.ToString(), axisRate.Minimum + ".." + axisRate.Maximum);
            }

            Orientation    orientation            = rate > 0 ? Orientation.PLUS : Orientation.MINUS;
            Axis           axis                   = telescopeAxis == TelescopeAxes.axisPrimary ? Axis.RA : Axis.DEC;
            AxisController axisPositionController = axisControllers[(int)axis];

            if (rate == 0)
            {
                axisPositionController.Stop();
            }
            else
            {
                axisPositionController.Move(orientation);
            }
        }
Example #17
0
 public void MoveAxis(TelescopeAxes Axis, double Rate)
 {
     //Не влияет на стрелки
     //CommandBlind("--->", false);
     tl.LogMessage("MoveAxis", "Not implemented");
     throw new ASCOM.MethodNotImplementedException("MoveAxis");
 }
Example #18
0
        public SlewPlotter(TelescopeAxes axis, double start, double target)
        {
            Angle.Type angleType = axis == TelescopeAxes.axisPrimary ? Angle.Type.RA : Angle.Type.Dec;
            DateTime   utcNow    = DateTime.UtcNow;
            string     folder    = Wise40.Common.Debugger.LogDirectory() +
                                   string.Format("/slew-started-at-{0:D2}h{1:D2}m{2:D2}s_UTC", utcNow.Hour, utcNow.Minute, utcNow.Second);

            Directory.CreateDirectory(folder);
            string filename = folder + string.Format("/{0}.dat",
                                                     axis == TelescopeAxes.axisPrimary ? "RA" : "DEC"
                                                     );

            try
            {
                _sw           = new StreamWriter(filename);
                _sw.AutoFlush = true;
                _sw.WriteLine("#");
                _sw.WriteLine("# Started at: {0}", utcNow.ToShortDateString());
                _sw.WriteLine("# Start position: {0}", start.ToString());
                _sw.WriteLine("# Target position: {0}", target.ToString());
                _sw.WriteLine("# Axis: {0}", axis.ToString());
                _sw.WriteLine("#");
                _sw.WriteLine("# milliseconds position log10(abs(error))");
                _sw.WriteLine("#");
            } catch
            {
                _sw = null;
            }
            _start  = start;
            _target = target;
            _stopWatch.Start();
        }
Example #19
0
        private const double SiderealRateDPS = 0.004178; // degrees / second;

        //
        // Constructor - Internal prevents public creation
        // of instances. Returned by Telescope.AxisRates.
        //
        internal AxisRates(TelescopeAxes axis)
        {
            this.axis = axis;
            //
            // This collection must hold zero or more Rate objects describing the
            // rates of motion ranges for the Telescope.MoveAxis() method
            // that are supported by your driver. It is OK to leave this
            // array empty, indicating that MoveAxis() is not supported.
            //
            // Note that we are constructing a rate array for the axis passed
            // to the constructor. Thus we switch() below, and each case should
            // initialize the array for the rate for the selected axis.
            //
            switch (axis)
            {
            case TelescopeAxes.axisPrimary:
                // TODO Initialize this array with any Primary axis rates that your driver may provide
                // Example: m_Rates = new Rate[] { new Rate(10.5, 30.2), new Rate(54.0, 43.6) }
                // this.rates = new Rate[0];
                this.rates = new Rate[9]
                {
                    //new Rate(SiderealRateDPS *    0, SiderealRateDPS *    0), //Rate 0
                    new Rate(SiderealRateDPS * 1, SiderealRateDPS * 1),           //Rate 1
                    new Rate(SiderealRateDPS * 2, SiderealRateDPS * 2),           //Rate 2
                    new Rate(SiderealRateDPS * 8, SiderealRateDPS * 8),           //Rate 3
                    new Rate(SiderealRateDPS * 16, SiderealRateDPS * 16),         //Rate 4
                    new Rate(SiderealRateDPS * 64, SiderealRateDPS * 64),         //Rate 5
                    new Rate(SiderealRateDPS * 128, SiderealRateDPS * 128),       //Rate 6
                    new Rate(SiderealRateDPS * 256, SiderealRateDPS * 256),       //Rate 7
                    new Rate(SiderealRateDPS * 512, SiderealRateDPS * 512),       //Rate 8
                    new Rate(SiderealRateDPS * 1024, SiderealRateDPS * 1024)      //Rate 9
                };
                break;

            case TelescopeAxes.axisSecondary:
                // TODO Initialize this array with any Secondary axis rates that your driver may provide
                // this.rates = new Rate[0];
                // Secondary axis rates that ZEQ25 driver may provide
                this.rates = new Rate[9]
                {
                    //new Rate(SiderealRateDPS *    0, SiderealRateDPS *    0), //Rate 0
                    new Rate(SiderealRateDPS * 1, SiderealRateDPS * 1),           //Rate 1
                    new Rate(SiderealRateDPS * 2, SiderealRateDPS * 2),           //Rate 2
                    new Rate(SiderealRateDPS * 8, SiderealRateDPS * 8),           //Rate 3
                    new Rate(SiderealRateDPS * 16, SiderealRateDPS * 16),         //Rate 4
                    new Rate(SiderealRateDPS * 64, SiderealRateDPS * 64),         //Rate 5
                    new Rate(SiderealRateDPS * 128, SiderealRateDPS * 128),       //Rate 6
                    new Rate(SiderealRateDPS * 256, SiderealRateDPS * 256),       //Rate 7
                    new Rate(SiderealRateDPS * 512, SiderealRateDPS * 512),       //Rate 8
                    new Rate(SiderealRateDPS * 1024, SiderealRateDPS * 1024)      //Rate 9
                };
                break;

            case TelescopeAxes.axisTertiary:
                // TODO Initialize this array with any Tertiary axis rates that your driver may provide
                this.rates = new Rate[0];
                break;
            }
        }
Example #20
0
 public void MoveAxis(TelescopeAxes Axis, double Rate)
 {
     sysLog.LogMessage("MoveAxis", "Move at " + Rate);
     if ((int)Axis > m_Axes.Length - 1)
     {
         throw new DriverException("Axis not supported", ErrorCode(DriverErrors.AxisNotSupported));
     }
     m_Axes[(int)Axis].Rotate(Rate);
 }
Example #21
0
 public void MoveAxis(TelescopeAxes Axis, double Rate)
 {
     CheckConnected();
     if (Platform.IsTracking)
     {
         throw new InvalidOperationException("cannot MoveAxis when platform is tracking");
     }
     m_mount.MoveAxis(Axis, Rate);
 }
Example #22
0
 public void MoveAxis(TelescopeAxes Axis, double Rate)
 {
     /**
      * tl.LogMessage("MoveAxis", "Not implemented");
      * throw new ASCOM.MethodNotImplementedException("MoveAxis");
      **/
     tl.LogMessage("MoveAxis", "Implemented");
     //throw new ASCOM.MethodNotImplementedException("MoveAxis");
 }
        public IAxisRates AxisRates(TelescopeAxes Axis)
        {
            DynamicClientDriver.SetClientTimeout(client, standardDeviceResponseTimeout);
            Dictionary <string, string> Parameters = new Dictionary <string, string>
            {
                { SharedConstants.AXIS_PARAMETER_NAME, ((int)Axis).ToString(CultureInfo.InvariantCulture) }
            };

            return(DynamicClientDriver.SendToRemoteDevice <IAxisRates>(clientNumber, client, URIBase, TL, "AxisRates", Parameters, Method.GET));
        }
        public void MoveAxis(TelescopeAxes axis, double rate)
        {
            string name = GetNameFromAxis(axis);

            LogActivityStart(ActivityMessageTypes.Commands, "MoveAxis {0} at {1} deg/sec: ", name, rate);
            CheckDevice();
            Service.MoveAxis(axis, rate);
            Status.Slewing = rate != 0.0;
            LogActivityEnd(ActivityMessageTypes.Commands, Done);
        }
Example #25
0
        public bool CanMoveAxis(TelescopeAxes Axis)
        {
            RemoteClientDriver.SetClientTimeout(client, standardServerResponseTimeout);
            Dictionary <string, string> Parameters = new Dictionary <string, string>
            {
                { SharedConstants.AXIS_PARAMETER_NAME, ((int)Axis).ToString(CultureInfo.InvariantCulture) }
            };

            return(RemoteClientDriver.SendToRemoteDriver <bool>(clientNumber, client, URIBase, TL, "CanMoveAxis", Parameters, Method.GET));
        }
Example #26
0
        public IAxisRates AxisRates(TelescopeAxes Axis)
        {
            RemoteClientDriver.SetClientTimeout(client, standardServerResponseTimeout);
            Dictionary <string, string> Parameters = new Dictionary <string, string>
            {
                { SharedConstants.AXIS_PARAMETER_NAME, ((int)Axis).ToString() }
            };

            return(RemoteClientDriver.SendToRemoteDriver <IAxisRates>(clientNumber, client, URIBase, TL, "AxisRates", Parameters, Method.GET));
        }
Example #27
0
 public bool CanMoveAxis(TelescopeAxes Axis)
 {
     if (Axis == TelescopeAxes.axisTertiary)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Example #28
0
        public MotionStudy(TelescopeAxes axis, double rate, int intervalMillis = 500)
        {
            this.axis = axis;
            this.rate = rate;
            samplingIntervalMillis = intervalMillis;
            start      = DateTime.Now;
            dataPoints = new List <DataPoint>();
            TimerCallback TimerCallback = new TimerCallback(sampleMotion);

            timer = new Timer(TimerCallback, null, 0, samplingIntervalMillis);
        }
Example #29
0
        public void MoveAxis(TelescopeAxes Axis, double Rate)
        {
            RemoteClientDriver.SetClientTimeout(client, longServerResponseTimeout);
            Dictionary <string, string> Parameters = new Dictionary <string, string>
            {
                { SharedConstants.AXIS_PARAMETER_NAME, ((int)Axis).ToString(CultureInfo.InvariantCulture) },
                { SharedConstants.RATE_PARAMETER_NAME, Rate.ToString(CultureInfo.InvariantCulture) }
            };

            RemoteClientDriver.SendToRemoteDriver <NoReturnValue>(clientNumber, client, URIBase, TL, "MoveAxis", Parameters, Method.PUT);
        }
Example #30
0
        private void MakeSteps(TelescopeAxes axis, double rate, int millis, int nsteps)
        {
            scopeBackgroundMover = new BackgroundWorker();

            scopeBackgroundMover.WorkerSupportsCancellation = true;
            scopeBackgroundMover.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(scopeBackgroundMover_RunWorkerCompleted);
            scopeBackgroundMover.DoWork += new DoWorkEventHandler(scopeBackgroundMover_DoWork);

            scopeBackgroundMover.RunWorkerAsync(new TimedMovementArg()
            {
                axis = axis, rate = rate, millis = millis, nsteps = nsteps
            });
        }
Example #31
0
        public bool CanMoveAxis(TelescopeAxes Axis)
        {
            switch (Axis)
            {
            case TelescopeAxes.axisPrimary: return(canMove);

            case TelescopeAxes.axisSecondary: return(canMove);

            case TelescopeAxes.axisTertiary: return(false);

            default: throw new InvalidValueException("CanMoveAxis", Axis.ToString(), "0 to 2");
            }
        }
 public object AxisRates(TelescopeAxes Axis)
 {
     try
     {
         return(objTypeScope.InvokeMember("AxisRates",
                                          BindingFlags.Default | BindingFlags.InvokeMethod,
                                          null, objScopeLateBound, new object[] { (int)Axis }));
     }
     catch
     {
         return(null);
     }
 }
Example #33
0
        public bool CanMoveAxis(TelescopeAxes axis)
        {
            traceLogger.LogMessage("CanMoveAxis", "Get - " + axis.ToString());
            switch (axis)
            {
            case TelescopeAxes.axisPrimary: return(true);

            case TelescopeAxes.axisSecondary: return(true);

            case TelescopeAxes.axisTertiary: return(false);

            default: throw new InvalidValueException("CanMoveAxis", axis.ToString(), "0 to 2");
            }
        }
Example #34
0
 //
 // Constructor - Internal prevents public creation
 // of instances. Returned by Telescope.AxisRates.
 //
 internal AxisRates(TelescopeAxes axis)
 {
     switch (axis)
     {
         case TelescopeAxes.axisPrimary:
             this.rates = new Rate[] { new Rate(0, Constants.DEGREES_PER_SECOND * 8) };//8X Sideral Rate
             break;
         case TelescopeAxes.axisSecondary:
             this.rates = new Rate[] { new Rate(0, Constants.DEGREES_PER_SECOND * 8) };//8X Sideral Rate
             break;
         case TelescopeAxes.axisTertiary:
             this.rates = new Rate[] { new Rate(0, Constants.DEGREES_PER_SECOND * 8) };//8X Sideral Rate
             break;
     }
 }
Example #35
0
 public bool CanMoveAxis(TelescopeAxes Axis)
 {
     if (Axis == TelescopeAxes.axisTertiary)
     {
         return false;
     }
     else
     {
         return true;
     }
 }
Example #36
0
 public IAxisRates AxisRates(TelescopeAxes Axis)
 {
     switch (Axis)
     {
         case TelescopeAxes.axisPrimary:
             return m_AxisRates[0];
         case TelescopeAxes.axisSecondary:
             return m_AxisRates[1];
         default:
             return null;
     }
 }
Example #37
0
        //TODO: Update this to error when at park
        /// <summary>
        /// Move the telescope in one axis at the given rate. 
        /// </summary>
        /// <param name="axis">The physical axis about which movement is desired</param>
        /// <param name="rate">The rate of motion (deg/sec) about the specified axis</param>
        public void MoveAxis(TelescopeAxes axis, double rate)
        {
            tl.LogMessage("MoveAxis", "TelescopeAxis - " + axis.ToString() + "Rate - " + rate.ToString());
            //Some checks on given values for API conformity
            if (axis == TelescopeAxes.axisTertiary)
            {
                throw new ASCOM.InvalidValueException("TelescopeAxes", axis.ToString(), "No ternary axis on ST-4");
            }
            IRate axisRate = this.AxisRates(axis)[1];
            if (Math.Abs(rate) > axisRate.Maximum || Math.Abs(rate) < axisRate.Minimum)
            {
                throw new ASCOM.InvalidValueException("AxisRate", rate.ToString(), axisRate.Minimum + ".." + axisRate.Maximum);
            }

            var orientation = rate < 0 ? Orientation.Minus : Orientation.Plus;
            var axisController = axis == TelescopeAxes.axisPrimary ? raAxisController : decAxisController;

            if (rate == 0)
            {
                axisController.StopSlew();
            }
            else
            {
                axisController.StartSlew(orientation);
            }
        }
Example #38
0
        //
        // Constructor - Internal prevents public creation
        // of instances. Returned by Telescope.AxisRates.
        //
        internal AxisRates(TelescopeAxes Axis)
        {
            m_Axis = Axis;
            //
            // This collection must hold zero or more Rate objects describing the 
            // rates of motion ranges for the Telescope.MoveAxis() method
            // that are supported by your driver. It is OK to leave this 
            // array empty, indicating that MoveAxis() is not supported.
            //
            // Note that we are constructing a rate array for the axis passed
            // to the constructor. Thus we switch() below, and each case should 
            // initialize the array for the rate for the selected axis.
            //

            if (Axis == TelescopeAxes.axisTertiary)
            {
                m_Rates = new Rate[0];
                return;
            }

            // goto slew, centering, and guiding speeds from the mount
            string[] get_rates = { "<140:", "<170:", "<150:" };
            string[] result = null;

            GeminiHardware.Instance.DoCommandResult(get_rates, 3000, false, out result);

            // if didn't get a result or one of the results timed out, throw an error:
            if (result == null) throw new TimeoutException("AxisRates");
            foreach (string s in result)
                if (s == null) throw new TimeoutException("AxisRates");

            switch (Axis)
            {
                case TelescopeAxes.axisPrimary:
                case TelescopeAxes.axisSecondary:
                    m_Rates = new Rate[result.Length];
                    for (int idx = 0; idx < result.Length; ++idx)
                    {
                        double rate = 0;
                        if (!GeminiHardware.Instance.m_Util.StringToDouble(result[idx], out rate))
                            throw new TimeoutException("AxisRates");
                        rate = rate * SharedResources.EARTH_ANG_ROT_DEG_MIN / 60.0;  // convert to rate in deg/sec
                        m_Rates[idx] = new Rate(rate, rate);
                    }
                    break;
            }
        }
 public void MoveAxis(TelescopeAxes Axis, double Rate)
 {
     /**
     tl.LogMessage("MoveAxis", "Not implemented");
     throw new ASCOM.MethodNotImplementedException("MoveAxis");
      **/
     tl.LogMessage("MoveAxis", "Implemented");
     //throw new ASCOM.MethodNotImplementedException("MoveAxis");
     
 }
Example #40
0
 public bool CanMoveAxis(TelescopeAxes Axis)
 {
     throw new NotImplementedException();
 }
Example #41
0
 public IAxisRates AxisRates(TelescopeAxes Axis)
 {
     throw new NotImplementedException();
 }
Example #42
0
 public IAxisRates AxisRates(TelescopeAxes axis)
 {
     traceLogger.LogMessage("AxisRates", "Get - " + axis.ToString());
     return new AxisRates(axis);
 }
        public void MoveAxis(TelescopeAxes Axis, double Rate)
        {
            this.isSlewing = true;

            switch (Axis)
            {
                case TelescopeAxes.axisPrimary:
                    if (Rate > 0)
                    {
                        SerialConnection.Transmit(": E #");
                    }
                    else if (Rate < 0)
                    {
                        SerialConnection.Transmit(": W #");
                    }
                    break;
                case TelescopeAxes.axisSecondary:
                    if (Rate > 0)
                    {
                        SerialConnection.Transmit(": N #");
                    }
                    else if (Rate < 0)
                    {
                        SerialConnection.Transmit(": S #");
                    }
                    break;
            }

            this.isSlewing = false;
        }
 public bool CanMoveAxis(TelescopeAxes Axis)
 {
     return true;
 }
Example #45
0
        public void MoveAxis(TelescopeAxes telescopeAxis, double rate)
        {
            traceLogger.LogMessage("MoveAxis", "TelescopeAxis - " + telescopeAxis.ToString() + "Rate - " + rate.ToString());
            //Some checks on given values for API conformity
            if (telescopeAxis == TelescopeAxes.axisTertiary)
            {
                throw new ASCOM.InvalidValueException("TelescopeAxes", telescopeAxis.ToString(), "No ternary axis on ST-4");
            }
            IRate axisRate = this.AxisRates(telescopeAxis)[1];
            if (Math.Abs(rate) > axisRate.Maximum || Math.Abs(rate) < axisRate.Minimum)
            {
                throw new ASCOM.InvalidValueException("AxisRate", rate.ToString(), axisRate.Minimum + ".." + axisRate.Maximum);
            }

            Orientation orientation = rate > 0 ? Orientation.PLUS : Orientation.MINUS;
            Axis axis = telescopeAxis == TelescopeAxes.axisPrimary ? Axis.RA : Axis.DEC;
            AxisController axisPositionController = axisControllers[(int)axis];
            if (rate == 0)
            {
                axisPositionController.Stop();
            }
            else
            {
                axisPositionController.Move(orientation);
            }
        }
 public void MoveAxis(TelescopeAxes Axis, double Rate)
 {
     objTypeScope.InvokeMember("MoveAxis", BindingFlags.Default | BindingFlags.InvokeMethod,
             null, objScopeLateBound, new object[] { Axis, Rate });
 }
Example #47
0
 public void MoveAxis(TelescopeAxes Axis, double Rate)
 {
     sysLog.LogMessage("MoveAxis", "Move at " + Rate);
     if ((int)Axis > m_Axes.Length - 1)
     {
         throw new DriverException("Axis not supported", ErrorCode(DriverErrors.AxisNotSupported));
     }
     m_Axes[(int)Axis].Rotate(Rate);
 }
 public object AxisRates(TelescopeAxes Axis)
 {
     try
     {
         return objTypeScope.InvokeMember("AxisRates",
             BindingFlags.Default | BindingFlags.InvokeMethod,
             null, objScopeLateBound, new object[] { (int)Axis });
     }
     catch
     {
         return null;
     }
 }
Example #49
0
 public void MoveAxis(TelescopeAxes Axis, double Rate)
 {
     throw new NotImplementedException();
 }
Example #50
0
        private bool TrackingState = true;  //set when MoveAxis is initiated, restored when it ended

        public void MoveAxis(TelescopeAxes Axis, double Rate)
        {
            GeminiHardware.Instance.Trace.Enter("IT:MoveAxis", Axis, Rate);

            AssertConnect();
            if (GeminiHardware.Instance.AtPark) throw new DriverException(SharedResources.MSG_INVALID_AT_PARK, (int)SharedResources.INVALID_AT_PARK);


            string[] cmds = { null, null };

            switch (Axis)
            {
                case TelescopeAxes.axisPrimary: //RA
                    if (Rate < 0) cmds[1] = ":Me";
                    else if (Rate > 0)
                        cmds[1] = ":Mw";
                    else
                    {
                        GeminiHardware.Instance.DoCommandResult(new string[] { ":Qe", ":Qw" }, GeminiHardware.Instance.MAX_TIMEOUT / 2, false); //stop motion in RA
                        GeminiHardware.Instance.WaitForVelocity("T", GeminiHardware.Instance.MAX_TIMEOUT);
                        if (!TrackingState)
                        {
                            GeminiHardware.Instance.DoCommandResult(":hN", GeminiHardware.Instance.MAX_TIMEOUT, false);
                            GeminiHardware.Instance.WaitForVelocity("N", GeminiHardware.Instance.MAX_TIMEOUT);
                            GeminiHardware.Instance.Tracking = false;
                        }
                        GeminiHardware.Instance.Trace.Exit("IT:MoveAxis", Axis, Rate);
                        return;
                    }
                    break;
                case TelescopeAxes.axisSecondary: //DEC
                    if (Rate < 0) cmds[1] = ":Ms";
                    else if (Rate > 0)
                        cmds[1] = ":Mn";
                    else
                    {
                        GeminiHardware.Instance.DoCommandResult(new string[] { ":Qn", ":Qs" }, GeminiHardware.Instance.MAX_TIMEOUT / 2, false); //stop motion in DEC
                        GeminiHardware.Instance.WaitForVelocity("T", GeminiHardware.Instance.MAX_TIMEOUT);
                        GeminiHardware.Instance.Trace.Exit("IT:MoveAxis", Axis, Rate);
                        if (!TrackingState)
                        {
                            GeminiHardware.Instance.DoCommandResult(":hN", GeminiHardware.Instance.MAX_TIMEOUT, false);
                            GeminiHardware.Instance.WaitForVelocity("N", GeminiHardware.Instance.MAX_TIMEOUT);
                            GeminiHardware.Instance.Tracking = false;
                        }
                        return;
                    }
                    break;
                default:
                    throw new ASCOM.InvalidValueException("MoveAxis", Axis.ToString(), "Primary,Secondary");
            }

            Rate = Math.Abs(Rate);

            const double RateTolerance = 1e-5;  // 1e-6 is 0.036 arcseconds/second

            // find the rate in the list of rates. The position will determine if it's
            // guiding, slewing, or centering rate:
            int cnt = 0;
            foreach (Rate r in AxisRates(Axis))
            {
                if (r.Minimum >= Rate - RateTolerance && r.Minimum <= Rate + RateTolerance) // use tolerance to ensure doubles compare properly
                    break;
                cnt++;
            }

            switch (cnt)
            {
                case 0: // slew rate
                    cmds[0] = ":RS"; break;
                case 1: // center rate
                    cmds[0] = ":RC"; break;
                case 2: // guide rate
                    cmds[0] = ":RG"; break;

                default:
                    throw new ASCOM.InvalidValueException("MoveAxis", Axis.ToString(), "guiding, centering, or slewing speeds");
            }

            TrackingState = GeminiHardware.Instance.Tracking;

            GeminiHardware.Instance.DoCommandResult(cmds, GeminiHardware.Instance.MAX_TIMEOUT / 2, false);
            GeminiHardware.Instance.WaitForVelocity("GCS", GeminiHardware.Instance.MAX_TIMEOUT);
            GeminiHardware.Instance.Trace.Exit("IT:MoveAxis", Axis, Rate);
        }
 public bool CanMoveAxis(TelescopeAxes Axis)
 {
     return (bool)objTypeScope.InvokeMember("CanMoveAxis", BindingFlags.Default | BindingFlags.InvokeMethod,
             null, objScopeLateBound, new object[] {(int)Axis });
 }
Example #52
0
 /// <summary>
 /// Determine the rates at which the telescope may be moved about the specified axis by the MoveAxis(TelescopeAxes, Double) method
 /// </summary>
 /// <param name="Axis">The axis about which rate information is desired (TelescopeAxes value)</param>
 /// <returns>Collection of IRate rate objects</returns>
 public IAxisRates AxisRates(TelescopeAxes Axis)
 {
     tl.LogMessage("AxisRates", "Get - " + Axis.ToString());
     return new AxisRates(Axis);
 }
Example #53
0
        public void MoveAxis(TelescopeAxes Axis, double Rate)
        {
            if (CanMoveAxis(Axis))
            {

                //String commString = Axis.ToString() + ", " + Rate.ToString();
                tl.LogMessage("MoveAxis", "Not implemented");
                throw new ASCOM.MethodNotImplementedException("MoveAxis");
                //tl.LogMessage("MoveAxis", "Move - " + Axis.ToString() + ", " + Rate.ToString());
                //
                //CommandBlind(commString, false);
                //CommandBlind(CommandFormatter(DCommandList.DMoveAxis), false);
            }
            else
            {
                tl.LogMessage("CanMoveAxis", "Not implemented");
                throw new ASCOM.MethodNotImplementedException("CanMoveAxis");
            }
        }
Example #54
0
 /// <summary>
 /// True if this telescope can move the requested axis 
 /// </summary>
 /// <param name="Axis">Primary, Secondary or Tertiary axis</param>
 /// <returns>Boolean indicating can or can not move the requested axis</returns>
 public bool CanMoveAxis(TelescopeAxes Axis)
 {
     tl.LogMessage("CanMoveAxis", "Get - " + Axis.ToString());
     switch (Axis)
     {
         case TelescopeAxes.axisPrimary: return true;
         case TelescopeAxes.axisSecondary: return true;
         case TelescopeAxes.axisTertiary: return false;
         default: throw new InvalidValueException("CanMoveAxis", Axis.ToString(), "0 to 2");
     }
 }
Example #55
0
        public IAxisRates AxisRates(TelescopeAxes Axis)
        {
            AssertConnect();
            GeminiHardware.Instance.Trace.Enter("IT:AxisRates");

            if (m_AxisRates == null)
            {
                if (GeminiHardware.Instance.Connected)
                {
                    m_AxisRates = new AxisRates[3];
                    m_AxisRates[0] = new AxisRates(TelescopeAxes.axisPrimary);
                    m_AxisRates[1] = new AxisRates(TelescopeAxes.axisSecondary);
                    m_AxisRates[2] = new AxisRates(TelescopeAxes.axisTertiary);
                }
                else
                    return null;
            }

            switch (Axis)
            {
                case TelescopeAxes.axisPrimary:
                    return m_AxisRates[0];
                case TelescopeAxes.axisSecondary:
                    return m_AxisRates[1];
                case TelescopeAxes.axisTertiary:
                    return m_AxisRates[2];
                default:
                    return null;
            }
        }
Example #56
0
 public bool CanMoveAxis(TelescopeAxes Axis)
 {
     switch (Axis)
     {
         case TelescopeAxes.axisPrimary:
             GeminiHardware.Instance.Trace.Enter("IT:CanMoveAxis.Get", Axis, true);
             return true;
         case TelescopeAxes.axisSecondary:
             GeminiHardware.Instance.Trace.Enter("IT:CanMoveAxis.Get", Axis, true);
             return true;
         case TelescopeAxes.axisTertiary:
             GeminiHardware.Instance.Trace.Enter("IT:CanMoveAxis.Get", Axis, false);
             return false;
         default:
             GeminiHardware.Instance.Trace.Enter("IT:CanMoveAxis.Get", Axis, false);
             return false;
     }
 }