Movimiento de baja potencia repetible - Controlador de servos con WPILib

Servo motors are a type of motor which integrates positional feedback into the motor in order to allow a single motor to perform repeatable, controllable movement, taking position as the input signal. WPILib provides the capability to control servos which match the common hobby input specification (Pulse Width Modulation (PWM) signal, 0.6 ms - 2.4 ms pulse width)

Construcción de un objeto servo

Servo exampleServo = new Servo(1);
frc::Servo exampleServo {1};
exampleServo = wpilib.Servo(1)

Un objeto servo se construye pasando un canal.

Establecer valores de servo

exampleServo.set(.5);
exampleServo.setAngle(75);
exampleServo.Set(.5);
exampleServo.SetAngle(75);
exampleServo.set(.5)
exampleServo.setAngle(75)

Hay dos métodos para establecer valores de servo en WPILib:

  • Valor escalado - establece la posición del servo usando un valor escalado de 0 a 1.0. 0 corresponde a uno extremo del servo y 1.0 corresponde al otro.

  • Angle - Set the servo position by specifying the angle, in degrees from 0 to 180. This method will work for servos with the same range as the Hitec HS-322HD servo . Any values passed to this method outside the specified range will be coerced to the boundary.