SPIAccelerometerSim
- class wpilib.simulation.SPIAccelerometerSim(index: int)
Bases:
pybind11_object
Construct a new simulation object.
- Parameters:
index – the HAL index of the accelerometer
- getActive() bool
Check whether the accelerometer is active.
- Returns:
true if active
- getRange() int
Check the range of this accelerometer.
- Returns:
the accelerometer range
- getX() float
Measure the X axis value.
- Returns:
the X axis measurement
- getY() float
Measure the Y axis value.
- Returns:
the Y axis measurement
- getZ() float
Measure the Z axis value.
- Returns:
the Z axis measurement
- registerActiveCallback(callback: Callable[[str, hal._wpiHal.Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run when this accelerometer activates.
- Parameters:
callback – the callback
initialNotify – whether to run the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- registerRangeCallback(callback: Callable[[str, hal._wpiHal.Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run whenever the range changes.
- Parameters:
callback – the callback
initialNotify – whether to call the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- registerXCallback(callback: Callable[[str, hal._wpiHal.Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run whenever the X axis value changes.
- Parameters:
callback – the callback
initialNotify – whether to call the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- registerYCallback(callback: Callable[[str, hal._wpiHal.Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run whenever the Y axis value changes.
- Parameters:
callback – the callback
initialNotify – whether to call the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- registerZCallback(callback: Callable[[str, hal._wpiHal.Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run whenever the Z axis value changes.
- Parameters:
callback – the callback
initialNotify – whether to call the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- resetData() None
Reset all simulation data of this object.
- setActive(active: bool) None
Define whether this accelerometer is active.
- Parameters:
active – the new state
- setRange(range: int) None
Change the range of this accelerometer.
- Parameters:
range – the new accelerometer range
- setX(x: float) None
Change the X axis value of the accelerometer.
- Parameters:
x – the new reading of the X axis
- setY(y: float) None
Change the Y axis value of the accelerometer.
- Parameters:
y – the new reading of the Y axis
- setZ(z: float) None
Change the Z axis value of the accelerometer.
- Parameters:
z – the new reading of the Z axis