orientation.h
Go to the documentation of this file.
00001 #ifndef ORIENTATION_H
00002 #define ORIENTATION_H
00003 
00004 #define GRAVITY 9.81
00005 
00006 #include "orientation.h"
00007 #include <stdio.h>
00008 #include <stdlib.h>
00009 #include <math.h>
00010 
00011 class Orientation
00012 {
00013 
00014 private:
00015 
00016         double timestampPreviousCall; //timestamp of the measurement got at the last call of the function
00017         double pitchOffset; //offset necessary go from angle in the intial device position coordinate system to the User coordinate system
00018         double rollOffset; //offset necessary go from angle in the intial device position coordinate system to the User coordinate system
00019         double roll;
00020         double pitch;
00021         double yaw;
00022         double gravity[3]; //We save the gravity to know if the gravity we got is different from before or not
00023         double gravityEpsilon;
00024         int validGravityCounter; //Counter the number of valid gravity vector(valid in the sense that the norm is near 1) that follow each other
00025         int validAccelerationVectorsNecessaryToDetectGravity;
00026         double lastGravityVectorDetected[3]; //save the value of the last gravity vector detected with the algorithm values
00027 
00028         double ToRad(double value);
00029         bool isEqual(double vector1[3], double vector2[3]);
00030         void detectGravity(double gravity[3], float acceleration[3]);
00031         void calculate_new_gravity(float acceleration[3]);
00032 
00033 public:
00034 
00035         Orientation();
00036         ~Orientation(){};
00037         void updateAngles(float gyroscopeVector[3], float AccelerationVector[3], double gyroscopeTimestamp);
00038         double get_roll();
00039         double get_pitch();
00040         double get_yaw();
00041 };
00042 #endif


corobot_phidget_ik
Author(s):
autogenerated on Sun Oct 5 2014 23:18:06