WPILib 2012
WPILibRoboticsLibraryforFRC
Public Member Functions | Static Public Member Functions
Servo Class Reference

#include <Servo.h>

Inheritance diagram for Servo:
SafePWM PWM MotorSafety SensorBase ErrorBase

List of all members.

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 ()

Detailed Description

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.


Constructor & Destructor Documentation

Servo::Servo ( UINT32  channel) [explicit]

Constructor that assumes the default digital module.

Parameters:
channelThe PWM channel on the digital module to which the servo is attached.
Servo::Servo ( UINT8  moduleNumber,
UINT32  channel 
)

Constructor that specifies the digital module.

Parameters:
moduleNumberThe digital module (1 or 2).
channelThe PWM channel on the digital module to which the servo is attached (1..10).

Member Function Documentation

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.

Returns:
Position from 0.0 to 1.0.
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).

Returns:
The angle in degrees to which the servo is set.
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.

Parameters:
valuePosition 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.

Parameters:
degreesThe angle in degrees to set the servo.
void Servo::SetOffline ( )

Set the servo to offline.

Set the servo raw value to 0 (undriven)


The documentation for this class was generated from the following files:
 All Classes Functions Variables