Package edu.wpi.first.wpilibj
Class BuiltInAccelerometer
java.lang.Object
edu.wpi.first.wpilibj.BuiltInAccelerometer
- All Implemented Interfaces:
Sendable
,AutoCloseable
public class BuiltInAccelerometer extends Object implements Sendable, AutoCloseable
Built-in accelerometer.
This class allows access to the roboRIO's internal accelerometer.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BuiltInAccelerometer.Range
Accelerometer range. -
Constructor Summary
Constructors Constructor Description BuiltInAccelerometer()
Constructor.BuiltInAccelerometer(BuiltInAccelerometer.Range range)
Constructor. -
Method Summary
Modifier and Type Method Description void
close()
double
getX()
The acceleration in the X axis.double
getY()
The acceleration in the Y axis.double
getZ()
The acceleration in the Z axis.void
initSendable(SendableBuilder builder)
Initializes thisSendable
object.void
setRange(BuiltInAccelerometer.Range range)
Set the measuring range of the accelerometer.
-
Constructor Details
-
BuiltInAccelerometer
Constructor.- Parameters:
range
- The range the accelerometer will measure
-
BuiltInAccelerometer
public BuiltInAccelerometer()Constructor. The accelerometer will measure +/-8 g-forces
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
-
setRange
Set the measuring range of the accelerometer.- Parameters:
range
- The maximum acceleration, positive or negative, that the accelerometer will measure.
-
getX
The acceleration in the X axis.- Returns:
- The acceleration of the roboRIO along the X axis in g-forces
-
getY
The acceleration in the Y axis.- Returns:
- The acceleration of the roboRIO along the Y axis in g-forces
-
getZ
The acceleration in the Z axis.- Returns:
- The acceleration of the roboRIO along the Z axis in g-forces
-
initSendable
Description copied from interface:Sendable
Initializes thisSendable
object.- Specified by:
initSendable
in interfaceSendable
- Parameters:
builder
- sendable builder
-