private void moveEastButton_Click(object sender, EventArgs e) { try { driver.MoveAxis(DeviceInterface.TelescopeAxes.axisPrimary, Convert.ToDouble(RateNumericUpDown.Value)); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnN_Click(object sender, EventArgs e) { if (IsConnected) { try { driver.MoveAxis(DeviceInterface.TelescopeAxes.axisSecondary, 5.0); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
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); }
private void btnRight_MouseDown(object sender, MouseEventArgs e) { driver.MoveAxis(DeviceInterface.TelescopeAxes.axisPrimary, Convert.ToDouble(tbNavSpeed.Text)); }
public void Test_RatesAndMoveAxis() { // Unsimulated movement causing no M commands, but testing IRates device.Connected = true; Assert.IsTrue(device.Connected); IAxisRates ra_rates = device.AxisRates(TelescopeAxes.axisPrimary); IAxisRates dec_rates = device.AxisRates(TelescopeAxes.axisSecondary); Assert.AreEqual(4, ra_rates.Count); Assert.AreEqual(5.0 / 3600.0, ra_rates[1].Minimum); // 1-based Assert.AreEqual(5.0 / 60.0, ra_rates[2].Minimum); Assert.AreEqual(20.0 / 60.0, ra_rates[3].Minimum); Assert.AreEqual(5.0, ra_rates[4].Minimum); Assert.AreEqual(4, dec_rates.Count); Assert.AreEqual(5.0 / 3600.0, dec_rates[1].Minimum); Assert.AreEqual(5.0 / 60.0, dec_rates[2].Minimum); Assert.AreEqual(20.0 / 60.0, dec_rates[3].Minimum); Assert.AreEqual(5.0, dec_rates[4].Minimum); device.MoveAxis(TelescopeAxes.axisPrimary, 0.0); device.MoveAxis(TelescopeAxes.axisSecondary, 0.0); Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.MoveAxis(TelescopeAxes.axisTertiary, 0.0)); Assert.IsTrue(device.Tracking); Assert.IsTrue(ra_rates.Count == dec_rates.Count); string[] rates = new string[] { "SLEW_GUIDE", "SLEW_CENTER", "SLEW_FIND", "SLEW_MAX" }; for (int i = 1; i < ra_rates.Count + 1; i++) { IRate ra_rate = ra_rates[i]; Assert.IsTrue(ra_rate.Minimum == ra_rate.Maximum); Assert.IsTrue(0 < ra_rate.Minimum); IRate dec_rate = dec_rates[i]; Assert.IsTrue(dec_rate.Minimum == dec_rate.Maximum); Assert.IsTrue(0 < dec_rate.Minimum); Assert.IsTrue(device.Tracking); Assert.AreEqual(rates[3], device.CommandString("getCurrentSlewRate", true)); Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.MoveAxis(TelescopeAxes.axisPrimary, ra_rate.Minimum + 1 / 3600.0)); Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.MoveAxis(TelescopeAxes.axisSecondary, dec_rate.Minimum + 1 / 3600.0)); device.MoveAxis(TelescopeAxes.axisPrimary, ra_rate.Minimum); Assert.IsTrue(device.Slewing); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0)); for (int j = 1; j < ra_rates.Count + 1; j++) { if (i != j) { Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.MoveAxis(TelescopeAxes.axisPrimary, ra_rates[((i - 1 + 1) % ra_rates.Count) + 1].Minimum)); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.MoveAxis(TelescopeAxes.axisSecondary, ra_rates[((i - 1 + 1) % ra_rates.Count) + 1].Minimum)); } } device.MoveAxis(TelescopeAxes.axisSecondary, dec_rate.Minimum); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0)); for (int j = 1; j < ra_rates.Count + 1; j++) { if (i != j) { Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.MoveAxis(TelescopeAxes.axisPrimary, ra_rates[((i - 1 + 1) % ra_rates.Count) + 1].Minimum)); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.MoveAxis(TelescopeAxes.axisSecondary, ra_rates[((i - 1 + 1) % ra_rates.Count) + 1].Minimum)); } } Assert.IsTrue(device.Slewing); Assert.AreEqual(rates[i - 1], device.CommandString("getCurrentSlewRate", true)); device.AbortSlew(); Assert.IsTrue(device.Tracking); device.MoveAxis(TelescopeAxes.axisPrimary, -ra_rate.Minimum); Assert.IsTrue(device.Slewing); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0)); device.MoveAxis(TelescopeAxes.axisSecondary, -dec_rate.Minimum); Assert.IsTrue(device.Slewing); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0)); Assert.AreEqual(rates[i - 1], device.CommandString("getCurrentSlewRate", true)); device.AbortSlew(); Assert.IsTrue(device.Tracking); Assert.AreEqual(rates[3], device.CommandString("getCurrentSlewRate", true)); device.MoveAxis(TelescopeAxes.axisPrimary, +ra_rate.Minimum); Assert.IsTrue(device.Slewing); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0)); device.MoveAxis(TelescopeAxes.axisSecondary, -dec_rate.Minimum); Assert.IsTrue(device.Slewing); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0)); Assert.AreEqual(rates[i - 1], device.CommandString("getCurrentSlewRate", true)); device.AbortSlew(); Assert.IsTrue(device.Tracking); Assert.AreEqual(rates[3], device.CommandString("getCurrentSlewRate", true)); device.MoveAxis(TelescopeAxes.axisPrimary, -ra_rate.Minimum); Assert.IsTrue(device.Slewing); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0)); device.MoveAxis(TelescopeAxes.axisSecondary, +dec_rate.Minimum); Assert.IsTrue(device.Slewing); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0)); Assert.AreEqual(rates[i - 1], device.CommandString("getCurrentSlewRate", true)); device.AbortSlew(); Assert.IsTrue(device.Tracking); Assert.AreEqual(rates[3], device.CommandString("getCurrentSlewRate", true)); device.MoveAxis(TelescopeAxes.axisPrimary, +ra_rate.Minimum); Assert.IsTrue(device.Slewing); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0)); device.MoveAxis(TelescopeAxes.axisSecondary, +dec_rate.Minimum); Assert.IsTrue(device.Slewing); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0)); Assert.AreEqual(rates[i - 1], device.CommandString("getCurrentSlewRate", true)); device.MoveAxis(TelescopeAxes.axisPrimary, 0); Assert.IsTrue(device.Slewing); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0)); device.MoveAxis(TelescopeAxes.axisSecondary, 0); Assert.IsTrue(device.Tracking); Assert.AreEqual(rates[3], device.CommandString("getCurrentSlewRate", true)); device.MoveAxis(TelescopeAxes.axisPrimary, +ra_rate.Minimum); Assert.IsTrue(device.Slewing); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0)); device.MoveAxis(TelescopeAxes.axisSecondary, +dec_rate.Minimum); Assert.IsTrue(device.Slewing); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0)); Assert.AreEqual(rates[i - 1], device.CommandString("getCurrentSlewRate", true)); device.MoveAxis(TelescopeAxes.axisSecondary, 0); Assert.IsTrue(device.Slewing); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.SyncToCoordinates(0, 0)); device.MoveAxis(TelescopeAxes.axisPrimary, 0); Assert.IsTrue(device.Tracking); Assert.AreEqual(rates[3], device.CommandString("getCurrentSlewRate", true)); } // One single rate for both axes device.MoveAxis(TelescopeAxes.axisPrimary, ra_rates[1].Minimum); Assert.IsTrue(device.Slewing); Assert.ThrowsException <ASCOM.InvalidOperationException>(() => device.MoveAxis(TelescopeAxes.axisSecondary, dec_rates[2].Minimum)); Assert.IsTrue(device.Slewing); device.AbortSlew(); Assert.IsTrue(device.Tracking); }