TRC Library for FRC (2011) 2011
TRC Library Code Project

TrcAccel Class Reference

#include <TrcAccel.h>

List of all members.

Public Member Functions

void Calibrate (__in UINT32 numCalPts, __in float calInterval void)
 TrcAccel (__in UINT32 slot, __in float period=0.02)
 ~TrcAccel (void)
double GetMetricAccelX (void)
double GetAccelX (void)
double GetMetricAccelY (void)
double GetAccelY (void)
double GetMetricAccelZ (void)
double GetAccelZ (void)
double GetMetricVelX (void)
double GetVelX (void)
double GetMetricVelY (void)
double GetVelY (void)
double GetMetricVelZ (void)
double GetVelZ (void)
double GetMetricDistX (void)
double GetDistX (void)
double GetMetricDistY (void)
double GetDistY (void)
double GetMetricDistZ (void)
double GetDistZ (void)
void Reset (void)
void SetEnabled (__in bool fEnabled)

Detailed Description

This class defines and implements the TrcAccel object. The TrcAccel object inherits the ADXL345_I2C accelerometer object from the WPI library. This object periodically sample the accelerometer value for the acceleration value. It also integrates the acceleration value to calculate the velocity and then integrates the velocity to calculate the distance value.

Definition at line 46 of file TrcAccel.h.


Constructor & Destructor Documentation

TrcAccel::TrcAccel ( __in UINT32  slot,
__in float  period = 0.02 
) [inline]

Constructor: Create an instance of the TrcAccel object. It initializes the object and starts the periodic timer.

Parameters:
slotSpecifies the slot of the digital module on which the I2C port is used for the accelerometer.
periodSpecifies the sampling time for doing calculations. This period is used to integrate acceleration into speed and distance travelled.

Definition at line 246 of file TrcAccel.h.

TrcAccel::~TrcAccel ( void  ) [inline]

Destructor: Destroy an instance of the TrcAccel object.

Definition at line 281 of file TrcAccel.h.


Member Function Documentation

void TrcAccel::Calibrate ( __in UINT32  numCalPts,
__in float calInterval  void 
) [inline]

This function is called to calibrate the zero G point and deadband. It assumes the accelerometer is sitting still at level ground during the calibration. It samples a number of points on all axes and averages them to be the zero G point for the axes. Note that the Z-axis is not really at zero G when it is still. Z-axis should be 1G at level ground. But for the purpose of measuring relative G's on all axes, we calibrate zero G for all axes. During calibration, we also determine the floor and ceiling noise level to form the deadband zone.

Parameters:
numCalPtsSpecifies the number of calibration points.
calIntervalSpecifies the calibration interval in seconds.

Definition at line 154 of file TrcAccel.h.

double TrcAccel::GetAccelX ( void  ) [inline]

This function returns the current acceleration value of the X axis in the unit of feet per second square.

Returns:
Returns the X acceleration value.

Definition at line 318 of file TrcAccel.h.

double TrcAccel::GetAccelY ( void  ) [inline]

This function returns the current acceleration value of the Y axis in the unit of feet per second square.

Returns:
Returns the Y acceleration value.

Definition at line 353 of file TrcAccel.h.

double TrcAccel::GetAccelZ ( void  ) [inline]

This function returns the current acceleration value of the Z axis in the unit of feet per second square.

Returns:
Returns the Z acceleration value.

Definition at line 388 of file TrcAccel.h.

double TrcAccel::GetDistX ( void  ) [inline]

This function returns the current distance value of the X axis in the unit of feet.

Returns:
Returns the X distance value.

Definition at line 528 of file TrcAccel.h.

double TrcAccel::GetDistY ( void  ) [inline]

This function returns the current distance value of the Y axis in the unit of feet.

Returns:
Returns the Y distance value.

Definition at line 563 of file TrcAccel.h.

double TrcAccel::GetDistZ ( void  ) [inline]

This function returns the current distance value of the Z axis in the unit of feet.

Returns:
Returns the Z distance value.

Definition at line 598 of file TrcAccel.h.

double TrcAccel::GetMetricAccelX ( void  ) [inline]

This function returns the current acceleration value of the X axis in the unit of meters per second square.

Returns:
Returns the X acceleration value.

Definition at line 301 of file TrcAccel.h.

double TrcAccel::GetMetricAccelY ( void  ) [inline]

This function returns the current acceleration value of the Y axis in the unit of meters per second square.

Returns:
Returns the Y acceleration value.

Definition at line 336 of file TrcAccel.h.

double TrcAccel::GetMetricAccelZ ( void  ) [inline]

This function returns the current acceleration value of the Z axis in the unit of meters per second square.

Returns:
Returns the Z acceleration value.

Definition at line 371 of file TrcAccel.h.

double TrcAccel::GetMetricDistX ( void  ) [inline]

This function returns the current distance value of the X axis in the unit of meters.

Returns:
Returns the X distance value.

Definition at line 511 of file TrcAccel.h.

double TrcAccel::GetMetricDistY ( void  ) [inline]

This function returns the current distance value of the Y axis in the unit of meters.

Returns:
Returns the Y distance value.

Definition at line 546 of file TrcAccel.h.

double TrcAccel::GetMetricDistZ ( void  ) [inline]

This function returns the current distance value of the Z axis in the unit of meters.

Returns:
Returns the Z distance value.

Definition at line 581 of file TrcAccel.h.

double TrcAccel::GetMetricVelX ( void  ) [inline]

This function returns the current velocity value of the X axis in the unit of meters per second.

Returns:
Returns the X velocity value.

Definition at line 406 of file TrcAccel.h.

double TrcAccel::GetMetricVelY ( void  ) [inline]

This function returns the current velocity value of the Y axis in the unit of meters per second.

Returns:
Returns the Y velocity value.

Definition at line 441 of file TrcAccel.h.

double TrcAccel::GetMetricVelZ ( void  ) [inline]

This function returns the current velocity value of the Z axis in the unit of meters per second.

Returns:
Returns the Z velocity value.

Definition at line 476 of file TrcAccel.h.

double TrcAccel::GetVelX ( void  ) [inline]

This function returns the current velocity value of the X axis in the unit of feet per second.

Returns:
Returns the X velocity value.

Definition at line 423 of file TrcAccel.h.

double TrcAccel::GetVelY ( void  ) [inline]

This function returns the current velocity value of the Y axis in the unit of feet per second.

Returns:
Returns the Y velocity value.

Definition at line 458 of file TrcAccel.h.

double TrcAccel::GetVelZ ( void  ) [inline]

This function returns the current velocity value of the Z axis in the unit of feet per second.

Returns:
Returns the Z velocity value.

Definition at line 493 of file TrcAccel.h.

void TrcAccel::Reset ( void  ) [inline]

This function resets the acceleration, velocity and distance values.

Definition at line 613 of file TrcAccel.h.

void TrcAccel::SetEnabled ( __in bool  fEnabled) [inline]

This function sets the accelerometer to enable or disable state.

Parameters:
fEnabledIf true, enables the accelerometer, false otherwise.

Definition at line 643 of file TrcAccel.h.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Defines