예제 #1
0
        static private void RunTracking()
        {
            HemisphereOption hemisphere = HemisphereOption.Northern;

            Console.WriteLine("Press any key to start tracking");
            Console.ReadKey(true);
            _controller.MCStartRATrack(DriveRates.driveSidereal, hemisphere, AxisDirection.Forward);
            int ct = 0;

            while (ct < 3)
            {
                Thread.Sleep(2000);
                _controller.TalkWithAxis(0, 'f', null);
                ct++;
            }
            System.Diagnostics.Debug.WriteLine("\n=== Tracking Stop ====");
            _controller.MCAxisStop(AxisId.Axis1_RA);
            ct = 0;
            while (ct < 3)
            {
                Thread.Sleep(2000);
                _controller.TalkWithAxis(0, 'f', null);
                ct++;
            }
        }
예제 #2
0
        private string EQ_SendGCode(AxisId axisId, HemisphereOption hemisphere, AxisMode mode, AxisDirection direction, AxisSpeed speed)
        {
            System.Diagnostics.Debug.WriteLine(string.Format("EQ_SendGCode({0}, {1}, {2}, {3}, {4})", axisId, hemisphere, mode, direction, speed));
            byte ch;

            ch = 0;

            // Set Direction bit	(Bit 0)
            if (direction == AxisDirection.Reverse)
            {
                ch |= 0x01;
            }

            // Set Hemisphere bit	(Bit 1)
            if (hemisphere == HemisphereOption.Southern)
            {
                ch |= 0x02;
            }

            // 0 = high speed GOTO mode
            // 1 = low speed SLEW mode
            // 2 = low speed GOTO mode
            // 3 = high speed SLEW mode

            // Set Mode and speed bits
            if (mode == AxisMode.Goto)
            {
                //goto
                if (speed == AxisSpeed.LowSpeed)
                {
                    // Low speed goto = 2
                    ch |= 0x20;
                }
                else
                {
                    //high speed goto = 0
                }
            }
            else
            {
                // slew
                if (speed == AxisSpeed.HighSpeed)
                {
                    // High speed slew= 3
                    ch |= 0x30;
                }
                else
                {
                    // low speed slew= 1
                    ch |= 0x10;
                }
            }


            // Send 'G' Command, with parameter
            return(GetEQSendCommandCommand(axisId, 'G', ch, 2));
        }
예제 #3
0
        protected string MCSetMotionMode(AxisId axis, HemisphereOption hemisphere, AxisMode mode, AxisDirection direction, AxisSpeed speed)
        {
            byte ch;

            ch = 0;

            // Set Direction bit	(Bit 0)
            if (direction == AxisDirection.Reverse)
            {
                ch |= 0x01;
            }

            // Set Hemisphere bit	(Bit 1)
            if (hemisphere == HemisphereOption.Southern)
            {
                ch |= 0x02;
            }

            // 0 = high speed GOTO mode
            // 1 = low speed SLEW mode
            // 2 = low speed GOTO mode
            // 3 = high speed SLEW mode

            // Set Mode and speed bits
            if (mode == AxisMode.Goto)
            {
                //goto
                if (speed == AxisSpeed.LowSpeed)
                {
                    // Low speed goto = 2
                    ch |= 0x20;
                }
                else
                {
                    //high speed goto = 0
                }
            }
            else
            {
                // slew
                if (speed == AxisSpeed.HighSpeed)
                {
                    // High speed slew= 3
                    ch |= 0x30;
                }
                else
                {
                    // low speed slew= 1
                    ch |= 0x10;
                }
            }


            string szCmd = LongTo2BitHEX(ch);

            return(GetTalkWithAxisCommand(axis, 'G', szCmd));
        }
