Package edu.wpi.first.wpilibj.simulation
Class BuiltInAccelerometerSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.BuiltInAccelerometerSim
Class to control a simulated built-in accelerometer.
-
Constructor Summary
ConstructorDescriptionConstructs for the first built-in accelerometer.Constructs from a BuiltInAccelerometer object. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check whether the accelerometer is active.int
getRange()
Check the range of this accelerometer.double
getX()
Measure the X axis value.double
getY()
Measure the Y axis value.double
getZ()
Measure the Z axis value.registerActiveCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run when this accelerometer activates.registerRangeCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the range changes.registerXCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the X axis value changes.registerYCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the Y axis value changes.registerZCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the Z axis value changes.void
Reset all simulation data of this object.void
setActive
(boolean active) Define whether this accelerometer is active.void
setRange
(int range) Change the range of this accelerometer.void
setX
(double x) Change the X axis value of the accelerometer.void
setY
(double y) Change the Y axis value of the accelerometer.void
setZ
(double z) Change the Z axis value of the accelerometer.
-
Constructor Details
-
BuiltInAccelerometerSim
public BuiltInAccelerometerSim()Constructs for the first built-in accelerometer. -
BuiltInAccelerometerSim
Constructs from a BuiltInAccelerometer object.- Parameters:
accel
- BuiltInAccelerometer to simulate
-
-
Method Details
-
registerActiveCallback
Register a callback to be run when this accelerometer activates.- Parameters:
callback
- the callbackinitialNotify
- whether to run the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getActive
Check whether the accelerometer is active.- Returns:
- true if active
-
setActive
Define whether this accelerometer is active.- Parameters:
active
- the new state
-
registerRangeCallback
Register a callback to be run whenever the range changes.- Parameters:
callback
- the callbackinitialNotify
- whether to call the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getRange
Check the range of this accelerometer.- Returns:
- the accelerometer range
-
setRange
Change the range of this accelerometer.- Parameters:
range
- the new accelerometer range
-
registerXCallback
Register a callback to be run whenever the X axis value changes.- Parameters:
callback
- the callbackinitialNotify
- whether to call the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getX
Measure the X axis value.- Returns:
- the X axis measurement
-
setX
Change the X axis value of the accelerometer.- Parameters:
x
- the new reading of the X axis
-
registerYCallback
Register a callback to be run whenever the Y axis value changes.- Parameters:
callback
- the callbackinitialNotify
- whether to call the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getY
Measure the Y axis value.- Returns:
- the Y axis measurement
-
setY
Change the Y axis value of the accelerometer.- Parameters:
y
- the new reading of the Y axis
-
registerZCallback
Register a callback to be run whenever the Z axis value changes.- Parameters:
callback
- the callbackinitialNotify
- whether to call the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getZ
Measure the Z axis value.- Returns:
- the Z axis measurement
-
setZ
Change the Z axis value of the accelerometer.- Parameters:
z
- the new reading of the Z axis
-
resetData
Reset all simulation data of this object.
-