Now you can download a copy of these docs so you can use them offline! Download now

Accelerometer Class Reference

#include <Accelerometer.h>

Inheritance diagram for Accelerometer:
Collaboration diagram for Accelerometer:

List of all members.

Public Member Functions

 Accelerometer (UINT32 channel)
 Accelerometer (UINT8 moduleNumber, UINT32 channel)
 Accelerometer (AnalogChannel *channel)
virtual ~Accelerometer ()
float GetAcceleration ()
void SetSensitivity (float sensitivity)
void SetZero (float zero)
double PIDGet ()

Detailed Description

Handle operation of the accelerometer. The accelerometer reads acceleration directly through the sensor. Many sensors have multiple axis and can be treated as multiple devices. Each is calibrated by finding the center value over a period of time.

Definition at line 20 of file Accelerometer.h.


Constructor & Destructor Documentation

Accelerometer::Accelerometer ( UINT32  channel  )  [explicit]

Create a new instance of an accelerometer.

The accelerometer is assumed to be in the first analog module in the given analog channel. The constructor allocates desired analog channel.

Definition at line 26 of file Accelerometer.cpp.

Accelerometer::Accelerometer ( UINT8  moduleNumber,
UINT32  channel 
)

Create new instance of accelerometer.

Make a new instance of the accelerometer given a module and channel. The constructor allocates the desired analog channel from the specified module

Parameters:
moduleNumber The analog module (1 or 2).
channel The analog channel (1..8)

Definition at line 42 of file Accelerometer.cpp.

Accelerometer::Accelerometer ( AnalogChannel channel  )  [explicit]

Create a new instance of Accelerometer from an existing AnalogChannel. Make a new instance of accelerometer given an AnalogChannel. This is particularly useful if the port is going to be read as an analog channel as well as through the Accelerometer class.

Definition at line 55 of file Accelerometer.cpp.

Accelerometer::~Accelerometer (  )  [virtual]

Delete the analog components used for the accelerometer.

Definition at line 72 of file Accelerometer.cpp.


Member Function Documentation

float Accelerometer::GetAcceleration (  ) 

Return the acceleration in Gs.

The acceleration is returned units of Gs.

Returns:
The current acceleration of the sensor in Gs.

Definition at line 87 of file Accelerometer.cpp.

double Accelerometer::PIDGet (  )  [virtual]

Get the Acceleration for the PID Source parent.

Returns:
The current acceleration in Gs.

Implements PIDSource.

Definition at line 122 of file Accelerometer.cpp.

void Accelerometer::SetSensitivity ( float  sensitivity  ) 

Set the accelerometer sensitivity.

This sets the sensitivity of the accelerometer used for calculating the acceleration. The sensitivity varys by accelerometer model. There are constants defined for various models.

Parameters:
sensitivity The sensitivity of accelerometer in Volts per G.

Definition at line 100 of file Accelerometer.cpp.

void Accelerometer::SetZero ( float  zero  ) 

Set the voltage that corresponds to 0 G.

The zero G voltage varys by accelerometer model. There are constants defined for various models.

Parameters:
zero The zero G voltage.

Definition at line 112 of file Accelerometer.cpp.


The documentation for this class was generated from the following files:

Generated on Thu Jan 12 2012 22:35:26 for WPILibC++ by doxygen 1.7.1