예제 #4
0
        static private void RunGOTO()
        {
            _controller.MCSetAxisPosition(AxisId.Axis1_RA, 0.0);

            double slowPosition = 0.03; // Radians (will result in lowspeed goto)
            double fastPosition = 0.1;  // Radians (will result in highspeed goto)

            HemisphereOption hemisphere = HemisphereOption.Northern;

            Console.WriteLine("Press any key to start GOTO Slow");
            Console.ReadKey(true);
            System.Diagnostics.Debug.WriteLine("\n=== GOTO Slow ====");
            _controller.MCAxisSlewTo(AxisId.Axis1_RA, slowPosition, hemisphere);
            // Wait for stop
            _controller.TalkWithAxis(0, 'f', null);
            AxisState status = _controller.MCGetAxisState(AxisId.Axis1_RA);
            // System.Diagnostics.Debug.WriteLine($"Fwd-{status.SlewingForward}\tSpd-{status.HighSpeed}\tStpd-{status.FullStop}\tSlwg-{status.Slewing}\tSlwgT-{status.SlewingTo}\tInit-{!status.NotInitialized}");
            double ppos = double.MaxValue;
            double pos  = _controller.MCGetAxisPosition(AxisId.Axis1_RA);

            while (pos != ppos)
            {
                ppos = pos;
                Thread.Sleep(2000);
                _controller.TalkWithAxis(0, 'f', null);
                status = _controller.MCGetAxisState(AxisId.Axis1_RA);
                // System.Diagnostics.Debug.WriteLine($"Fwd-{status.SlewingForward}\tSpd-{status.HighSpeed}\tStpd-{status.FullStop}\tSlwg-{status.Slewing}\tSlwgT-{status.SlewingTo}\tInit-{!status.NotInitialized}");
                pos = _controller.MCGetAxisPosition(AxisId.Axis1_RA);
            }

            Console.WriteLine("Press any key to start reverse GOTO Slow");
            Console.ReadKey(true);
            System.Diagnostics.Debug.WriteLine("\n=== GOTO Slow (reversed) ====");
            _controller.MCAxisSlewTo(AxisId.Axis1_RA, 0.0, hemisphere);
            _controller.TalkWithAxis(0, 'f', null);
            status = _controller.MCGetAxisState(AxisId.Axis1_RA);
            // System.Diagnostics.Debug.WriteLine($"Fwd-{status.SlewingForward}\tSpd-{status.HighSpeed}\tStpd-{status.FullStop}\tSlwg-{status.Slewing}\tSlwgT-{status.SlewingTo}\tInit-{!status.NotInitialized}");
            ppos = double.MaxValue;
            pos  = _controller.MCGetAxisPosition(AxisId.Axis1_RA);
            while (pos != ppos)
            {
                ppos = pos;
                Thread.Sleep(2000);
                _controller.TalkWithAxis(0, 'f', null);
                status = _controller.MCGetAxisState(AxisId.Axis1_RA);
                // System.Diagnostics.Debug.WriteLine($"Fwd-{status.SlewingForward}\tSpd-{status.HighSpeed}\tStpd-{status.FullStop}\tSlwg-{status.Slewing}\tSlwgT-{status.SlewingTo}\tInit-{!status.NotInitialized}");
                pos = _controller.MCGetAxisPosition(AxisId.Axis1_RA);
            }


            Console.WriteLine("Press any key to start GOTO Fast");
            Console.ReadKey(true);
            System.Diagnostics.Debug.WriteLine("\n=== GOTO Fast ====");
            _controller.MCAxisSlewTo(AxisId.Axis1_RA, fastPosition, hemisphere);
            // Wait for stop
            _controller.TalkWithAxis(0, 'f', null);
            status = _controller.MCGetAxisState(AxisId.Axis1_RA);
            // System.Diagnostics.Debug.WriteLine($"Fwd-{status.SlewingForward}\tSpd-{status.HighSpeed}\tStpd-{status.FullStop}\tSlwg-{status.Slewing}\tSlwgT-{status.SlewingTo}\tInit-{!status.NotInitialized}");
            ppos = double.MaxValue;
            pos  = _controller.MCGetAxisPosition(AxisId.Axis1_RA);
            while (pos != ppos)
            {
                ppos = pos;
                Thread.Sleep(2000);
                _controller.TalkWithAxis(0, 'f', null);
                status = _controller.MCGetAxisState(AxisId.Axis1_RA);
                // System.Diagnostics.Debug.WriteLine($"Fwd-{status.SlewingForward}\tSpd-{status.HighSpeed}\tStpd-{status.FullStop}\tSlwg-{status.Slewing}\tSlwgT-{status.SlewingTo}\tInit-{!status.NotInitialized}");
                pos = _controller.MCGetAxisPosition(AxisId.Axis1_RA);
            }

            Console.WriteLine("Press any key to start reverse GOTO Fast");
            Console.ReadKey(true);
            System.Diagnostics.Debug.WriteLine("\n=== GOTO Fast (reversed) ====");
            _controller.MCAxisSlewTo(AxisId.Axis1_RA, 0.0, hemisphere);
            _controller.TalkWithAxis(0, 'f', null);
            status = _controller.MCGetAxisState(AxisId.Axis1_RA);
            // System.Diagnostics.Debug.WriteLine($"Fwd-{status.SlewingForward}\tSpd-{status.HighSpeed}\tStpd-{status.FullStop}\tSlwg-{status.Slewing}\tSlwgT-{status.SlewingTo}\tInit-{!status.NotInitialized}");
            ppos = double.MaxValue;
            pos  = _controller.MCGetAxisPosition(AxisId.Axis1_RA);
            while (pos != ppos)
            {
                ppos = pos;
                Thread.Sleep(2000);
                _controller.TalkWithAxis(0, 'f', null);
                status = _controller.MCGetAxisState(AxisId.Axis1_RA);
                // System.Diagnostics.Debug.WriteLine($"Fwd-{status.SlewingForward}\tSpd-{status.HighSpeed}\tStpd-{status.FullStop}\tSlwg-{status.Slewing}\tSlwgT-{status.SlewingTo}\tInit-{!status.NotInitialized}");
                pos = _controller.MCGetAxisPosition(AxisId.Axis1_RA);
            }
        }
