Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PursuitAPI.hpp
Go to the documentation of this file.
00001 
00013 #ifndef LGL_PURSUIT_API_HPP
00014 #define LGL_PURSUIT_API_HPP
00015 
00016 #include "lgl/PursuitGraph.hpp"
00017 #include "lgl/PursuitNavigator.hpp"
00018 #include "lgl/VisibilityMap.hpp"
00019 #include "lgl/GeoData.hpp"
00020 
00021 //#include <lgl/PursuitGraph.hpp>
00022 //#include <lgl/PursuitStats.hpp>
00023 //
00024 //#include <ostream>
00025 #include <string>
00026 //#include <vector>
00027 
00028 
00029 
00030 namespace jafar {
00031   namespace lgl {
00032 
00033     //-----------------------------------//
00034     //---- Useful structures
00035     //
00036 
00037     typedef struct {
00038       // paths for lgl raster
00039       std::string robotAccessPath   ; 
00040       std::string targetAccessPath  ; 
00041       std::string robotVisibPath    ; 
00042 
00043       // parameters for the pursuit game
00044         unsigned int viewLength     ;
00045         unsigned int riskTermMaxValue ;         
00046         unsigned int sensorHeight   ;     
00047 
00048       // scale and offset to change the reference
00049         unsigned int  xOffset ; // x coordinate of the zero
00050         unsigned int  yOffset ; // y coordinate of the zero
00051         double      scale ;   // number of meters for one pixel       
00052     } PursuitInitParam;
00053       
00054 
00055     typedef struct {
00056       int x ;
00057       int y ;
00058     } Pos;
00059 
00060     typedef struct {
00061       int x ;
00062       int y ;
00063       unsigned int t ;
00064     } Danger;
00065 
00066     typedef struct {
00067       // Current protagonist's positions 
00068       Pos targetPos ;
00069       Pos robotPos  ;
00070       // desired position for the robot
00071       Pos desiredRobotPos ;
00072 
00073       // horizon
00074       unsigned int horizon ;
00075 
00076       unsigned int nFront  ;
00077       unsigned int nRisk   ;
00078       unsigned int nDanger ;
00079 
00080       // Danger list
00081       std::vector<Danger> dangerList ;
00082 
00083     } PursuitState ;
00084       
00085 
00086 
00087     class PursuitAPI 
00088     {
00089       public:
00090         
00091         //-----------------------------------//
00092         //---- Constructors and Destructor
00093         //
00094         PursuitAPI(   std::string  _robotAccessPath , 
00095                 std::string  _targetAccessPath  , 
00096                 std::string  _robotVisibPath  , 
00097                 unsigned int _viewLength    ,
00098                   unsigned int _riskTermMaxValue  ,         
00099                   unsigned int _sensorHeight    ,       
00100                   unsigned int _xOffset = 0   ,     
00101                   unsigned int _yOffset = 0   ,     
00102                   double     _scale = 1.0         
00103                 );
00104         
00105         ~PursuitAPI(){}
00106 
00107 
00108         
00109         //-----------------------------------//
00110         //---- Computing functions
00111         //
00112         // first computation
00113         int startPG(Pos _robotPos, Pos _targetPos) ;
00114 
00115         // update with new protagonists positions
00116         int updatePG(Pos _robotPos, Pos _targetPos) ;
00117 
00118         // compute the PG to extend the temporal horizon
00119         int computePG();
00120 
00121 
00122         
00123         //-----------------------------------//
00124         //---- Setters and Getters
00125         //
00126         // Set the initial parameters and (re-)initialize both the world models and the pursuit graph
00127         int setInitParams(  std::string _robotAccessPath  , 
00128                   std::string _targetAccessPath , 
00129                   std::string _robotVisibPath   , 
00130                   unsigned int _viewLength    ,
00131                     unsigned int _riskTermMaxValue  ,         
00132                     unsigned int _sensorHeight    ,       
00133                     unsigned int _xOffset = 0   ,     
00134                     unsigned int _yOffset = 0   ,     
00135                     double     _scale = 1.0         
00136                   );
00137         
00138         PursuitInitParam getInitParams();
00139 
00140         PursuitState getCurrentState();
00141 
00142         //-----------------------------------//
00143         //---- Checkers
00144         //
00145         //  Check the validity of a given position with the GeoData maps
00146         //  int : the value in the internal reference
00147         //  double : use offset and scale
00148         bool checkPos( int x, int y );
00149         bool checkPos( double x, double y );
00150     
00151 
00152       private:
00153 
00154         //-----------------------------------//
00155         //---- Embedded data
00156         
00157         // Internal Data
00158         // Parameters for initialization
00159         PursuitInitParam initParam ;
00160 
00161         // World representation for navigation and visibility
00162           PursuitNavigator* pNavigator  ;
00163         GeoData* pGeodata         ; 
00164         VisibilityMap* pVisibilityMap   ; 
00165 
00166         // Pursuit Graph
00167         PursuitGraph* pPG ;
00168 
00169         // internal state
00170         PursuitState currentState ;
00171 
00172         //-----------------------------------//
00173         //---- FUNCTIONS
00174         
00175         // Initialization functions
00176         // Initialization for navigation and visibility with the world, according to init parameters
00177         int initWorld();
00178 
00179         // Initialisation of the pursuit graph (after initWorld)
00180         int initPG();
00181 
00182 
00183     };
00184 
00185   }
00186 }
00187 
00188 #endif // LGL_PURSUIT_API_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:24 for Jafar by doxygen 1.7.6.1
LAAS-CNRS