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:

Public Member Functions

 Accelerometer (uint32_t channel)
 
 Accelerometer (uint8_t moduleNumber, uint32_t channel)
 
 Accelerometer (AnalogChannel *channel)
 
virtual ~Accelerometer ()
 
float GetAcceleration ()
 
void SetSensitivity (float sensitivity)
 
void SetZero (float zero)
 
double PIDGet ()
 
void UpdateTable ()
 
void StartLiveWindowMode ()
 
void StopLiveWindowMode ()
 
std::string GetSmartDashboardType ()
 
void InitTable (ITable *subTable)
 
ITableGetTable ()
 
- Public Member Functions inherited from SensorBase
 SensorBase ()
 
virtual ~SensorBase ()
 
- Public Member Functions inherited from ErrorBase
virtual ErrorGetError ()
 Retrieve the current error. Get the current error information associated with this sensor.
 
virtual const ErrorGetError () const
 
virtual void SetErrnoError (const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const
 Set error information associated with a C library call that set an error to the "errno" global variable. More...
 
virtual void SetImaqError (int success, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const
 Set the current error information associated from the nivision Imaq API. More...
 
virtual void SetError (Error::Code code, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void SetWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void CloneError (ErrorBase *rhs) const
 
virtual void ClearError () const
 Clear the current error information associated with this sensor.
 
virtual bool StatusIsFatal () const
 Check if the current error code represents a fatal error. More...
 

Additional Inherited Members

- Public Types inherited from PIDSource
enum  PIDSourceParameter { kDistance, kRate, kAngle }
 
- Static Public Member Functions inherited from SensorBase
static void DeleteSingletons ()
 
static uint32_t GetDefaultAnalogModule ()
 
static uint32_t GetDefaultDigitalModule ()
 
static uint32_t GetDefaultSolenoidModule ()
 
static bool CheckAnalogModule (uint8_t moduleNumber)
 
static bool CheckDigitalModule (uint8_t moduleNumber)
 
static bool CheckPWMModule (uint8_t moduleNumber)
 
static bool CheckRelayModule (uint8_t moduleNumber)
 
static bool CheckSolenoidModule (uint8_t moduleNumber)
 
static bool CheckDigitalChannel (uint32_t channel)
 
static bool CheckRelayChannel (uint32_t channel)
 
static bool CheckPWMChannel (uint32_t channel)
 
static bool CheckAnalogChannel (uint32_t channel)
 
static bool CheckSolenoidChannel (uint32_t channel)
 
- Static Public Member Functions inherited from ErrorBase
static void SetGlobalError (Error::Code code, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber)
 
static void SetGlobalWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber)
 
static ErrorGetGlobalError ()
 
- Static Public Attributes inherited from SensorBase
static const uint32_t kSystemClockTicksPerMicrosecond = 40
 
static const uint32_t kDigitalChannels = 14
 
static const uint32_t kAnalogChannels = 8
 
static const uint32_t kAnalogModules = 2
 
static const uint32_t kDigitalModules = 2
 
static const uint32_t kSolenoidChannels = 8
 
static const uint32_t kSolenoidModules = 2
 
static const uint32_t kPwmChannels = 10
 
static const uint32_t kRelayChannels = 8
 
static const uint32_t kChassisSlots = 8
 
- Protected Member Functions inherited from SensorBase
void AddToSingletonList ()
 
- Protected Member Functions inherited from ErrorBase
 ErrorBase ()
 Initialize the instance status to 0 for now.
 
- Protected Attributes inherited from ErrorBase
Error m_error
 
- Static Protected Attributes inherited from ErrorBase
static SEM_ID _globalErrorMutex = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE)
 
static Error _globalError
 

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 21 of file Accelerometer.h.

Constructor & Destructor Documentation

Accelerometer::Accelerometer ( uint32_t  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 31 of file Accelerometer.cpp.

Accelerometer::Accelerometer ( uint8_t  moduleNumber,
uint32_t  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
moduleNumberThe analog module (1 or 2).
channelThe analog channel (1..8)

Definition at line 47 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 60 of file Accelerometer.cpp.

Accelerometer::~Accelerometer ( )
virtual

Delete the analog components used for the accelerometer.

Definition at line 77 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 92 of file Accelerometer.cpp.

std::string Accelerometer::GetSmartDashboardType ( )
virtual
Returns
the string representation of the named data type that will be used by the smart dashboard for this sendable

Implements Sendable.

Definition at line 144 of file Accelerometer.cpp.

ITable * Accelerometer::GetTable ( )
virtual
Returns
the table that is currently associated with the sendable

Implements Sendable.

Definition at line 153 of file Accelerometer.cpp.

void Accelerometer::InitTable ( ITable subtable)
virtual

Initializes a table for this sendable object.

Parameters
subtableThe table to put the values in.

Implements Sendable.

Definition at line 148 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 127 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
sensitivityThe sensitivity of accelerometer in Volts per G.

Definition at line 105 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
zeroThe zero G voltage.

Definition at line 117 of file Accelerometer.cpp.

void Accelerometer::StartLiveWindowMode ( )
virtual

Start having this sendable object automatically respond to value changes reflect the value on the table.

Implements LiveWindowSendable.

Definition at line 138 of file Accelerometer.cpp.

void Accelerometer::StopLiveWindowMode ( )
virtual

Stop having this sendable object automatically respond to value changes.

Implements LiveWindowSendable.

Definition at line 141 of file Accelerometer.cpp.

void Accelerometer::UpdateTable ( )
virtual

Update the table for this sendable object with the latest values.

Implements LiveWindowSendable.

Definition at line 132 of file Accelerometer.cpp.


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

Generated on Sat Apr 26 2014 12:26:45 for WPILibC++ by doxygen 1.8.6