コード例 #1
0
        private void SetAzm_Click(object sender, EventArgs e)
        {
            double param1 = Convert.ToDouble(AltitudeBox.Text);
            double param2 = Convert.ToDouble(AzimuthBox.Text);

            if (((0.0 <= param1) && (param1 <= 360.0)) &&
                ((0.0 <= param2) && (param2 <= 360.0)))
            {
                driver.SyncToAltAz(param1, param2);
            }

            AzimuthBox.Text  = driver.Azimuth.ToString();
            AltitudeBox.Text = driver.Altitude.ToString();
        }
コード例 #2
0
 public void SyncToAltAz(double Azimuth, double Altitude)
 {
     CheckConnected();
     if (Platform.IsTracking)
     {
         InitTransformSite();
         transform.SetAzimuthElevation(Azimuth, Altitude);
         Platform.SyncToCoordinates(transform.RATopocentric, transform.DECTopocentric);
     }
     else
     {
         m_mount.SyncToAltAz(Azimuth, Altitude);
     }
 }
コード例 #3
0
        public void TestSyncing()
        {
            Assert.IsFalse(device.Connected);
            device.Connected = true;
            Assert.IsTrue(device.CanSync);
            Assert.IsFalse(device.CanSyncAltAz);
            Assert.ThrowsException <ASCOM.MethodNotImplementedException>(() => device.SyncToAltAz(0, 0));

            /*
             * for (int ra = 0; ra < 24 * 60 * 60; ra++)
             * {
             *  for (int dec = -89 * 60 * 60; dec < 89 * 60 * 60; dec++)
             *  {
             *      double RA = ra / 3600.0;
             *      double DEC = dec / 3600.0;
             *      device.SyncToCoordinates(RA, DEC);
             *      Assert.AreEqual(RA, device.RightAscension);
             *      Assert.AreEqual(DEC, device.Declination);
             *  }
             * }
             */

            MechanicalPoint p = new MechanicalPoint();

            Assert.IsFalse(getCurrentMechanicalPosition(ref p));
            Assert.AreEqual(0.0, p.RAm);
            Assert.AreEqual(0.0, p.DECm);
            Assert.AreEqual(0.0, p.RAsky);
            Assert.AreEqual(90.0, p.DECsky);
            Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState);

            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SyncToCoordinates(-0.1, 0));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SyncToCoordinates(+24.1, 0));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SyncToCoordinates(0, -91));
            Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SyncToCoordinates(0, +91));

            device.SyncToCoordinates(0, 0);
            Assert.IsFalse(getCurrentMechanicalPosition(ref p));
            Assert.AreEqual(0.0, p.RAm);
            Assert.AreEqual(90.0, p.DECm);
            Assert.AreEqual(0.0, p.RAsky);
            Assert.AreEqual(0.0, p.DECsky);
            Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState);

            device.SyncToCoordinates(10, 0);
            Assert.IsFalse(getCurrentMechanicalPosition(ref p));
            Assert.AreEqual(10.0, p.RAm);
            Assert.AreEqual(90.0, p.DECm);
            Assert.AreEqual(10.0, p.RAsky);
            Assert.AreEqual(0.0, p.DECsky);
            Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState);

            device.SyncToCoordinates(14, 0);
            Assert.IsFalse(getCurrentMechanicalPosition(ref p));
            Assert.AreEqual(14.0, p.RAm);
            Assert.AreEqual(90.0, p.DECm);
            Assert.AreEqual(14.0, p.RAsky);
            Assert.AreEqual(0.0, p.DECsky);
            Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState);

            device.SyncToCoordinates(0, 10);
            Assert.IsFalse(getCurrentMechanicalPosition(ref p));
            Assert.AreEqual(0.0, p.RAm);
            Assert.AreEqual(80.0, p.DECm);
            Assert.AreEqual(0.0, p.RAsky);
            Assert.AreEqual(10.0, p.DECsky);
            Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState);

            device.SyncToCoordinates(0, -10);
            Assert.IsFalse(getCurrentMechanicalPosition(ref p));
            Assert.AreEqual(0.0, p.RAm);
            Assert.AreEqual(100.0, p.DECm);
            Assert.AreEqual(0.0, p.RAsky);
            Assert.AreEqual(-10.0, p.DECsky);
            Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState);

            device.SyncToCoordinates(14, -10);
            Assert.IsFalse(getCurrentMechanicalPosition(ref p));
            Assert.AreEqual(14.0, p.RAm);
            Assert.AreEqual(100.0, p.DECm);
            Assert.AreEqual(14.0, p.RAsky);
            Assert.AreEqual(-10.0, p.DECsky);
            Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState);

            device.SyncToCoordinates(0, 0);
            Assert.IsFalse(getCurrentMechanicalPosition(ref p));
            Assert.AreEqual(0.0, p.RAm);
            Assert.AreEqual(90.0, p.DECm);
            Assert.AreEqual(0.0, p.RAsky);
            Assert.AreEqual(0.0, p.DECsky);
            Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState);

            device.TargetRightAscension = 10;
            device.TargetDeclination    = 0;
            device.SyncToTarget();
            Assert.IsFalse(getCurrentMechanicalPosition(ref p));
            Assert.AreEqual(10.0, p.RAm);
            Assert.AreEqual(90.0, p.DECm);
            Assert.AreEqual(10.0, p.RAsky);
            Assert.AreEqual(0.0, p.DECsky);
            Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState);

            device.TargetRightAscension = 14;
            device.TargetDeclination    = 0;
            device.SyncToTarget();
            Assert.IsFalse(getCurrentMechanicalPosition(ref p));
            Assert.AreEqual(14.0, p.RAm);
            Assert.AreEqual(90.0, p.DECm);
            Assert.AreEqual(14.0, p.RAsky);
            Assert.AreEqual(0.0, p.DECsky);
            Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState);

            device.TargetRightAscension = 0;
            device.TargetDeclination    = 10;
            device.SyncToTarget();
            Assert.IsFalse(getCurrentMechanicalPosition(ref p));
            Assert.AreEqual(0.0, p.RAm);
            Assert.AreEqual(80.0, p.DECm);
            Assert.AreEqual(0.0, p.RAsky);
            Assert.AreEqual(10.0, p.DECsky);
            Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState);

            device.TargetRightAscension = 0;
            device.TargetDeclination    = -10;
            device.SyncToTarget();
            Assert.IsFalse(getCurrentMechanicalPosition(ref p));
            Assert.AreEqual(0.0, p.RAm);
            Assert.AreEqual(100.0, p.DECm);
            Assert.AreEqual(0.0, p.RAsky);
            Assert.AreEqual(-10.0, p.DECsky);
            Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState);

            device.TargetRightAscension = 14;
            device.TargetDeclination    = -10;
            device.SyncToTarget();
            Assert.IsFalse(getCurrentMechanicalPosition(ref p));
            Assert.AreEqual(14.0, p.RAm);
            Assert.AreEqual(100.0, p.DECm);
            Assert.AreEqual(14.0, p.RAsky);
            Assert.AreEqual(-10.0, p.DECsky);
            Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState);
        }