BuiltInAccelerometer

class wpilib.BuiltInAccelerometer(range=2)[source]

Bases: wpilib.LiveWindowSendable

Built-in accelerometer device

This class allows access to the RoboRIO’s internal accelerometer.

Constructor.

Parameters:range (Accelerometer.Range) – The range the accelerometer will measure. Defaults to +/-8g if unspecified.
class Range

Bases: builtins.object

k16G = 3
k2G = 0
k4G = 1
k8G = 2
BuiltInAccelerometer.getX()[source]
Returns:The acceleration of the RoboRIO along the X axis in g-forces
Return type:float
BuiltInAccelerometer.getY()[source]
Returns:The acceleration of the RoboRIO along the Y axis in g-forces
Return type:float
BuiltInAccelerometer.getZ()[source]
Returns:The acceleration of the RoboRIO along the Z axis in g-forces
Return type:float
BuiltInAccelerometer.setRange(range)[source]

Set the measuring range of the accelerometer.

Parameters:range (BuiltInAccelerometer.Range) – The maximum acceleration, positive or negative, that the accelerometer will measure.