WPILibC++ 2023.4.3-108-ge5452e3
frc::sim::BuiltInAccelerometerSim Class Reference

Class to control a simulated built-in accelerometer. More...

#include <frc/simulation/BuiltInAccelerometerSim.h>

Public Member Functions

 BuiltInAccelerometerSim ()
 Constructs for the first built-in accelerometer. More...
 
 BuiltInAccelerometerSim (const BuiltInAccelerometer &accel)
 Constructs from a BuiltInAccelerometer object. More...
 
std::unique_ptr< CallbackStoreRegisterActiveCallback (NotifyCallback callback, bool initialNotify)
 Register a callback to be run when this accelerometer activates. More...
 
bool GetActive () const
 Check whether the accelerometer is active. More...
 
void SetActive (bool active)
 Define whether this accelerometer is active. More...
 
std::unique_ptr< CallbackStoreRegisterRangeCallback (NotifyCallback callback, bool initialNotify)
 Register a callback to be run whenever the range changes. More...
 
HAL_AccelerometerRange GetRange () const
 Check the range of this accelerometer. More...
 
void SetRange (HAL_AccelerometerRange range)
 Change the range of this accelerometer. More...
 
std::unique_ptr< CallbackStoreRegisterXCallback (NotifyCallback callback, bool initialNotify)
 Register a callback to be run whenever the X axis value changes. More...
 
double GetX () const
 Measure the X axis value. More...
 
void SetX (double x)
 Change the X axis value of the accelerometer. More...
 
std::unique_ptr< CallbackStoreRegisterYCallback (NotifyCallback callback, bool initialNotify)
 Register a callback to be run whenever the Y axis value changes. More...
 
double GetY () const
 Measure the Y axis value. More...
 
void SetY (double y)
 Change the Y axis value of the accelerometer. More...
 
std::unique_ptr< CallbackStoreRegisterZCallback (NotifyCallback callback, bool initialNotify)
 Register a callback to be run whenever the Z axis value changes. More...
 
double GetZ () const
 Measure the Z axis value. More...
 
void SetZ (double z)
 Change the Z axis value of the accelerometer. More...
 
void ResetData ()
 Reset all simulation data of this object. More...
 

Detailed Description

Class to control a simulated built-in accelerometer.

Constructor & Destructor Documentation

◆ BuiltInAccelerometerSim() [1/2]

frc::sim::BuiltInAccelerometerSim::BuiltInAccelerometerSim ( )

Constructs for the first built-in accelerometer.

◆ BuiltInAccelerometerSim() [2/2]

frc::sim::BuiltInAccelerometerSim::BuiltInAccelerometerSim ( const BuiltInAccelerometer accel)
explicit

Constructs from a BuiltInAccelerometer object.

Parameters
accelBuiltInAccelerometer to simulate

Member Function Documentation

◆ GetActive()

bool frc::sim::BuiltInAccelerometerSim::GetActive ( ) const

Check whether the accelerometer is active.

Returns
true if active

◆ GetRange()

HAL_AccelerometerRange frc::sim::BuiltInAccelerometerSim::GetRange ( ) const

Check the range of this accelerometer.

Returns
the accelerometer range

◆ GetX()

double frc::sim::BuiltInAccelerometerSim::GetX ( ) const

Measure the X axis value.

Returns
the X axis measurement

◆ GetY()

double frc::sim::BuiltInAccelerometerSim::GetY ( ) const

Measure the Y axis value.

Returns
the Y axis measurement

◆ GetZ()

double frc::sim::BuiltInAccelerometerSim::GetZ ( ) const

Measure the Z axis value.

Returns
the Z axis measurement

◆ RegisterActiveCallback()

std::unique_ptr< CallbackStore > frc::sim::BuiltInAccelerometerSim::RegisterActiveCallback ( NotifyCallback  callback,
bool  initialNotify 
)

Register a callback to be run when this accelerometer activates.

Parameters
callbackthe callback
initialNotifywhether to run the callback with the initial state
Returns
the CallbackStore object associated with this callback

◆ RegisterRangeCallback()

std::unique_ptr< CallbackStore > frc::sim::BuiltInAccelerometerSim::RegisterRangeCallback ( NotifyCallback  callback,
bool  initialNotify 
)

Register a callback to be run whenever the range changes.

Parameters
callbackthe callback
initialNotifywhether to call the callback with the initial state
Returns
the CallbackStore object associated with this callback

◆ RegisterXCallback()

std::unique_ptr< CallbackStore > frc::sim::BuiltInAccelerometerSim::RegisterXCallback ( NotifyCallback  callback,
bool  initialNotify 
)

Register a callback to be run whenever the X axis value changes.

Parameters
callbackthe callback
initialNotifywhether to call the callback with the initial state
Returns
the CallbackStore object associated with this callback

◆ RegisterYCallback()

std::unique_ptr< CallbackStore > frc::sim::BuiltInAccelerometerSim::RegisterYCallback ( NotifyCallback  callback,
bool  initialNotify 
)

Register a callback to be run whenever the Y axis value changes.

Parameters
callbackthe callback
initialNotifywhether to call the callback with the initial state
Returns
the CallbackStore object associated with this callback

◆ RegisterZCallback()

std::unique_ptr< CallbackStore > frc::sim::BuiltInAccelerometerSim::RegisterZCallback ( NotifyCallback  callback,
bool  initialNotify 
)

Register a callback to be run whenever the Z axis value changes.

Parameters
callbackthe callback
initialNotifywhether to call the callback with the initial state
Returns
the CallbackStore object associated with this callback

◆ ResetData()

void frc::sim::BuiltInAccelerometerSim::ResetData ( )

Reset all simulation data of this object.

◆ SetActive()

void frc::sim::BuiltInAccelerometerSim::SetActive ( bool  active)

Define whether this accelerometer is active.

Parameters
activethe new state

◆ SetRange()

void frc::sim::BuiltInAccelerometerSim::SetRange ( HAL_AccelerometerRange  range)

Change the range of this accelerometer.

Parameters
rangethe new accelerometer range

◆ SetX()

void frc::sim::BuiltInAccelerometerSim::SetX ( double  x)

Change the X axis value of the accelerometer.

Parameters
xthe new reading of the X axis

◆ SetY()

void frc::sim::BuiltInAccelerometerSim::SetY ( double  y)

Change the Y axis value of the accelerometer.

Parameters
ythe new reading of the Y axis

◆ SetZ()

void frc::sim::BuiltInAccelerometerSim::SetZ ( double  z)

Change the Z axis value of the accelerometer.

Parameters
zthe new reading of the Z axis

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