BuiltInAccelerometerSim

class wpilib.simulation.BuiltInAccelerometerSim(*args, **kwargs)

Bases: pybind11_object

Class to control a simulated built-in accelerometer.

Overloaded function.

  1. __init__(self: wpilib.simulation._simulation.BuiltInAccelerometerSim) -> None

Constructs for the first built-in accelerometer.

  1. __init__(self: wpilib.simulation._simulation.BuiltInAccelerometerSim, accel: wpilib._wpilib.BuiltInAccelerometer) -> None

Constructs from a BuiltInAccelerometer object.

Parameters:

accel – BuiltInAccelerometer to simulate

getActive() bool

Check whether the accelerometer is active.

Returns:

true if active

getRange() hal._wpiHal.AccelerometerRange

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_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_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_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_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_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: hal._wpiHal.AccelerometerRange) 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