ClearingTask.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 
00029 
00030 
00035 
00036 
00037 
00038 #ifndef __CLEARING_TASK_H_
00039 #define __CLEARING_TASK_H_
00040 
00041 
00042 #include <Task.h>
00043 #include <Resource.h>
00044 #include <MobileRob.h>
00045 #include <DraWin.h>
00046 #include <SharedMem.h>
00047 #include <Time.h>
00048 
00049 #include <CommonOptions.h>
00050 #include "ClearingMobileRobot.h"
00051 #include <MultiReg.h>
00052 #include <DAEKF.h>
00053 #include <PaFil.h>
00054 #include <CommModule.h>
00055 
00056 
00057 using namespace MipAlgorithms;
00058 using namespace MipResources;
00059 
00060 namespace MipTasks{
00061  
00063  /* @{ */
00064 
00065  
00069  class ClearingOptions : public Options {
00070   public:
00071    
00072    IntOption* filterType;
00073    
00074    ClearingOptions();
00075    
00076    OptionGroupsType getGroup();
00077 
00078    string getObjectName() const {
00079     return "ClearingOptions";
00080    }
00081  };
00082  
00083  
00087  class ClearingSharedMem : public SharedMem{
00088   public:
00090    void initSharedMem();
00091    
00095    PosiFeatures getMyProtrusions(MotionModuleTState &state);
00096    
00099    void setFormation(PoseFeatures &form);
00100    
00103    void setEstimates(PoseFeatures &est);
00104    
00107    Pose getTarget();
00108    
00111    void setTarget(Pose &t);
00112    
00115    bool doMloc();
00116    
00119    bool doAutoNavigation();
00120    
00123    bool printFormation();
00124    
00127    bool printFormationDetails();
00128    
00131    vector<int> getAvoidClearingIds();
00132  };
00133  
00134  
00138  class ClearingTask : public Task{
00139   private:
00140    static const TaskPlate _plate = CLE_TASK;
00141    static const long int  _maxDurSec  = 0,     _maxDurUsec = 500000;
00142    static const long int  _maxSamplPeriodSec = 1, _maxSamplPeriodUsec = 0;
00143    static const long int  _minSamplPeriodSec = 0, _minSamplPeriodUsec = 400000;
00144    
00145    MobileRob* _mobileRob;  
00146    ClearingMobileRobot* _clMr;
00147    Position   robPosition; 
00148    Pose       robPose;     
00149    
00150    DraWin*      _draWin;   
00151    unsigned int _drawList; 
00152    bool         dwOn;      
00153    
00154    ClearingSharedMem*  _sharedMem;
00155    
00156    CommModule* _commModule;
00157    
00158    vector<ClearingAgent> agentVec; 
00159    vector<Position> agentViewpoints; 
00160    Grid* gGlobalGrid;
00161    bool bContinue;
00162    
00163    bool domultireg;
00164    bool dofilter;
00165    
00166    map<int,PosiFeatures> othersPosiFeatures;
00167    map<int,Pose> othersPose;
00168    vector<int> othersPosiFeaturesNums;
00169    vector<int> othersPoseNums;
00170    
00171    int myId;
00172    Pose myPose;
00173    PosiFeatures myPosiFeatures;
00174    Observation myObservation;
00175    
00176    ClearingOptions options;
00177    
00178   public:
00180    ClearingTask(ResourcePointers resources,int argc, const char* argv[]);
00181    
00183    ~ClearingTask();
00184    
00187    TaskPlate getPlate() const {
00188     return _plate;
00189    }
00192    Time getMaxDuration(){
00193     return Time(_maxDurSec,_maxDurUsec);
00194    }
00197    Time getMaxSamplPeriod(){
00198     return Time(_maxSamplPeriodSec,_maxSamplPeriodUsec);
00199    }
00202    Time getMinSamplPeriod(){
00203     return Time(_minSamplPeriodSec,_minSamplPeriodUsec);
00204    }
00207    TaskOutputs run();
00208   
00209   private:
00210    
00212    void comunicate();
00213    
00214  };
00215  
00216  /* @} */
00217  
00218 }; // end namespace MipTasks
00219 
00220 
00221 #endif
00222 
00223 
00224 
00225 
00226 

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