Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
P3d.hpp
00001 
00002 #ifndef _P3D_P3D_H_
00003 #define _P3D_P3D_H_
00004 
00005 #include <libp3d.h>
00006 
00007 #include "dtm/Dtm.hpp"
00008 #include "calife/T3d.hpp"
00009 #include "geom/t3dEuler.hpp"
00010 
00011 #include <string>
00012 #include <vector>
00013 
00014 #include "p3d/P3D_MAP.hpp"
00015 
00016 namespace jafar {
00017   namespace p3d {
00025     class P3DPlanner {
00026       private:
00027         ::P3DPlanner * _pdata; 
00029       public:
00033         P3DPlanner();
00034 
00038         ~P3DPlanner();
00039 
00047         ::P3DPlanner* get_data() const;
00048 
00057         void configureGeom(double len[3], double rad[2], double arm[2],
00058             double bodyLength, double bodyWidth,
00059             double zBody, double groundClear,
00060             double rollLimits[3], double pichLimits[3], 
00061             double alphaLimits[3], double betaLimits[3],
00062             double unkMax);
00063 
00082         void configureRobot(double scale, double rollStep, double vMin, double vMax,
00083                   double wMax, double accel, double decel);
00102         void configureArcs(int nArcs, int nNodes, int depth, double rMin, 
00103             double goalTol, double dMin);
00104     };
00105 
00106 
00113     class P3DRobotConfig {
00114       private:
00115         ::P3DRobotConfig * _pdata; 
00117       public:
00121         P3DRobotConfig();
00122 
00126         ~P3DRobotConfig();
00127 
00134         ::P3DRobotConfig * get_data() const;
00135 
00142         void display() const;
00143 
00151         double quality() const;
00152 
00153         /*
00154          * The method to_T3D returns a geom::T3D representing the 3D
00155          * position of the robot.
00156          *
00157          * @param t3d represents the t3d which will contain the position
00158          * of the robot
00159          * @return Nothing.
00160          * @return t3d is modified.
00161          */
00162         void to_T3D(jafar::geom::T3DEuler & t3d) const;
00163     };
00164 
00171     class P3DPlanSolution {
00172       private:
00173         ::P3DPlanSolution * _pdata; 
00174         void clear_data();
00175 
00176       public:
00180         P3DPlanSolution();
00181 
00188         P3DPlanSolution(int depth, int nNodes);
00189 
00193         ~P3DPlanSolution();
00194 
00198         double curv() const;
00199 
00203         double d() const;
00204 
00208         double cost() const;
00209 
00210         /*
00211          */
00212         int depth() const;
00213 
00214         /*
00215          * @return the speed of the solution
00216          */
00217         double v() const;
00218 
00219         /*
00220          * set the speed of the robot for the next call
00221          * @return Nothing.
00222          */
00223         void set_v(double v);
00224 
00225         /*
00226          * set the speed of the robot for the next call
00227          * @return Nothing.
00228          */
00229         void set_w(double w);
00230 
00231         /*
00232          * set the average time call of the robot for the next call
00233          * @return Nothing.
00234          */
00235         void set_time(double time);
00236 
00240         double alpha() const;
00241 
00245         double time() const;
00246 
00251         void display_arc_cost() const;
00252 
00253 
00258         ::P3DPlanSolution* get_data();
00259 
00267         void set_data(int depth, int nNodes);
00268 
00276         std::string gdhe_display(jafar::geom::T3DEuler & m2o) const;
00277     };
00278 
00279 
00283     enum P3D_algo {
00284       ASTAR,
00285       FULL_BALANCED
00286     };
00287 
00295     class P3d {
00296       private:
00297         jafar::p3d::P3DPlanner _planner;   
00298         jafar::p3d::P3D_MAP _map; 
00299         jafar::p3d::P3DPlanSolution _sol; 
00300         jafar::p3d::P3D_algo _algo; 
00302       public:
00310         P3d(jafar::p3d::P3D_algo p3d_algo);
00311 
00315         ~P3d();
00316 
00330         jafar::p3d::P3DRobotConfig* placeRobot(double x, double y, double theta);
00331 
00347         int plan(jafar::geom::T3D& m2o, jafar::geom::T3D& g2o);
00348 
00360         bool check_trajectory(jafar::geom::T3D& m2o, double alpha);
00361          
00381         int aco(jafar::geom::T3D& mainToOrigin, double alpha, double v,
00382             double left_alpha, double right_alpha);
00383 
00401         int evo(jafar::geom::T3D& mainToOrigin, double alpha, double v);
00402             
00406         jafar::p3d::P3D_MAP& map() 
00407         {
00408           return _map;
00409         };
00410 
00414         const jafar::p3d::P3D_MAP& map() const
00415         {
00416           return _map;
00417         };
00418 
00419         /*
00420          * @return a reference to the internal planner
00421          */
00422         jafar::p3d::P3DPlanner& planner() 
00423         {
00424           return _planner;
00425         };
00426 
00427         /*
00428          * @return a constant reference to the internal planner
00429          */
00430         const jafar::p3d::P3DPlanner& planner() const
00431         {
00432           return _planner;
00433         };
00434 
00435 
00436         /*
00437          * @return a reference to the internal solution
00438          */
00439         jafar::p3d::P3DPlanSolution& solution() 
00440         {
00441           return _sol;
00442         };
00443 
00444         /*
00445          * @return a constant reference to the internal solution
00446          */
00447         const jafar::p3d::P3DPlanSolution& solution() const
00448         {
00449           return _sol;
00450         };
00451 
00452         static std::string conffile; 
00454     };
00455 
00462     class P3dArcDumper {
00463       private:
00464         ::P3DArcDump * _pdata; 
00465         jafar::geom::T3DEuler _m2o; 
00466         int _n_arcs; 
00467         int _max_depth; 
00469         bool has_valid_cost(int, int) const;
00470         void _dump(bool, std::ostream &) const;
00471 
00478         int evaluate_nb_arcs(int nArcs, int depth);
00479 
00480       public:
00491         P3dArcDumper(const jafar::p3d::P3d & p3d, jafar::geom::T3D& m2o);
00492 
00496         ~P3dArcDumper();
00497 
00508         void update(const jafar::p3d::P3d & p3d, jafar::geom::T3D& m2o);
00509 
00515         std::string gdhe_display() const;
00516 
00524         void display(bool only_valid) const;
00525 
00534         void display_to_file(bool only_valid, const std::string & path) const;
00535 
00545         int set_next_node_coords(jafar::geom::T3DEuler & pos) const;
00546     };
00547   }
00548 }
00549 
00550 
00551 #endif /* _P3D_P3D_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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