Example #1
0
        static void Main(string[] args)
        {
            // Uncomment the code that's required
#if UseChooser
            // choose the device
            string id = ASCOM.DriverAccess.Telescope.Choose("");
            if (string.IsNullOrEmpty(id))
            {
                return;
            }
            // create this device
            ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope(id);
#else
            // this can be replaced by this code, it avoids the chooser and creates the driver class directly.
            ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.PushToGo.Telescope");
#endif
            // now run some tests, adding code to your driver so that the tests will pass.
            // these first tests are common to all drivers.
            Console.WriteLine("name " + device.Name);
            Console.WriteLine("description " + device.Description);
            Console.WriteLine("DriverInfo " + device.DriverInfo);
            Console.WriteLine("driverVersion " + device.DriverVersion);

            device.Connected = true;

            Console.WriteLine("CurrentPos: " + device.RightAscension + " " + device.Declination);
            Console.WriteLine("CurrentAltAzPos: " + device.Altitude + " " + device.Azimuth);

            Console.WriteLine("PierSide: " + device.SideOfPier.ToString());

            if (device.AtPark)
            {
                device.Unpark();
            }

            device.Tracking = true;

            Console.WriteLine("Test slewing");
            device.SlewToAltAz(15, 50);

            Console.WriteLine("CurrentAltAzPos: " + device.Altitude + " " + device.Azimuth);

            device.GuideRateDeclination = 0.00208903731;

            Console.WriteLine("GuideRate: >" + device.CommandString("speed guide", false) + "<");
            Console.WriteLine("GuideRate: >" + device.CommandString("speed guide", false) + "<");
            Console.WriteLine("GuideRate: >" + device.CommandString("speed guide", false) + "<");
            Console.WriteLine("GuideRate: >" + device.CommandString("speed guide", false) + "<");
            Console.WriteLine("GuideRate: " + device.GuideRateDeclination);

            //Thread.Sleep(500);
            //device.SetupDialog(); // show setup

            //Console.WriteLine("Test homing");
            //device.Park();

            device.Connected = false;
            Console.WriteLine("Press Enter to finish");
            Console.ReadLine();
        }
Example #2
0
 public void SlewToAltAz(double Azimuth, double Altitude)
 {
     CheckConnected();
     if (Platform.IsTracking)
     {
         throw new InvalidOperationException("cannot SlewToAltAz when platform is tracking");
     }
     m_mount.SlewToAltAz(Azimuth, Altitude);
 }
Example #3
0
        private void SlewToAltAz_Click(object sender, EventArgs e)
        {
            double AltitudeIn = Convert.ToDouble(AltitudeInput.Text);
            double AzimuthIn  = Convert.ToDouble(AzimuthInput.Text);

            if (((0.0 <= AltitudeIn) && (AltitudeIn <= 360.0)) &&
                ((0.0 <= AzimuthIn) && (AzimuthIn <= 360.0)))
            {
                driver.SlewToAltAz(AzimuthIn, AltitudeIn);
            }

            AzimuthBox.Text  = driver.Azimuth.ToString();
            AltitudeBox.Text = driver.Altitude.ToString();
        }
        public void TestDriverSupportedFeatures()
        {
            using (var device = new ASCOM.DriverAccess.Telescope("ASCOM.EQ500X.Telescope"))
            {
                Assert.AreEqual(0, device.SupportedActions.Count);

                /* Moving */
                //Assert.ThrowsException<ASCOM.NotConnectedException>(() => device.MoveAxis(TelescopeAxes.axisPrimary, 0));
                //Assert.ThrowsException<ASCOM.NotConnectedException>(() => device.MoveAxis(TelescopeAxes.axisSecondary, 0));
                Assert.IsTrue(device.CanMoveAxis(TelescopeAxes.axisPrimary));
                Assert.IsTrue(device.CanMoveAxis(TelescopeAxes.axisSecondary));
                Assert.IsFalse(device.CanMoveAxis(TelescopeAxes.axisTertiary));

                /* Tracking */
                Assert.IsFalse(device.CanSetDeclinationRate);
                Assert.IsFalse(device.CanSetRightAscensionRate);
                Assert.IsFalse(device.CanSetTracking);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.DeclinationRate);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.DeclinationRate = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.RightAscensionRate);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.RightAscensionRate = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.Tracking);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.Tracking = false);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TrackingRate);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TrackingRate = DriveRates.driveSidereal);

                /* Slewing */
                Assert.IsTrue(device.CanSlew);
                Assert.IsFalse(device.CanSlewAltAz);
                Assert.IsFalse(device.CanSlewAltAzAsync);
                Assert.IsTrue(device.CanSlewAsync);
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(device.AbortSlew);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(() => device.SlewToAltAz(0, 0));
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(() => device.SlewToAltAzAsync(0, 0));
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(() => device.SlewToCoordinates(0, 0));
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(() => device.SlewToCoordinatesAsync(0, 0));
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(device.SlewToTarget);
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(device.SlewToTargetAsync);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.Slewing);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(() => device.DestinationSideOfPier(0, 0));
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.SlewSettleTime);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.SlewSettleTime = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TargetDeclination);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TargetDeclination = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TargetRightAscension);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.TargetRightAscension = 0);

                /* Parking */
                Assert.IsFalse(device.CanFindHome);
                Assert.IsFalse(device.CanPark);
                Assert.IsFalse(device.CanSetPark);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(device.FindHome);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(device.FindHome);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(device.SetPark);
                Assert.ThrowsException <ASCOM.MethodNotImplementedException>(device.Unpark);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.AtHome);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.AtPark);

                /* Guiding */
                Assert.IsTrue(device.CanPulseGuide);
                Assert.IsFalse(device.CanSetGuideRates);
                //Assert.ThrowsException<ASCOM.MethodNotImplementedException>(() => device.PulseGuide(GuideDirections.guideEast, 0));
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.GuideRateDeclination);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.GuideRateDeclination = 0);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.GuideRateRightAscension);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.GuideRateRightAscension = 0);
                //Assert.ThrowsException<ASCOM.PropertyNotImplementedException>(() => device.IsPulseGuiding);

                /* Optical */
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.ApertureArea);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.ApertureDiameter);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.ApertureArea);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.DoesRefraction);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.DoesRefraction = false);
                Assert.ThrowsException <ASCOM.PropertyNotImplementedException>(() => device.FocalLength);
            }
        }