Localization3D.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 
00034 
00035 
00036 #ifndef __LOCALIZATION_3D_H_
00037 #define __LOCALIZATION_3D_H_
00038 
00039 
00040 #include <Task.h>
00041 #include <Resource.h>
00042 #include <MobileRob3D.h>
00043 #include <DraWin.h>
00044 #include <SharedMem.h>
00045 #include <Time.h>
00046 
00047 #include <CommonOptions.h>
00048 #include <MultiReg.h>
00049 #include <DAEKF.h>
00050 #include <PaFil.h>
00051 #include <CommModule.h>
00052 #include <Kalman.h>
00053 #include <KalmanImu.h>
00054 
00055 using namespace MipAlgorithms;
00056 using namespace MipResources;
00057 
00058 namespace MipTasks{
00059  
00061  /* @{ */
00062  
00066  class Localization3DOptions : public Options 
00067  {
00068   public:
00069   
00070    //IntOption* particleNumber;
00071    StringOption* nameSurfaceFile;
00072   
00073    Localization3DOptions()
00074    {
00075 
00076     nameSurfaceFile = createStringOption("localization3DNameSurfaceFile","Name of the surface file; default = null ", "");
00077     
00078     updateValues();
00079 
00080    }
00081   
00082    OptionGroupsType getGroup();
00083    string getObjectName() const {
00084     return "Localization3DOptions";
00085    }
00086  };
00087  
00088  
00092  class Localization3DSharedMem : public SharedMem
00093  {
00094   public:
00096    void initSharedMem();
00097  };
00098  
00099  
00103 class Localization3D : public Task
00104 {
00105  private:
00106    static const TaskPlate   _plate = L3D_TASK;
00107    static const long int  _maxDurSec   = 0, _maxDurUsec = 500000;
00108    static const long int  _maxSamplPeriodSec = 1, _maxSamplPeriodUsec = 0;
00109    static const long int  _minSamplPeriodSec = 0, _minSamplPeriodUsec = 400000;
00110    
00111    MobileRob3D* _mobileRob3D;
00112    
00113  #ifndef MIP_PLATFORM_ARM
00114    DraWin*      _draWin;
00115    unsigned int _drawList;
00116    bool         _dwOn;
00117  #endif
00118    
00119    Localization3DSharedMem* _sharedMem;
00120    Localization3DOptions   _options;
00121    //KalmanFilter*   _kalmanFilter;
00122    KalmanFilterImu*  _kalmanFilterImu;
00123    
00124    int _myId;
00125    Pose _myPose;
00126    
00127    void draw();
00128    bool IMU_MeasAvail;//1 = IMU measure available; 0 = IMU measures not available;
00129    
00130   public:
00132    Localization3D(ResourcePointers resources,int argc, const char* argv[]);
00133    
00135    ~Localization3D();
00136    
00139    TaskPlate getPlate() const
00140    {
00141     return _plate;
00142    }
00143    
00146    Time getMaxDuration()
00147    {
00148     return Time(_maxDurSec,_maxDurUsec);
00149    }
00150    
00153    Time getMaxSamplPeriod()
00154    {
00155     return Time(_maxSamplPeriodSec,_maxSamplPeriodUsec);
00156    }
00159    Time getMinSamplPeriod()
00160    {
00161     return Time(_minSamplPeriodSec,_minSamplPeriodUsec);
00162    }
00163    
00164    void set_IMU_MeasAvail()
00165    {
00166            IMU_MeasAvail = true;
00167     return;
00168    }
00169 
00170    void unset_IMU_MeasAvail()
00171    {
00172            IMU_MeasAvail = false;
00173     return;
00174    }
00175 
00176    bool get_IMU_MeasStatus()
00177    {
00178     return IMU_MeasAvail;
00179    }
00180 
00182    TaskOutputs run();
00183  };
00184  /* @} */
00185  
00186 };// end namespace MipTasks
00187 
00188 #endif
00189 
00190 
00191 
00192 
00193 

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