public void ApplyOffsetTrackingTest()
        {
            double targetRaOffsetRate  = 200.0;
            double targetDecOffsetRate = -200.0;

            _vm.IsConnected   = true;
            _vm.Capabilities  = TelescopeCapabilities.GetFullCapabilities();
            _vm.Status        = DevHubTelescopeStatus.GetEmptyStatus();
            _vm.RaOffsetRate  = targetRaOffsetRate;
            _vm.DecOffsetRate = targetDecOffsetRate;

            _mgr.MockTrackingRate = DriveRates.driveSidereal;

            _prVm.Invoke("ApplyOffsetTracking");

            double expectedRaRate  = targetRaOffsetRate * Globals.UTC_SECS_PER_SIDEREAL_SEC / (15.0 * 3600.0);
            double expectedDecRate = targetDecOffsetRate / 3600.0;

            Assert.AreEqual(DriveRates.driveSidereal, _mgr.MockTrackingRate);
            Assert.AreEqual(expectedRaRate, _mgr.MockRightAscensionOffsetRate, 0.0001);
            Assert.AreEqual(expectedDecRate, _mgr.MockDeclinationOffsetRate);

            _prVm.Invoke("ApplySiderealTracking");

            Assert.AreEqual(DriveRates.driveSidereal, _mgr.MockTrackingRate);
            Assert.AreEqual(0.0, _mgr.MockRightAscensionOffsetRate);
            Assert.AreEqual(0.0, _mgr.MockDeclinationOffsetRate);
        }
        public void ApplySiderealTrackingTest()
        {
            _vm.IsConnected  = true;
            _vm.Capabilities = TelescopeCapabilities.GetFullCapabilities();
            _vm.Status       = DevHubTelescopeStatus.GetEmptyStatus();
            //_mgr.MockTrackingRate = DriveRates.driveLunar;

            _prVm.Invoke("ApplyLunarTracking");

            Assert.AreEqual(DriveRates.driveLunar, _mgr.MockTrackingRate);

            _prVm.Invoke("ApplySiderealTracking");

            Assert.AreEqual(DriveRates.driveSidereal, _mgr.MockTrackingRate);
            Assert.AreEqual(0.0, _mgr.MockRightAscensionOffsetRate);
            Assert.AreEqual(0.0, _mgr.MockDeclinationOffsetRate);

            _mgr.MockTrackingRate             = DriveRates.driveSidereal;
            _mgr.MockRightAscensionOffsetRate = 200.0;
            _mgr.MockDeclinationOffsetRate    = -200.0;

            _prVm.Invoke("ApplySiderealTracking");

            Assert.AreEqual(DriveRates.driveSidereal, _mgr.MockTrackingRate);
            Assert.AreEqual(0.0, _mgr.MockRightAscensionOffsetRate);
            Assert.AreEqual(0.0, _mgr.MockDeclinationOffsetRate);
        }
Пример #3
0
        public void CanChangeParkState()
        {
            TelescopeCapabilities caps   = TelescopeCapabilities.GetFullCapabilities();
            DevHubTelescopeStatus status = DevHubTelescopeStatus.GetEmptyStatus();

            _vm.Status       = null;
            _vm.Capabilities = caps;

            bool result = (bool)_prVm.Invoke("CanChangeParkState");

            Assert.IsFalse(result);               // No device status

            _vm.Status       = status;
            _vm.Capabilities = null;

            result = (bool)_prVm.Invoke("CanChangeParkState");
            Assert.IsFalse(result);               // No device capabilities

            _vm.Capabilities = caps;

            result = (bool)_prVm.Invoke("CanChangeParkState");
            Assert.IsFalse(result);               // Not connected

            _vm.Status.Connected = true;

            // Set the state to Parked and test if we are allowed to unpark the scope.

            _vm.Status.ParkingState = ParkingStateEnum.IsAtPark;

            _vm.Capabilities.CanUnpark = false;

            result = (bool)_prVm.Invoke("CanChangeParkState");
            Assert.IsFalse(result);               // Not capable

            _vm.Capabilities.CanUnpark = true;

            result = (bool)_prVm.Invoke("CanChangeParkState");
            Assert.IsTrue(result);               // Can unpark

            // Set the state to Unparked and test if we are allowed to park the scope.

            _vm.Status.ParkingState  = ParkingStateEnum.Unparked;
            _vm.Capabilities.CanPark = false;

            result = (bool)_prVm.Invoke("CanChangeParkState");
            Assert.IsFalse(result);               // Not capable

            _vm.Capabilities.CanPark = true;
            _vm.Status.Slewing       = true;

            result = (bool)_prVm.Invoke("CanChangeParkState");
            Assert.IsFalse(result);               // Scope is already slewing

            _vm.Status.Slewing = false;

            result = (bool)_prVm.Invoke("CanChangeParkState");
            Assert.IsTrue(result);               // Can park
        }
