WPILib 2012
WPILibRoboticsLibraryforFRC
|
#include <SendableGyro.h>
Public Member Functions | |
SendableGyro (UINT8 moduleNumber, UINT32 channel) | |
SendableGyro (UINT32 channel) | |
SendableGyro (AnalogChannel *channel) | |
virtual float | GetAngle () |
virtual void | Reset () |
void | SetUpdatePeriod (double period) |
double | GetUpdatePeriod () |
void | ResetToAngle (double angle) |
virtual std::string | GetType () |
virtual NetworkTable * | GetTable () |
The SendableGyro class behaves exactly the same as a Gyro except that it also implements SmartDashboardData so that it can be sent over to the SmartDashboard.
SendableGyro::SendableGyro | ( | UINT8 | moduleNumber, |
UINT32 | channel | ||
) |
Gyro constructor given a moduleNumber and a channel.
moduleNumber | The analog module the gyro is connected to. |
channel | The analog channel the gyro is connected to. |
SendableGyro::SendableGyro | ( | UINT32 | channel | ) |
Gyro constructor with only a channel.
Use the default analog module slot.
channel | The analog channel the gyro is connected to. |
SendableGyro::SendableGyro | ( | AnalogChannel * | channel | ) |
Gyro constructor with a precreated analog channel object. Use this constructor when the analog channel needs to be shared. There is no reference counting when an AnalogChannel is passed to the gyro.
channel | The AnalogChannel object that the gyro is connected to. |
float SendableGyro::GetAngle | ( | void | ) | [virtual] |
Return the actual angle in degrees that the robot is currently facing.
The angle is based on the current accumulator value corrected by the oversampling rate, the gyro type and the A/D calibration values. The angle is continuous, that is can go beyond 360 degrees. This make algorithms that wouldn't want to see a discontinuity in the gyro output as it sweeps past 0 on the second time around.
Reimplemented from Gyro.
double SendableGyro::GetUpdatePeriod | ( | ) |
Returns the period (in seconds) between updates to the SmartDashboard. This value is independent of whether or not this SendableGyro is connected to the SmartDashboard. The default value is 0.2 seconds.
void SendableGyro::Reset | ( | ) | [virtual] |
Reset the gyro. Resets the gyro to a heading of zero. This can be used if there is significant drift in the gyro and it needs to be recalibrated after it has been running.
Reimplemented from Gyro.
void SendableGyro::ResetToAngle | ( | double | angle | ) |
Reset the gyro. Resets the gyro to the given heading. This can be used if there is significant drift in the gyro and it needs to be recalibrated after it has been running.
angle | the angle the gyro should believe it is pointing |
void SendableGyro::SetUpdatePeriod | ( | double | period | ) |
Sets the time (in seconds) between updates to the SmartDashboard. The default is 0.2 seconds.
period | the new time between updates |