- class wpilib.AnalogAccelerometer(channel)¶
The accelerometer reads acceleration directly through the sensor. Many sensors have multiple axis and can be treated as multiple devices. Each is calibrated by finding the center value over a period of time.
Create a new instance of Accelerometer from either an existing AnalogChannel or from an analog channel port index.
Parameters: channel – port index or an already initialized AnalogInput
Return the acceleration in Gs.
The acceleration is returned units of Gs.
Returns: The current acceleration of the sensor in Gs. Return type: float
Get the Acceleration for the PID Source parent.
Returns: The current acceleration in Gs. Return type: float
Set the accelerometer sensitivity.
This sets the sensitivity of the accelerometer used for calculating the acceleration. The sensitivity varies by accelerometer model. There are constants defined for various models.
Parameters: sensitivity (float) – The sensitivity of accelerometer in Volts per G.
Set the voltage that corresponds to 0 G.
The zero G voltage varies by accelerometer model. There are constants defined for various models.
Parameters: zero (float) – The zero G voltage.