WPILibC++  2021.3.1
frc::BuiltInAccelerometer Class Reference

Built-in accelerometer. More...

#include <frc/BuiltInAccelerometer.h>

Inheritance diagram for frc::BuiltInAccelerometer:
frc::ErrorBase frc::Accelerometer frc::Sendable frc::SendableHelper< BuiltInAccelerometer >

Public Member Functions

 BuiltInAccelerometer (Range range=kRange_8G)
 Constructor. More...
 
 BuiltInAccelerometer (BuiltInAccelerometer &&)=default
 
BuiltInAccelerometeroperator= (BuiltInAccelerometer &&)=default
 
void SetRange (Range range) final
 Set the measuring range of the accelerometer. More...
 
double GetX () override
 
double GetY () override
 
double GetZ () override
 
void InitSendable (SendableBuilder &builder) override
 Initializes this Sendable object. More...
 
- Public Member Functions inherited from frc::ErrorBase
 ErrorBase (const ErrorBase &)=default
 
ErrorBaseoperator= (const ErrorBase &)=default
 
 ErrorBase (ErrorBase &&)=default
 
ErrorBaseoperator= (ErrorBase &&)=default
 
virtual ErrorGetError ()
 Retrieve the current error. More...
 
virtual const ErrorGetError () const
 Retrieve the current error. More...
 
virtual void ClearError () const
 Clear the current error information associated with this sensor.
 
virtual void SetErrnoError (const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int 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 wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
 Set the current error information associated from the nivision Imaq API. More...
 
virtual void SetError (Error::Code code, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void SetErrorRange (Error::Code code, int32_t minRange, int32_t maxRange, int32_t requestedValue, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void SetWPIError (const wpi::Twine &errorMessage, Error::Code code, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void CloneError (const ErrorBase &rhs) const
 
virtual bool StatusIsFatal () const
 Check if the current error code represents a fatal error. More...
 
void ClearGlobalErrors ()
 Clear global errors.
 
- Public Member Functions inherited from frc::Accelerometer
 Accelerometer (Accelerometer &&)=default
 
Accelerometeroperator= (Accelerometer &&)=default
 
- Public Member Functions inherited from frc::SendableHelper< BuiltInAccelerometer >
 SendableHelper (const SendableHelper &rhs)=default
 
 SendableHelper (SendableHelper &&rhs)
 
SendableHelperoperator= (const SendableHelper &rhs)=default
 
SendableHelperoperator= (SendableHelper &&rhs)
 
std::string GetName () const
 Gets the name of this Sendable object. More...
 
void SetName (const wpi::Twine &name)
 Sets the name of this Sendable object. More...
 
void SetName (const wpi::Twine &subsystem, const wpi::Twine &name)
 Sets both the subsystem name and device name of this Sendable object. More...
 
std::string GetSubsystem () const
 Gets the subsystem name of this Sendable object. More...
 
void SetSubsystem (const wpi::Twine &subsystem)
 Sets the subsystem name of this Sendable object. More...
 

Additional Inherited Members

- Public Types inherited from frc::Accelerometer
enum  Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2, kRange_16G = 3 }
 
- Static Public Member Functions inherited from frc::ErrorBase
static void SetGlobalError (Error::Code code, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber)
 
static void SetGlobalWPIError (const wpi::Twine &errorMessage, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber)
 
static Error GetGlobalError ()
 Retrieve the last global error.
 
static std::vector< ErrorGetGlobalErrors ()
 Retrieve all global errors.
 
- Protected Member Functions inherited from frc::SendableHelper< BuiltInAccelerometer >
void SetName (const wpi::Twine &moduleType, int channel)
 Sets the name of the sensor with a channel number. More...
 
void SetName (const wpi::Twine &moduleType, int moduleNumber, int channel)
 Sets the name of the sensor with a module and channel number. More...
 
void AddChild (std::shared_ptr< Sendable > child)
 Add a child component. More...
 
void AddChild (void *child)
 Add a child component. More...
 
- Protected Attributes inherited from frc::ErrorBase
Error m_error
 

Detailed Description

Built-in accelerometer.

This class allows access to the roboRIO's internal accelerometer.

Constructor & Destructor Documentation

◆ BuiltInAccelerometer()

frc::BuiltInAccelerometer::BuiltInAccelerometer ( Range  range = kRange_8G)
explicit

Constructor.

Parameters
rangeThe range the accelerometer will measure

Member Function Documentation

◆ GetX()

double frc::BuiltInAccelerometer::GetX ( )
overridevirtual
Returns
The acceleration of the roboRIO along the X axis in g-forces

Implements frc::Accelerometer.

◆ GetY()

double frc::BuiltInAccelerometer::GetY ( )
overridevirtual
Returns
The acceleration of the roboRIO along the Y axis in g-forces

Implements frc::Accelerometer.

◆ GetZ()

double frc::BuiltInAccelerometer::GetZ ( )
overridevirtual
Returns
The acceleration of the roboRIO along the Z axis in g-forces

Implements frc::Accelerometer.

◆ InitSendable()

void frc::BuiltInAccelerometer::InitSendable ( SendableBuilder builder)
overridevirtual

Initializes this Sendable object.

Parameters
buildersendable builder

Implements frc::Sendable.

◆ SetRange()

void frc::BuiltInAccelerometer::SetRange ( Range  range)
finalvirtual

Set the measuring range of the accelerometer.

Parameters
rangeThe maximum acceleration, positive or negative, that the accelerometer will measure. Not all accelerometers support all ranges.

Implements frc::Accelerometer.


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