Repeatable Low Power Movement - Controlling Servos with 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 (PWM signal, 1.0ms-2.0ms pulse width)
Constructing a Servo object
![Constructing a Servo object](https://media.screensteps.com/image_assets/assets/006/596/345/original/50ec6e88-ab31-414a-8d38-d37a80a4038c.png)
A servo object is constructed by passing either a channel (default module) or module and channel.
Setting Servo Values
![Setting Servo Values](https://media.screensteps.com/image_assets/assets/006/596/346/original/a5efb991-ab31-40fc-8393-3dfcc30e0ea5.png)
There are two methods of setting servo values in WPILib:
- Scaled Value - Sets the servo position using a scaled 0 to 1.0 value. 0 corresponds to one extreme of the servo and 1.0 corresponds to the other
- Angle - Set the servo position by specifying the angle, in degrees. This method will work for servos with the same range as the Hitec HS-322HD servo (0 to 170 degrees). Any values passed to this method outside the specified range will be coerced to the boundary.