Imu3D.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010, 2011, 2012  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: franchi@diag.uniroma1.it stegagno@diag.uniroma1.it
00023 //
00024 // ----------------------------------------------------------------------------
00025 
00026 
00033 
00034 
00038 
00039 
00040 
00041 #ifndef __IMU_SENSOR3D_H_
00042 #define __IMU_SENSOR3D_H_
00043 
00044 #ifdef MIP_HOST_APPLE
00045 #include <applePatch.h>
00046 #endif
00047 
00048 #include <stdlib.h>
00049 #include <string>
00050 #include <sstream>
00051 #include <vector>
00052 #include <assert.h>
00053 #include <pthread.h>
00054 
00055 #include <baselib.h>
00056 #include <Resource.h>
00057 
00058 using namespace MipBaselib;
00059 
00060 namespace MipResources{
00061 
00063 /* @{ */
00064 
00065 
00069 class ImuPar
00070 {
00071  private:
00072   string  _name;  
00073 
00074   Acceleration3D  _acc;  
00075   Acceleration3D _gyro;  
00076   Orientation3D  _magn;  
00077 
00078  protected:
00082   void setIMUName(string value)
00083   {
00084    _name = value;
00085    return;
00086   }
00087 
00091   void setIMUAcceleration(Acceleration3D a)
00092   {
00093    _acc = a;
00094    return;
00095   }
00096 
00100   void setIMUAngRate(Acceleration3D g)
00101   {
00102    _gyro = g;
00103    return;
00104   }
00105 
00109   void setIMUOri(Orientation3D m)
00110   {
00111    _magn = m;
00112    return;
00113   }
00114 
00115 
00116  public:
00117 
00119    ~ImuPar(){};
00120 
00122   ImuPar ()
00123   {
00124    _acc = Acceleration3D(0.0, 0.0, 0.0);
00125    _gyro = Acceleration3D(0.0, 0.0, 0.0);
00126    _magn = Orientation3D(0.0, 0.0, 0.0);
00127   }
00128   
00130   ImuPar(const ImuPar& s)
00131   {
00132    _acc = s._acc;
00133    _gyro  = s._gyro;
00134    _magn = s._magn;
00135   }
00136 
00137 
00139   ImuPar& operator=(const ImuPar& s)
00140   {
00141    if (this != &s)
00142    {
00143     _acc = s._acc;
00144     _gyro  = s._gyro;
00145     _magn = s._magn;
00146    }
00147    return *this;
00148   }
00149 
00151   
00152 };
00153 
00160 class ImuVar {};
00161 
00169 class Imu : public Resource
00170 {
00171  private:
00172   bool _IMUavail; 
00173  
00174  protected:
00175   ImuPar *_par; 
00177  public:
00178   
00179   virtual ResourcePlate getPlate() const =0;
00180 
00182   Imu()
00183   {
00184    cout << "Imu constructor starting." << endl;
00185    _par = new ImuPar();
00186    _IMUavail = true;
00187    cout << "Imu constructor end." << endl;
00188   };
00189   
00190 
00192   ~Imu(){};
00193 
00194   virtual  bool getIMUMeasure(Acceleration3D &acc, Acceleration3D &gyro, Orientation3D &magn, Decimal *MeasTime)=0; 
00195 };
00196 
00197  /* @} */
00198  
00199 };// end namespace MipResources{
00200 
00201 
00202 #endif
00203 
00204 
00205 
00206 
00207 

Generated on Mon Feb 20 07:01:07 2017 for MIP by  doxygen 1.5.6