Package ftclib.sensor
Class FtcAccelerometer
java.lang.Object
trclib.sensor.TrcSensor<TrcAccelerometer.DataType>
trclib.sensor.TrcAccelerometer
ftclib.sensor.FtcAccelerometer
This class implements the platform dependent accelerometer extending TrcAccelerometer. It provides implementation
of the abstract methods in TrcAccelerometer. It supports 3 axes: x, y and z. It provides acceleration data for all
3 axes. However, it doesn't provide any velocity or distance data.
-
Nested Class Summary
Nested classes/interfaces inherited from class trclib.sensor.TrcAccelerometer
TrcAccelerometer.DataTypeNested classes/interfaces inherited from class trclib.sensor.TrcSensor
TrcSensor.DataSource<D>, TrcSensor.SensorData<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.qualcomm.robotcore.hardware.AccelerationSensorFields inherited from class trclib.sensor.TrcAccelerometer
ACCEL_DOUBLE_INTEGRATE, ACCEL_HAS_X_AXIS, ACCEL_HAS_Y_AXIS, ACCEL_HAS_Z_AXIS, ACCEL_INTEGRATE, instanceName -
Constructor Summary
ConstructorsConstructorDescriptionFtcAccelerometer(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String instanceName, TrcFilter[] filters) Constructor: Creates an instance of the object.FtcAccelerometer(String instanceName) Constructor: Creates an instance of the object.FtcAccelerometer(String instanceName, TrcFilter[] filters) Constructor: Creates an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method calibrates the sensor.getRawXData(TrcAccelerometer.DataType dataType) This method returns the raw data of the specified type for the x-axis.getRawYData(TrcAccelerometer.DataType dataType) This method returns the raw data of the specified type for the y-axis.getRawZData(TrcAccelerometer.DataType dataType) This method returns the raw data of the specified type for the z-axis.Methods inherited from class trclib.sensor.TrcAccelerometer
getRawData, getXAcceleration, getXDistance, getXVelocity, getYAcceleration, getYDistance, getYVelocity, getZAcceleration, getZDistance, getZVelocity, printElapsedTime, resetXIntegrator, resetYIntegrator, resetZIntegrator, setElapsedTimerEnabled, setEnabled, setXInverted, setXScale, setYInverted, setYScale, setZInverted, setZScale, toStringMethods inherited from class trclib.sensor.TrcSensor
calibrate, calibrate, getNumAxes, getProcessedData, isCalibrating, setInverted, setScale, setScaleAndOffset
-
Field Details
-
accel
private final com.qualcomm.robotcore.hardware.AccelerationSensor accel
-
-
Constructor Details
-
FtcAccelerometer
public FtcAccelerometer(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String instanceName, TrcFilter[] filters) Constructor: Creates an instance of the object.- Parameters:
hardwareMap- specifies the global hardware map.instanceName- specifies the instance name.filters- specifies an array of filters to use for filtering sensor noise, one for each axis. Since we have 3 axes, the array should have 3 elements. If no filters are used, it can be set to null.
-
FtcAccelerometer
Constructor: Creates an instance of the object.- Parameters:
instanceName- specifies the instance name.filters- specifies an array of filters to use for filtering sensor noise, one for each axis. Since we have 3 axes, the array should have 3 elements. If no filters are used, it can be set to null.
-
FtcAccelerometer
Constructor: Creates an instance of the object.- Parameters:
instanceName- specifies the instance name.
-
-
Method Details
-
calibrate
public void calibrate()This method calibrates the sensor. -
getRawXData
This method returns the raw data of the specified type for the x-axis.- Specified by:
getRawXDatain classTrcAccelerometer- Parameters:
dataType- specifies the data type.- Returns:
- raw data of the specified type for the x-axis.
-
getRawYData
This method returns the raw data of the specified type for the y-axis.- Specified by:
getRawYDatain classTrcAccelerometer- Parameters:
dataType- specifies the data type.- Returns:
- raw data of the specified type for the y-axis.
-
getRawZData
This method returns the raw data of the specified type for the z-axis.- Specified by:
getRawZDatain classTrcAccelerometer- Parameters:
dataType- specifies the data type.- Returns:
- raw data of the specified type for the z-axis.
-