Пример #4
0
        private TelescopeCapabilities IntializeEmptyAxisRatesCapabilities()
        {
            TelescopeCapabilities capabilities = TelescopeCapabilities.GetFullCapabilities();

            AxisRates.ClearRates();
            capabilities.PrimaryAxisRates   = AxisRatesToArray(new AxisRates(TelescopeAxes.axisPrimary));
            capabilities.SecondaryAxisRates = AxisRatesToArray(new AxisRates(TelescopeAxes.axisSecondary));
            capabilities.TertiaryAxisRates  = AxisRatesToArray(new AxisRates(TelescopeAxes.axisTertiary));

            return(capabilities);
        }
Пример #5
0
        private TelescopeCapabilities InitializeAsymmetricCapabilities()
        {
            TelescopeCapabilities capabilities = TelescopeCapabilities.GetFullCapabilities();

            AxisRates.SetAsymmetricRates();
            capabilities.PrimaryAxisRates   = AxisRatesToArray(new AxisRates(TelescopeAxes.axisPrimary));
            capabilities.SecondaryAxisRates = AxisRatesToArray(new AxisRates(TelescopeAxes.axisSecondary));
            capabilities.TertiaryAxisRates  = AxisRatesToArray(new AxisRates(TelescopeAxes.axisTertiary));

            return(capabilities);
        }
Пример #6
0
        public void CanJogScope()
        {
            TelescopeParameters parms = new TelescopeParameters
            {
                AlignmentMode = AlignmentModes.algGermanPolar
            };
            DevHubTelescopeStatus status = DevHubTelescopeStatus.GetEmptyStatus();
            TelescopeCapabilities caps   = TelescopeCapabilities.GetFullCapabilities();

            _vm.Status       = null;
            _vm.Parameters   = parms;
            _vm.Capabilities = caps;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // No device status

            _vm.Status     = status;
            _vm.Parameters = null;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // No device parameters

            _vm.Parameters   = parms;
            _vm.Capabilities = null;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // No capabilities

            _vm.Capabilities = caps;

            // Test variable jogs with MoveAxis and PulseGuide

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // Not connected

            _vm.Status.Connected = true;

            // Test variable jogs with MoveAxis and PulseGuide

            _vm.IsVariableJog = true;
            _vm.Capabilities.CanMovePrimaryAxis = false;
            _vm.Capabilities.CanPulseGuide      = false;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // Can't MoveAxis or PulseGuide

            _vm.Capabilities.CanMovePrimaryAxis   = true;
            _vm.Capabilities.CanMoveSecondaryAxis = false;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // Can't MoveAxis or PulseGuide

            _vm.Capabilities.CanMoveSecondaryAxis = true;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // No Axis Rates Defined

            object[] rates = new IRate[] { new AxisRate(0.0, 5.0) };
            _vm.Capabilities.PrimaryAxisRates = (IRate[])rates;
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // No Secondary axis rates defined

            _vm.Capabilities.SecondaryAxisRates = (IRate[])rates;
            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsTrue(_vm.CanStartMoveTelescope);               // Not Tracking, but MoveAxis is OK ???

            _vm.Status.Tracking = true;

            _prVm.Invoke("UpdateCanStartMove");               // Ready to do variable slews (Move Axis or PulseGuide)
            Assert.IsTrue(_vm.CanStartMoveTelescope);

            // Now test fixed RA/Dec jogs

            _vm.IsVariableJog = false;

            _vm.Capabilities = TelescopeCapabilities.GetFullCapabilities();

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsTrue(_vm.CanStartMoveTelescope);               // Ready to do fixed RA/Dec slews (sync or async)

            _vm.Capabilities.CanSlewAsync = false;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsTrue(_vm.CanStartMoveTelescope);               // Ready to do fixed sync RA/Dec slews

            _vm.Capabilities.CanSlew      = false;
            _vm.Capabilities.CanSlewAltAz = false;
            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);                // Can't do fixed sync or async RA/Dec or Alt/Az slews

            // Finally test jogging via alt-az slews.

            _vm.Parameters.EquatorialSystem = EquatorialCoordinateType.equTopocentric;
            _vm.Status.Tracking             = false;

            _vm.Capabilities.CanSlewAltAz = true;
            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsTrue(_vm.CanStartMoveTelescope);               // Can slew either sync or async Alt-Az.

            _vm.Capabilities.CanSlewAltAzAsync = false;

            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsTrue(_vm.CanStartMoveTelescope);               // Can slew sync Alt-Az.

            _vm.Capabilities.CanSlewAltAz = false;
            _prVm.Invoke("UpdateCanStartMove");
            Assert.IsFalse(_vm.CanStartMoveTelescope);               // Can't slew either sync or async Alt-Az.
        }