예제 #5
0
        static private void RunSlew()
        {
            _controller.MCSetAxisPosition(AxisId.Axis1_RA, 0.0);

            double slowSpeed = 0.007; // Radians (will result in lowspeed goto)
            double fastSpeed = 0.02;  // Radians (will result in highspeed goto)

            HemisphereOption hemisphere = HemisphereOption.Northern;

            Console.WriteLine("Press any key to start SLEW Slow");
            Console.ReadKey(true);
            System.Diagnostics.Debug.WriteLine("\n=== SLEW Slow ====");
            _controller.MCAxisSlew(AxisId.Axis1_RA, slowSpeed, hemisphere);
            int ct = 0;

            while (ct < 3)
            {
                Thread.Sleep(2000);
                _controller.TalkWithAxis(0, 'f', null);
                ct++;
            }
            System.Diagnostics.Debug.WriteLine("\n=== SLEW Stop ====");
            _controller.MCAxisSlew(AxisId.Axis1_RA, 0.0, hemisphere);
            ct = 0;
            while (ct < 3)
            {
                Thread.Sleep(2000);
                _controller.TalkWithAxis(0, 'f', null);
                ct++;
            }

            Console.WriteLine("Press any key to start reverse SLEW Slow");
            Console.ReadKey(true);
            System.Diagnostics.Debug.WriteLine("\n=== SLEW Slow (reversed) ====");
            _controller.MCAxisSlew(AxisId.Axis1_RA, -slowSpeed, hemisphere);
            ct = 0;
            while (ct < 3)
            {
                Thread.Sleep(2000);
                _controller.TalkWithAxis(0, 'f', null);
                ct++;
            }
            System.Diagnostics.Debug.WriteLine("\n=== SLEW Stop ====");
            _controller.MCAxisSlew(AxisId.Axis1_RA, 0.0, hemisphere);
            ct = 0;
            while (ct < 3)
            {
                Thread.Sleep(2000);
                _controller.TalkWithAxis(0, 'f', null);
                ct++;
            }


            Console.WriteLine("Press any key to start SLEW Fast");
            Console.ReadKey(true);
            System.Diagnostics.Debug.WriteLine("\n=== SLEW Fast ====");
            _controller.MCAxisSlew(AxisId.Axis1_RA, fastSpeed, hemisphere);
            ct = 0;
            while (ct < 3)
            {
                Thread.Sleep(2000);
                _controller.TalkWithAxis(0, 'f', null);
                ct++;
            }
            _controller.MCAxisSlew(AxisId.Axis1_RA, 0.0, hemisphere);
            System.Diagnostics.Debug.WriteLine("\n=== SLEW Stop ====");
            _controller.MCAxisSlew(AxisId.Axis1_RA, 0.0, hemisphere);
            ct = 0;
            while (ct < 3)
            {
                Thread.Sleep(2000);
                _controller.TalkWithAxis(0, 'f', null);
                ct++;
            }

            Console.WriteLine("Press any key to start reverse SLEW Fast");
            Console.ReadKey(true);
            System.Diagnostics.Debug.WriteLine("\n=== SLEW Fast (reversed) ====");
            _controller.MCAxisSlew(AxisId.Axis1_RA, -fastSpeed, hemisphere);
            ct = 0;
            while (ct < 3)
            {
                Thread.Sleep(2000);
                _controller.TalkWithAxis(0, 'f', null);
                ct++;
            }
            System.Diagnostics.Debug.WriteLine("\n=== SLEW Stop ====");
            _controller.MCAxisSlew(AxisId.Axis1_RA, 0.0, hemisphere);
            ct = 0;
            while (ct < 3)
            {
                Thread.Sleep(2000);
                _controller.TalkWithAxis(0, 'f', null);
                ct++;
            }
        }