WPILib 2012
WPILibRoboticsLibraryforFRC
|
#include <Servo.h>
Public Member Functions | |
Servo (UINT32 channel) | |
Servo (UINT8 moduleNumber, UINT32 channel) | |
void | Set (float value) |
void | SetOffline () |
float | Get () |
void | SetAngle (float angle) |
float | GetAngle () |
Static Public Member Functions | |
static float | GetMaxAngle () |
static float | GetMinAngle () |
Standard hobby style servo.
The range parameters default to the appropriate values for the Hitec HS-322HD servo provided in the FIRST Kit of Parts in 2008.
Servo::Servo | ( | UINT32 | channel | ) | [explicit] |
Constructor that assumes the default digital module.
channel | The PWM channel on the digital module to which the servo is attached. |
Servo::Servo | ( | UINT8 | moduleNumber, |
UINT32 | channel | ||
) |
Constructor that specifies the digital module.
moduleNumber | The digital module (1 or 2). |
channel | The PWM channel on the digital module to which the servo is attached (1..10). |
float Servo::Get | ( | ) |
Get the servo position.
Servo values range from 0.0 to 1.0 corresponding to the range of full left to full right.
float Servo::GetAngle | ( | void | ) |
Get the servo angle.
Assume that the servo angle is linear with respect to the PWM value (big assumption, need to test).
void Servo::Set | ( | float | value | ) |
Set the servo position.
Servo values range from 0.0 to 1.0 corresponding to the range of full left to full right.
value | Position from 0.0 to 1.0. |
void Servo::SetAngle | ( | float | degrees | ) |
Set the servo angle.
Assume that the servo angle is linear with respect to the PWM value (big assumption, need to test).
Servo angles that are out of the supported range of the servo simply "saturate" in that direction In other words, if the servo has a range of (X degrees to Y degrees) than angles of less than X result in an angle of X being set and angles of more than Y degrees result in an angle of Y being set.
degrees | The angle in degrees to set the servo. |
void Servo::SetOffline | ( | ) |
Set the servo to offline.
Set the servo raw value to 0 (undriven)