Exemplo n.º 1
0
 private void btnAbort_Click(object sender, EventArgs e)
 {
     if (UIisActive && telescope.Slewing)
     {
         telescope.AbortSlew();
         telescope.MoveAxis(TelescopeAxes.axisPrimary, 0);
         telescope.MoveAxis(TelescopeAxes.axisSecondary, 0);
     }
 }
Exemplo n.º 2
0
 public void MoveAxis(TelescopeAxes axis, double rate)
 {
     if (TelescopeInfo.Connected)
     {
         Telescope.MoveAxis(axis, rate);
     }
 }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        private void revisaTest()
        {
            Console.WriteLine("revisaTest");
            if (this.runningTest == null)
            {
                return;
            }
            if (!this.runningTest.IsRunning)
            {
                lblMountCheck.Text = this.runningTest.status();
                Console.WriteLine(this.runningTest.status());
                this.runningTest = null;
                return;
            }

            double alt, az;

            alt = telescopio.Altitude;
            az  = telescopio.Azimuth;
            Console.WriteLine("alt=" + alt + "\t az=" + az);
            Console.WriteLine(this.runningTest.status());
            lblMountCheck.Text = this.runningTest.status();
            switch (runningTest.Id)
            {
            case 1:

                if ((alt > 29) && (alt < 31) && (az > 178) && (alt < 181))
                {
                    runningTest.finish(1);
                }
                if (runningTest.isTimeOut())
                {
                    runningTest.finish(-1);
                }
                break;

            case 2:

                if (az > 190)
                {
                    telescopio.MoveAxis(TelescopeAxes.axisSecondary, 0);
                    runningTest.finish(1);
                }
                if (runningTest.isTimeOut())
                {
                    telescopio.MoveAxis(TelescopeAxes.axisSecondary, 0);
                    runningTest.finish(-1);
                }
                break;

            case 3:
                if (this.stat.DecHome)
                {
                    runningTest.Counter++;
                }

                if (az < 170)
                {
                    telescopio.MoveAxis(TelescopeAxes.axisSecondary, 0);
                    if (runningTest.Counter > 0)
                    {
                        runningTest.finish(1);
                    }
                    else
                    {
                        runningTest.finish(-1);
                    }
                }
                if (runningTest.isTimeOut())
                {
                    telescopio.MoveAxis(TelescopeAxes.axisSecondary, 0);
                    runningTest.finish(-1);
                }
                break;

            case 4:
                if ((!telescopio.Slewing) && (az > 260) && (alt > 80))
                {
                    runningTest.finish(1);
                }
                if (runningTest.isTimeOut())
                {
                    telescopio.AbortSlew();
                    runningTest.finish(-1);
                }
                break;

            case 5:
                if (stat.RaLimitEast)
                {
                    telescopio.MoveAxis(TelescopeAxes.axisPrimary, 0);
                    runningTest.finish(1);
                }
                if (runningTest.isTimeOut())
                {
                    telescopio.MoveAxis(TelescopeAxes.axisPrimary, 0);
                    runningTest.finish(-1);
                }
                break;

            case 6:
                if (stat.RaHome)
                {
                    runningTest.Counter++;
                }
                if ((!telescopio.Slewing) &&
                    (az < 100) &&
                    (alt > 80) &&
                    (runningTest.Counter > 0)
                    )
                {
                    runningTest.finish(1);
                }
                if (runningTest.isTimeOut())
                {
                    telescopio.AbortSlew();
                    runningTest.finish(-1);
                }
                break;

            case 7:
                if (stat.RaLimitWest)
                {
                    telescopio.MoveAxis(TelescopeAxes.axisPrimary, 0);
                    runningTest.finish(1);
                }
                if (runningTest.isTimeOut())
                {
                    telescopio.MoveAxis(TelescopeAxes.axisPrimary, 0);
                    runningTest.finish(-1);
                }
                break;
            }
        }
Exemplo n.º 5
0
 public void MoveAxis_TertiaryAxis_ThrowsException()
 {
     telescope.MoveAxis(TelescopeAxes.axisTertiary, 0);
 }