Package edu.wpi.first.wpilibj
Class BuiltInAccelerometer
- java.lang.Object
-
- edu.wpi.first.wpilibj.BuiltInAccelerometer
-
- All Implemented Interfaces:
Accelerometer,Sendable,AutoCloseable
public class BuiltInAccelerometer extends Object implements Accelerometer, Sendable, AutoCloseable
Built-in accelerometer.This class allows access to the roboRIO's internal accelerometer.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface edu.wpi.first.wpilibj.interfaces.Accelerometer
Accelerometer.Range
-
-
Constructor Summary
Constructors Constructor Description BuiltInAccelerometer()Constructor.BuiltInAccelerometer(Accelerometer.Range range)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()AccelerometerSimgetSimObject()doublegetX()The acceleration in the X axis.doublegetY()The acceleration in the Y axis.doublegetZ()The acceleration in the Z axis.voidinitSendable(SendableBuilder builder)Initializes thisSendableobject.voidsetRange(Accelerometer.Range range)Common interface for setting the measuring range of an accelerometer.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface edu.wpi.first.wpilibj.Sendable
addChild, getName, getSubsystem, setName, setName, setName, setName, setSubsystem
-
-
-
-
Constructor Detail
-
BuiltInAccelerometer
public BuiltInAccelerometer(Accelerometer.Range range)
Constructor.- Parameters:
range- The range the accelerometer will measure
-
BuiltInAccelerometer
public BuiltInAccelerometer()
Constructor. The accelerometer will measure +/-8 g-forces
-
-
Method Detail
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
setRange
public void setRange(Accelerometer.Range range)
Description copied from interface:AccelerometerCommon interface for setting the measuring range of an accelerometer.- Specified by:
setRangein interfaceAccelerometer- Parameters:
range- The maximum acceleration, positive or negative, that the accelerometer will measure. Not all accelerometers support all ranges.
-
getX
public double getX()
The acceleration in the X axis.- Specified by:
getXin interfaceAccelerometer- Returns:
- The acceleration of the roboRIO along the X axis in g-forces
-
getY
public double getY()
The acceleration in the Y axis.- Specified by:
getYin interfaceAccelerometer- Returns:
- The acceleration of the roboRIO along the Y axis in g-forces
-
getZ
public double getZ()
The acceleration in the Z axis.- Specified by:
getZin interfaceAccelerometer- Returns:
- The acceleration of the roboRIO along the Z axis in g-forces
-
initSendable
public void initSendable(SendableBuilder builder)
Description copied from interface:SendableInitializes thisSendableobject.- Specified by:
initSendablein interfaceSendable- Parameters:
builder- sendable builder
-
getSimObject
public AccelerometerSim getSimObject()
-
-