AnalogAccelerometer¶
-
class
wpilib.
AnalogAccelerometer
(channel)[source]¶ Bases:
wpilib.LiveWindowSendable
Analog Accelerometer
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.
Constructor. 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
-
class
PIDSourceType
¶ Bases:
object
A description for the type of output value to provide to a
PIDController
-
kDisplacement
= 0¶
-
kRate
= 1¶
-
-
AnalogAccelerometer.
getAcceleration
()[source]¶ Return the acceleration in Gs.
The acceleration is returned units of Gs.
Returns: The current acceleration of the sensor in Gs. Return type: float
-
AnalogAccelerometer.
pidGet
()[source]¶ Get the Acceleration for the PID Source parent.
Returns: The current acceleration in Gs. Return type: float
-
AnalogAccelerometer.
setPIDSourceType
(pidSource)[source]¶ Set which parameter you are using as a process control variable.
Parameters: pidSource ( PIDSource.PIDSourceType
) – An enum to select the parameter.
-
AnalogAccelerometer.
setSensitivity
(sensitivity)[source]¶ 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.
-
class