WPILibC++ 2024.3.2
|
Handle operation of an analog accelerometer. More...
#include <frc/AnalogAccelerometer.h>
Public Member Functions | |
AnalogAccelerometer (int channel) | |
Create a new instance of an accelerometer. More... | |
AnalogAccelerometer (AnalogInput *channel) | |
Create a new instance of Accelerometer from an existing AnalogInput. More... | |
AnalogAccelerometer (std::shared_ptr< AnalogInput > channel) | |
Create a new instance of Accelerometer from an existing AnalogInput. More... | |
~AnalogAccelerometer () override=default | |
AnalogAccelerometer (AnalogAccelerometer &&)=default | |
AnalogAccelerometer & | operator= (AnalogAccelerometer &&)=default |
double | GetAcceleration () const |
Return the acceleration in Gs. More... | |
void | SetSensitivity (double sensitivity) |
Set the accelerometer sensitivity. More... | |
void | SetZero (double zero) |
Set the voltage that corresponds to 0 G. More... | |
void | InitSendable (wpi::SendableBuilder &builder) override |
Initializes this Sendable object. More... | |
Public Member Functions inherited from wpi::Sendable | |
virtual | ~Sendable ()=default |
virtual void | InitSendable (SendableBuilder &builder)=0 |
Initializes this Sendable object. More... | |
Public Member Functions inherited from wpi::SendableHelper< AnalogAccelerometer > | |
SendableHelper (const SendableHelper &rhs)=default | |
SendableHelper (SendableHelper &&rhs) | |
SendableHelper & | operator= (const SendableHelper &rhs)=default |
SendableHelper & | operator= (SendableHelper &&rhs) |
Additional Inherited Members | |
Protected Member Functions inherited from wpi::SendableHelper< AnalogAccelerometer > | |
SendableHelper ()=default | |
~SendableHelper () | |
Handle operation of an analog 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.
|
explicit |
Create a new instance of an accelerometer.
The constructor allocates desired analog input.
channel | The channel number for the analog input the accelerometer is connected to |
|
explicit |
Create a new instance of Accelerometer from an existing AnalogInput.
Make a new instance of accelerometer given an AnalogInput. This is particularly useful if the port is going to be read as an analog channel as well as through the Accelerometer class.
channel | The existing AnalogInput object for the analog input the accelerometer is connected to |
|
explicit |
Create a new instance of Accelerometer from an existing AnalogInput.
Make a new instance of accelerometer given an AnalogInput. This is particularly useful if the port is going to be read as an analog channel as well as through the Accelerometer class.
channel | The existing AnalogInput object for the analog input the accelerometer is connected to |
|
overridedefault |
|
default |
double frc::AnalogAccelerometer::GetAcceleration | ( | ) | const |
Return the acceleration in Gs.
The acceleration is returned units of Gs.
|
overridevirtual |
|
default |
void frc::AnalogAccelerometer::SetSensitivity | ( | double | sensitivity | ) |
Set the accelerometer sensitivity.
This sets the sensitivity of the accelerometer used for calculating the acceleration. The sensitivity varies by accelerometer model. There are constants defined for various models.
sensitivity | The sensitivity of accelerometer in Volts per G. |
void frc::AnalogAccelerometer::SetZero | ( | double | zero | ) |
Set the voltage that corresponds to 0 G.
The zero G voltage varies by accelerometer model. There are constants defined for various models.
zero | The zero G voltage. |