An advanced robot that uses PID control on the motor speed, and an IMU for making accurate turns.

Dependencies:   mbed Motor ITG3200 QEI ADXL345 IMUfilter PID

Embed: (wiki syntax)

« Back to documentation index

IMU Class Reference

IMU Class Reference

IMU consisting of ADXL345 accelerometer and ITG-3200 gyroscope to calculate roll, pitch and yaw angles. More...

#include <IMU.h>

Public Member Functions

 IMU (float imuRate, double gyroscopeMeasurementError, float accelerometerRate, float gyroscopeRate)
 Constructor.
double getRoll (void)
 Get the current roll angle.
double getPitch (void)
 Get the current pitch angle.
double getYaw (void)
 Get the current yaw angle.
void sample (void)
 Sample the sensors, and if enough samples have been taken, take an average, and compute the new Euler angles.
void reset (void)
 Recalibrate the sensors and reset the IMU filter.

Detailed Description

IMU consisting of ADXL345 accelerometer and ITG-3200 gyroscope to calculate roll, pitch and yaw angles.

Definition at line 75 of file IMU.h.


Constructor & Destructor Documentation

IMU ( float  imuRate,
double  gyroscopeMeasurementError,
float  accelerometerRate,
float  gyroscopeRate 
)

Constructor.

Includes.

Parameters:
imuRateRate which IMUfilter update and Euler angle calculation occurs.
gyroscopeMeasurementErrorIMUfilter tuning parameter.
accelerometerRateRate at which accelerometer data is sampled.
gyroscopeRateRate at which gyroscope data is sampled.
Author:
Aaron Berk

LICENSE

Copyright (c) 2010 ARM Limited

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

DESCRIPTION

IMU consisting of ADXL345 accelerometer and ITG-3200 gyroscope using orientation filter developed by Sebastian Madgwick.

Find more details about his paper here:

http://code.google.com/p/imumargalgorithm30042010sohm/

Definition at line 42 of file IMU.cpp.


Member Function Documentation

double getPitch ( void   )

Get the current pitch angle.

Returns:
The current pitch angle in degrees.

Definition at line 86 of file IMU.cpp.

double getRoll ( void   )

Get the current roll angle.

Returns:
The current roll angle in degrees.

Definition at line 80 of file IMU.cpp.

double getYaw ( void   )

Get the current yaw angle.

Returns:
The current yaw angle in degrees.

Definition at line 92 of file IMU.cpp.

void reset ( void   )

Recalibrate the sensors and reset the IMU filter.

Definition at line 313 of file IMU.cpp.

void sample ( void   )

Sample the sensors, and if enough samples have been taken, take an average, and compute the new Euler angles.

Definition at line 253 of file IMU.cpp.