Пример #7
0
        public void CanDoMeridianFlip()
        {
            TelescopeParameters   parms  = new TelescopeParameters();
            DevHubTelescopeStatus status = DevHubTelescopeStatus.GetEmptyStatus();
            TelescopeCapabilities caps   = TelescopeCapabilities.GetFullCapabilities();

            _vm.Status       = null;
            _vm.Parameters   = parms;
            _vm.Capabilities = caps;

            bool result = (bool)_prVm.Invoke("CanDoMeridianFlip");

            Assert.IsFalse(result);               // No device status

            _vm.Status     = status;
            _vm.Parameters = null;

            result = (bool)_prVm.Invoke("CanDoMeridianFlip");
            Assert.IsFalse(result);               // No device parameters

            _vm.Parameters   = parms;
            _vm.Capabilities = null;

            result = (bool)_prVm.Invoke("CanDoMeridianFlip");
            Assert.IsFalse(result);               // No capabilities

            _vm.Capabilities = caps;

            result = (bool)_prVm.Invoke("CanDoMeridianFlip");
            Assert.IsFalse(result);               // Not connected

            _vm.Status.Connected = true;

            _vm.Capabilities.CanSetPierSide = false;
            _vm.Capabilities.CanSlewAsync   = false;

            result = (bool)_prVm.Invoke("CanDoMeridianFlip");
            Assert.IsFalse(result);               // Not capable

            _vm.Capabilities.CanSetPierSide = true;
            _vm.Capabilities.CanSlewAsync   = true;

            _vm.Status.Tracking = false;
            _vm.Status.AtPark   = true;

            result = (bool)_prVm.Invoke("CanDoMeridianFlip");
            Assert.IsFalse(result);               // Scope is parked

            _vm.Status.Tracking = true;
            _vm.Status.AtPark   = false;

            _vm.Status.Slewing = true;

            result = (bool)_prVm.Invoke("CanDoMeridianFlip");
            Assert.IsFalse(result);               // Already slewing

            _vm.Status.Slewing           = false;
            _vm.Parameters.AlignmentMode = AlignmentModes.algAltAz;

            result = (bool)_prVm.Invoke("CanDoMeridianFlip");
            Assert.IsFalse(result);               // Not a German Equatorial mount

            _vm.Parameters.AlignmentMode = AlignmentModes.algGermanPolar;
            _vm.Status.IsCounterWeightUp = false;

            result = (bool)_prVm.Invoke("CanDoMeridianFlip");
            Assert.IsFalse(result);               // Not CW Up

            _vm.Status.IsCounterWeightUp = true;
            _vm.Status.SideOfPier        = PierSide.pierEast;

            result = (bool)_prVm.Invoke("CanDoMeridianFlip");
            Assert.IsFalse(result);               // Not on the west side of the pier

            _vm.Status.SideOfPier = PierSide.pierWest;

            result = (bool)_prVm.Invoke("CanDoMeridianFlip");
            Assert.IsTrue(result);               // Ready to flip
        }