forked from ftctechnh/ftc_app
-
Notifications
You must be signed in to change notification settings - Fork 0
REVImu
cezarmathe edited this page Mar 5, 2019
·
1 revision
The REVImu class is a wrapper for the Rev Inertial Measurement Unit sensor that simplifies the process of aquiring information from the sensor.
- Initialization
In order to use the sensor, you need initialize the sensor. We use the static method REVImu.get()
.
imu = REVImu.get(hardwareMap, "imu", "CONFIG_FILE_NAME");
Notice that we need to pass as arguments the hardware map, the name of the sensor in the robot configuration and the file name of the configuration file. This is generated by running the Rev Imu Calibration OpMode, found at org.firtsinspires.ftc.robotcontroller.extenral.samples.SensorBNO055IMUCalibration.
- Reading data
The REVImu has 3 methods that read angles:
-
getHeading()
- z axis -
getRoll()
- y axis -
getPitch()
- x axis
We can retrieve data like this:
double heading = imu.getHeading();
double roll = imu.getRoll();
double pitch = imu.getPitch();
Be careful when reading data a lot because reading sensor data is expensive and it can cause lag.