WebbotLib AVR library
WebbotLib It just does it
  C++ documentation  C documentation

IMU

An IMU (Inertial measurement unit) is a compound sensor which typically includes an accelerometer, gyro, and compass. The sensor values are often passed through a Kalman filter to reduce noise and are typically used by airborne vehicles.
In your appInitHardware you should initialise the sensor:-
imuInit(device);
Then in your main loop you can read the sensor using:-
imuRead(device);
Once read then the values are available in the following member variables:-
ACCEL_TYPE xa = device.imu.x_axis_mG;
ACCEL_TYPE ya = device.imu. y_axis_mG;
ACCEL_TYPE za = device.imu. z_axis_mG;
GYRO_TYPE xr = device.imu.x_axis_degrees_per_second;
GYRO_TYPE yr = device.imu.y_axis_degrees_per_second;
GYRO_TYPE zr = device.imu.z_axis_degrees_per_second;
COMPASS_TYPE yaw = device.imu.bearingDegrees;
COMPASS_TYPE roll = device.imu.rollDegrees;
COMPASS_TYPE pitch = device.imu.pitchDegrees;
Or they can all be dumped to the rprintf destination using:
imuDump(device);

 

File

 

Valid XHTML 1.0 Transitional