示例#1
0
        /// <summary>
        /// Initializes a SSC32 object
        /// </summary>
        /// <param name="servo_channels">List of the servo channels to use</param>
        private void Initialize(params int[] servo_channels)
        {
            if (servo_channels.Length < Servo.MIN_CHANNEL || servo_channels.Length > Servo.MAX_CHANNEL)
            {
                throw new ArgumentException("Argument count out of range !");
            }

            // Create as many servos as necessary
            servos = new Servo[servo_channels.Length];
            for (int i = 0; i < servo_channels.Length; i++)
            {
                servos[i] = new Servo((byte)servo_channels[i]);
            }

            // Initialize the flags that indicate if the dummy analog read has been done
            firstAnalogReadDone = new bool[Enum.GetNames(typeof(SSC32Inputs)).Length];
            for (int i = 0; i < firstAnalogReadDone.Length; i++)
            {
                firstAnalogReadDone[i] = false;
            }

            MotionTime = 100;
        }
示例#2
0
 public short GetServo_PW(Servo servoIn)
 {
     return(servoIn.PulseWidth);
 }
示例#3
0
 public double GetServo_Angle(Servo servoIn)
 {
     return(((double)servoIn.PulseWidth - (double)Servo.MIN_PULSE_WIDTH) * 180 / (double)(Servo.MAX_PULSE_WIDTH - (double)Servo.MIN_PULSE_WIDTH));
 }
示例#4
0
 public float GetServo_F(Servo servoIn)
 {
     return(((float)servoIn.PulseWidth - (float)Servo.MIN_PULSE_WIDTH) / ((float)Servo.MAX_PULSE_WIDTH - (float)Servo.MIN_PULSE_WIDTH));
 }