IMU
Fork of IMUfilter by
Diff: IMUfilter.h
- Revision:
- 2:fae851819c43
- Parent:
- 1:8a920397b510
--- a/IMUfilter.h Mon Sep 06 14:18:33 2010 +0000 +++ b/IMUfilter.h Fri Jul 05 04:17:19 2013 +0000 @@ -1,53 +1,20 @@ -/** - * @author Aaron Berk - * - * @section 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. - * - * @section DESCRIPTION - * - * IMU orientation filter developed by Sebastian Madgwick. - * - * Find more details about his paper here: - * - * http://code.google.com/p/imumargalgorithm30042010sohm/ - */ - #ifndef IMU_FILTER_H #define IMU_FILTER_H -/** - * Includes - */ #include "mbed.h" -/** - * Defines - */ #define PI 3.1415926536 +#define g0 9.812865328//Gravity at Earth's surface in m/s/s +#define SAMPLES 4//Number of samples to average. +#define CALIBRATION_SAMPLES 64//128//Number of samples to be averaged for a null bias calculation//during calibration. +#define toDegrees(x) (x * 57.2957795)//Convert from radians to degrees. +#define toRadians(x) (x * 0.01745329252)//Convert from degrees to radians. +#define GYROSCOPE_GAIN (1 / 14.375)//ITG-3200 sensitivity is 14.375 LSB/(degrees/sec). +#define ACCELEROMETER_GAIN (0.004 * g0)//Full scale resolution on the ADXL345 is 4mg/LSB. +#define GYRO_RATE 0.005//Sampling gyroscope at 200Hz. +#define ACC_RATE 0.005//Sampling accelerometer at 200Hz. +#define FILTER_RATE 0.1//Updating filter at 40Hz. -/** - * IMU orientation filter. - */ class IMUfilter { public: