OfflineUav.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: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it
00023 //
00024 // ----------------------------------------------------------------------------
00025 
00029 
00030 
00031 #ifndef __OFFLINE_QUAD_H_
00032 #define __OFFLINE_QUAD_H_
00033 
00034 
00035 #include <MRControlInput.h>
00036 #include <MotionModule.h>
00037 #include <SimTime.h>
00038 #include <SpacesArma.h>
00039 
00040 namespace MipResources{
00041  
00042  
00044  /* @{ */
00045  
00049  class dataUav{
00050   public:
00051    SimTime         time;
00052    Decimal         sonar;
00053    Orientation3D      attitude;
00054    Velocity3DArma     velocity;
00055    vector<Position2DArma> camObs;
00056    
00058    dataUav();
00059    
00061    ~dataUav();
00062    
00066    dataUav& operator=(const dataUav& mc);
00067    
00070    dataUav(const dataUav& mc);
00071    
00074    string exportAsString() const;
00075  };
00076  
00080  class sonarUav{
00081   public:
00082    SimTime  sonarTime;
00083    Decimal  sonarMeas;
00084    
00086    sonarUav();
00087    
00091    sonarUav(const SimTime& time, const Decimal &meas);
00092    
00095    sonarUav(stringstream& ss);
00096    
00098    ~sonarUav();
00099    
00103    sonarUav& operator=(const sonarUav& mc);
00104    
00107    sonarUav(const sonarUav& mc);
00108    
00111    string exportAsString() const;
00112  };
00113  
00117  class attitudeUav{
00118   public:
00119    SimTime     attTime;
00120    Orientation3D  attUav;
00121    
00123    attitudeUav();
00124    
00128    attitudeUav(const SimTime& time, const Orientation3D &att);
00129    
00135    attitudeUav(const SimTime& time, const Decimal& roll, const Decimal& pitch, const Decimal& yaw);
00136    
00141    attitudeUav(const SimTime& time, const Decimal& roll, const Decimal& pitch);
00142    
00146    attitudeUav(stringstream& ss,bool opt);
00147    
00149    ~attitudeUav();
00150    
00154    attitudeUav& operator=(const attitudeUav& mc);
00155    
00158    attitudeUav(const attitudeUav& mc);
00159    
00162    string exportAsString() const;
00163  };
00164  
00168  class velocityUav{
00169   public:
00170    SimTime     velTime;
00171    Velocity3DArma velUav;
00172    
00174    velocityUav();
00175    
00179    velocityUav(const SimTime& time, const Velocity3DArma &vel);
00180    
00186    velocityUav(const SimTime& time, const Decimal& velX, const Decimal& velY, const Decimal& velZ);
00187    
00189    ~velocityUav();
00190    
00194    velocityUav& operator=(const velocityUav& mc);
00195    
00198    velocityUav(const velocityUav& mc);
00199    
00202    string exportAsString() const;
00203  };
00204  
00205  
00206  typedef struct vector<Position2DArma> camObs;
00207  
00211  class OfflineUav: public MIPObject{
00212   private:
00213    int _counterTruth;
00214    int _id;
00215    int _counterTime;
00216    string _idStr;
00217    
00218    // Folder and file names. Must be passed in constructor
00219    string _folder;
00220    string _IMUFile;
00221    string _sonarAttFile;
00222    string _camObsFile;
00223    string _velFile;
00224    string _truthFile;
00225    string _timeFile;
00226    string _timeGTFile;
00227    
00228    // Structure for saving data
00229    vector<SimTime>     _myTime;
00230    vector<Orientation3D>  _myAttitude;
00231    vector<camObs>     _myCamObs;
00232    vector<Decimal>     _mySonar;
00233    vector<Velocity3DArma> _myLinVelocity;
00234    vector<Velocity3DArma> _myAngVelocity;
00235    
00236    // Ground truth
00237    vector<SimTime>     _myGTTime;
00238    vector<Pose3DArma>   _myGTPose;
00239    
00241    Decimal _startingTime;
00243    bool _firstValidFile;
00244    
00245    // Private methods
00246    void _readCamObsFile();
00247    
00248    void _readSonarAttFile();
00249    
00250    void _readTruthFile();
00251    
00252    void _readVelFile();
00253    
00254    void _readTimeFile();
00255    
00256   public:
00257    
00259    OfflineUav();
00260    
00262    OfflineUav(const string &id, const string &fn, const string &timeF, const string &cof, const string &sf, const string& gttf, const string& gtf, const string& vf);
00263    
00265    string getObjectName() const{
00266     return "OfflineUav";
00267    }
00268    
00274    bool getMyTime(Time &instant,int &index);
00275    
00280    Orientation3D getMyAttitude(const int &index) const;
00281    
00286    Decimal getMyRoll(const int &index) const;
00287    
00292    Decimal getMyPitch(const int &index) const;
00293    
00298    Decimal getMyYaw(const int &index) const;
00299    
00304    Velocity3DArma getMyLinearVelocity(const int &index) const;
00305    
00310    Velocity3DArma getMyAngularVelocity(const int &index) const;
00311    
00316    Decimal getMySonar(const int &index) const;
00317    
00322    vector<Position2DArma> getMyObs(const int &index) const;
00323    
00325    bool getMyGroundTruth(Time& instant, Pose3DArma &myPose, int& index);
00326    
00329    Decimal getMyStartingTime() const;
00330  };
00331  
00332  /* @} */
00333  
00334 };// end namespace MipResources
00335 
00336 
00337 
00338 #endif
00339 
00340 
00341 
00342 
00343 

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