private void moveAxisToTarget(Telescope telescope, double targetRA, double targetDec, double speed, double maxRate, double tolerance, int maxSteps) { if (telescope.CanMoveAxis(TelescopeAxes.axisPrimary)) { int steps = 0; double rateRA; while (Math.Abs(targetRA - telescope.RightAscension) > tolerance && steps < maxSteps) { rateRA = -Math.Sign(targetRA - telescope.RightAscension) * Math.Min(Math.Abs((targetRA - telescope.RightAscension) * speed), maxRate); telescope.MoveAxis(TelescopeAxes.axisPrimary, rateRA); if (steps % 10 == 0) { Console.WriteLine("RA: " + (targetRA - telescope.RightAscension).ToString()); Console.WriteLine("\n"); } steps += 1; Thread.Sleep(10); } telescope.MoveAxis(TelescopeAxes.axisPrimary, 0); } if (telescope.CanMoveAxis(TelescopeAxes.axisSecondary)) { int steps = 0; double rateDec; while (Math.Abs(targetDec - telescope.Declination) > tolerance && steps < maxSteps) { rateDec = declinationDirection * Math.Sign(targetDec - telescope.Declination) * Math.Min(Math.Abs((targetDec - telescope.Declination) * speed), maxRate); telescope.MoveAxis(TelescopeAxes.axisSecondary, rateDec); if (steps % 10 == 0) { Console.WriteLine("DEC: " + (targetDec - telescope.Declination).ToString()); Console.WriteLine("\n"); } steps += 1; Thread.Sleep(10); } telescope.MoveAxis(TelescopeAxes.axisSecondary, 0); } }
public void CanMoveAxis_Primary() { Assert.IsTrue(telescope.CanMoveAxis(TelescopeAxes.axisPrimary)); }