WPILib 2012
WPILibRoboticsLibraryforFRC
Public Member Functions
SendableGyro Class Reference

#include <SendableGyro.h>

Inheritance diagram for SendableGyro:
Gyro SmartDashboardData NetworkTableChangeListener SensorBase PIDSource ErrorBase

List of all members.

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

Detailed Description

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.


Constructor & Destructor Documentation

SendableGyro::SendableGyro ( UINT8  moduleNumber,
UINT32  channel 
)

Gyro constructor given a moduleNumber and a channel.

Parameters:
moduleNumberThe analog module the gyro is connected to.
channelThe analog channel the gyro is connected to.
SendableGyro::SendableGyro ( UINT32  channel)

Gyro constructor with only a channel.

Use the default analog module slot.

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

Parameters:
channelThe AnalogChannel object that the gyro is connected to.

Member Function Documentation

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.

Returns:
the current heading of the robot in degrees. This heading is based on integration of the returned rate from the gyro.

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.

Returns:
the period (in 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.

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

Parameters:
periodthe new time between updates

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