00001 // ---------------------------------------------------------------------------- 00002 // 00003 // $Id$ 00004 // 00005 // Copyright 2008, 2009, 2010 Antonio Franchi and Paolo Stegagno 00006 // 00007 // This file is part of MIP. 00008 // 00009 // MIP is free software: you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation, either version 3 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // MIP is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>. 00021 // 00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it 00023 // 00024 // ---------------------------------------------------------------------------- 00025 00026 00033 00037 00038 00039 #ifndef __IMU_SENSOR_H_ 00040 #define __IMU_SENSOR_H_ 00041 00042 00043 #include <assert.h> 00044 00045 #ifndef MIP_WIN 00046 #include <baselib.h> 00047 #include <Resource.h> 00048 #include <stdlib.h> 00049 #else 00050 #include <mipDefinitions.h> 00051 #endif 00052 00053 using namespace std; 00054 00055 namespace MipResources{ 00056 00058 /* @{ */ 00059 00063 00064 00068 class Imu_sensorOptions : public Options { 00069 public: 00070 Imu_sensorOptions(); 00071 00072 string getObjectName() const { 00073 return "Imu_sensorOptions"; 00074 } 00075 }; 00076 00077 00081 class Imu_sensorPar{ 00082 private: 00083 00084 public: 00087 Imu_sensorPar(){ 00088 }; 00089 }; 00090 00091 00095 class Imu_sensorVar{ 00096 protected: 00097 Time _measTime; 00099 Position3D _acceleration; 00100 Orientation3D _attitude; 00101 Position3D _omega; 00102 00103 pthread_mutex_t _varMutex; 00104 public: 00106 Imu_sensorVar(); 00107 00108 00111 Time time(); 00112 00115 void setTime(Time newTime); 00116 00119 Position3D acceleration(); 00120 00123 Orientation3D attitude(); 00124 00127 Position3D omega(); 00128 00130 void setAccelerationVal(Decimal x, Decimal y, Decimal z); 00131 00133 void setAccelerationVal(Position3D &a); 00134 00136 void setAttitudeVal(Decimal roll, Decimal pitch, Decimal yaw); 00137 00139 void setOmegaVal(Decimal x, Decimal y, Decimal z); 00140 }; 00141 00142 00147 class Imu_sensor : public Resource{ 00148 protected: 00149 Imu_sensorOptions options; 00151 Imu_sensorPar* _par; 00152 Imu_sensorVar* _var; 00154 public: 00157 Imu_sensor(){} 00158 00160 ~Imu_sensor(); 00161 00164 00165 Imu_sensor(int argc, const char* argv[]); 00166 00169 Imu_sensor(int device, Decimal fLength); 00170 00173 virtual Imu_sensorVar* getVar(void){ 00174 return _var; 00175 } 00176 00179 virtual Imu_sensorPar* getPar(void){ 00180 return _par; 00181 } 00182 00183 00185 virtual bool readAcceleration() = 0; 00186 00188 virtual bool readAttitude() = 0; 00189 00190 // Luca Ricci mod. // 00192 virtual bool readAllData() = 0; 00193 }; 00194 }; // end of namespace 00195 00196 00197 #endif 00198 00199 /* @} */ 00200 00201 00202 00203