Esempio n. 1
0
 /// <summary>
 /// Create a command for movement. Only the "data" field is sent to the MCU; the rest of the fields
 /// exist for internal tracking and estimations within the MCU manager.
 /// </summary>
 /// <param name="data"></param>
 /// <param name="CMDType"></param>
 /// <param name="azDir"></param>
 /// <param name="elDir"></param>
 /// <param name="AZSpeed"></param>
 /// <param name="ElSpeed"></param>
 public MCUCommand(ushort[] data, MCUCommandType CMDType, RadioTelescopeDirectionEnum azDir, RadioTelescopeDirectionEnum elDir, int AZSpeed, int ElSpeed)
 {
     CommandType        = CMDType;
     commandData        = data;
     AzimuthDirection   = azDir;
     ElevationDirection = elDir;
     AzimuthSpeed       = AZSpeed;
     ElevationSpeed     = ElSpeed;
 }
Esempio n. 2
0
        /// <summary>
        /// Method used to request to start jogging the Radio Telescope's elevation
        /// at a speed (in RPM), in either the clockwise or counter-clockwise direction.
        /// </summary>
        public MovementResult StartRadioTelescopeJog(double speed, RadioTelescopeDirectionEnum direction, RadioTelescopeAxisEnum axis)
        {
            MovementResult result = MovementResult.None;

            // Return if incoming priority is equal to or less than current movement
            if ((MovementPriority.Jog - 1) <= RadioTelescope.PLCDriver.CurrentMovementPriority)
            {
                return(MovementResult.AlreadyMoving);
            }

            // We only want to do this if it is safe to do so. Return false if not
            if (!AllSensorsSafe)
            {
                return(MovementResult.SensorsNotSafe);
            }

            // If a lower-priority movement was running, safely interrupt it.
            if (RadioTelescope.PLCDriver.InterruptMovementAndWaitUntilStopped())
            {
                return(MovementResult.StoppingCurrentMove);
            }

            // If the thread is locked (two moves coming in at the same time), return
            if (Monitor.TryEnter(MovementLock))
            {
                RadioTelescope.PLCDriver.CurrentMovementPriority = MovementPriority.Jog;

                double azSpeed = 0;
                double elSpeed = 0;

                if (axis == RadioTelescopeAxisEnum.AZIMUTH)
                {
                    azSpeed = speed;
                }
                else
                {
                    elSpeed = speed;
                }

                result = RadioTelescope.PLCDriver.StartBothAxesJog(azSpeed, direction, elSpeed, direction);

                Monitor.Exit(MovementLock);
            }
            else
            {
                result = MovementResult.AlreadyMoving;
            }

            return(result);
        }
Esempio n. 3
0
 public override MovementResult StartBothAxesJog(double azSpeed, RadioTelescopeDirectionEnum azDirection, double elSpeed, RadioTelescopeDirectionEnum elDirection)
 {
     return(driver.StartBothAxesJog(azSpeed, azDirection, elSpeed, elDirection));
 }
 public abstract MovementResult StartBothAxesJog(double azSpeed, RadioTelescopeDirectionEnum azDirection, double elSpeed, RadioTelescopeDirectionEnum elDirection);
Esempio n. 5
0
 /// <summary>
 /// speed in RPM
 /// </summary>
 /// <param name="azSpeed"></param>
 /// <param name="azDirection"></param>
 /// <param name="elSpeed"></param>
 /// <param name="elDirection"></param>
 /// <returns></returns>
 public override MovementResult StartBothAxesJog(double azSpeed, RadioTelescopeDirectionEnum azDirection, double elSpeed, RadioTelescopeDirectionEnum elDirection)
 {
     return(MCU.SendBothAxesJog(Math.Abs(azSpeed), azDirection, Math.Abs(elSpeed), elDirection));
 }
 public override MovementResult StartBothAxesJog(double azSpeed, RadioTelescopeDirectionEnum azDirection, double elSpeed, RadioTelescopeDirectionEnum elDirection)
 {
     throw new NotImplementedException();
 }