Main MRPT website > C++ reference for MRPT 1.5.9
nav/reactive/CReactiveNavigationSystem.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 #ifndef CReactiveNavigationSystem_H
10 #define CReactiveNavigationSystem_H
11 
13 
14 namespace mrpt
15 {
16  namespace nav
17  {
18  /** \defgroup nav_reactive Reactive navigation classes
19  * \ingroup mrpt_nav_grp
20  */
21 
22  /** See base class CAbstractPTGBasedReactive for a description and instructions of use.
23  * This particular implementation assumes a 2D robot shape which can be polygonal or circular (depending on the selected PTGs).
24  *
25  * Publications:
26  * - Blanco, Jose-Luis, Javier Gonzalez, and Juan-Antonio Fernandez-Madrigal. ["Extending obstacle avoidance methods through multiple parameter-space transformations"](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.190.4672&rep=rep1&type=pdf). Autonomous Robots 24.1 (2008): 29-48.
27  *
28  * Class history:
29  * - 17/JUN/2004: First design.
30  * - 16/SEP/2004: Totally redesigned, according to document "MultiParametric Based Space Transformation for Reactive Navigation"
31  * - 29/SEP/2005: Totally rewritten again, for integration into MRPT library and according to the ICRA paper.
32  * - 17/OCT/2007: Whole code updated to accomodate to MRPT 0.5 and make it portable to Linux.
33  * - DEC/2013: Code refactoring between this class and CAbstractHolonomicReactiveMethod
34  * - FEB/2017: Refactoring of all parameters for a consistent organization in sections by class names (MRPT 1.5.0)
35  *
36  * This class requires a number of parameters which are usually provided via an external config (".ini") file.
37  * Alternatively, a memory-only object can be used to avoid physical files, see mrpt::utils::CConfigFileMemory.
38  *
39  * A template config file can be generated at any moment by the user by calling saveConfigFile() with a default-constructed object.
40  *
41  * Next we provide a self-documented template config file; or see it online: https://github.com/MRPT/mrpt/blob/master/share/mrpt/config_files/navigation-ptgs/reactive2d_config.ini
42  * \verbinclude reactive2d_config.ini
43  *
44  * \sa CAbstractNavigator, CParameterizedTrajectoryGenerator, CAbstractHolonomicReactiveMethod
45  * \ingroup nav_reactive
46  */
48  {
49  public:
51  public:
52  /** See docs in ctor of base class */
54  CRobot2NavInterface &react_iterf_impl,
55  bool enableConsoleOutput = true,
56  bool enableLogFile = false,
57  const std::string &logFileDirectory = std::string("./reactivenav.logs")
58  );
59 
60  /** Destructor
61  */
62  virtual ~CReactiveNavigationSystem();
63 
64  /** Defines the 2D polygonal robot shape, used for some PTGs for collision checking. */
65  void changeRobotShape( const mrpt::math::CPolygon &shape );
66  /** Defines the 2D circular robot shape radius, used for some PTGs for collision checking. */
67  void changeRobotCircularShapeRadius( const double R );
68 
69  // See base class docs:
70  virtual size_t getPTG_count() const MRPT_OVERRIDE { return PTGs.size(); }
71  virtual CParameterizedTrajectoryGenerator* getPTG(size_t i) MRPT_OVERRIDE { ASSERT_(i<PTGs.size()); return PTGs[i]; }
72  virtual const CParameterizedTrajectoryGenerator* getPTG(size_t i) const MRPT_OVERRIDE { ASSERT_(i<PTGs.size()); return PTGs[i]; }
73  virtual bool checkCollisionWithLatestObstacles(const mrpt::math::TPose2D &relative_robot_pose) const MRPT_OVERRIDE;
74 
76  {
77  double min_obstacles_height, max_obstacles_height; // The range of "z" coordinates for obstacles to be considered
78 
79  virtual void loadFromConfigFile(const mrpt::utils::CConfigFileBase &c, const std::string &s) MRPT_OVERRIDE;
80  virtual void saveToConfigFile(mrpt::utils::CConfigFileBase &c, const std::string &s) const MRPT_OVERRIDE;
82  };
83 
85 
86  virtual void loadConfigFile(const mrpt::utils::CConfigFileBase &c) MRPT_OVERRIDE; // See base class docs!
87  virtual void saveConfigFile(mrpt::utils::CConfigFileBase &c) const MRPT_OVERRIDE; // See base class docs!
88 
89  private:
90  std::vector<CParameterizedTrajectoryGenerator*> PTGs; //!< The list of PTGs to use for navigation
91 
92  // Steps for the reactive navigation sytem.
93  // ----------------------------------------------------------------------------
94  virtual void STEP1_InitPTGs() MRPT_OVERRIDE;
95 
96  // See docs in parent class
97  bool implementSenseObstacles(mrpt::system::TTimeStamp &obs_timestamp) MRPT_OVERRIDE;
98  protected:
99  mrpt::math::CPolygon m_robotShape; //!< The robot 2D shape model. Only one of `robot_shape` or `robot_shape_circular_radius` will be used in each PTG
100  double m_robotShapeCircularRadius; //!< Radius of the robot if approximated as a circle. Only one of `robot_shape` or `robot_shape_circular_radius` will be used in each PTG
101 
102  /** Generates a pointcloud of obstacles, and the robot shape, to be saved in the logging record for the current timestep */
103  virtual void loggingGetWSObstaclesAndShape(CLogFileRecord &out_log) MRPT_OVERRIDE;
104 
105  mrpt::maps::CSimplePointsMap m_WS_Obstacles; //!< The obstacle points, as seen from the local robot frame.
106  mrpt::maps::CSimplePointsMap m_WS_Obstacles_original; //!< Obstacle points, before filtering (if filtering is enabled).
107  // See docs in parent class
108  void STEP3_WSpaceToTPSpace(const size_t ptg_idx, std::vector<double> &out_TPObstacles, mrpt::nav::ClearanceDiagram &out_clearance, const mrpt::math::TPose2D &rel_pose_PTG_origin_wrt_sense, const bool eval_clearance) MRPT_OVERRIDE;
109 
110  }; // end class
111  }
112 }
113 
114 
115 #endif
116 
117 
118 
119 
120 
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:30
std::vector< CParameterizedTrajectoryGenerator * > PTGs
The list of PTGs to use for navigation.
virtual size_t getPTG_count() const MRPT_OVERRIDE
Returns the number of different PTGs that have been setup.
#define MRPT_MAKE_ALIGNED_OPERATOR_NEW
Definition: memory.h:112
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
A wrapper of a TPolygon2D class, implementing CSerializable.
Definition: CPolygon.h:25
Clearance information for one particular PTG and one set of obstacles.
STL namespace.
A class for storing, saving and loading a reactive navigation log record for the CReactiveNavigationS...
GLdouble s
Definition: glext.h:3602
This class allows loading and storing values and vectors of different types from a configuration text...
virtual const CParameterizedTrajectoryGenerator * getPTG(size_t i) const MRPT_OVERRIDE
Gets the i&#39;th PTG.
This is the base class for any user-defined PTG.
const GLubyte * c
Definition: glext.h:5590
virtual CParameterizedTrajectoryGenerator * getPTG(size_t i) MRPT_OVERRIDE
Gets the i&#39;th PTG.
Base class for reactive navigator systems based on TP-Space, with an arbitrary holonomic reactive met...
GLsizei const GLchar ** string
Definition: glext.h:3919
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
const float R
Lightweight 2D pose.
#define ASSERT_(f)
See base class CAbstractPTGBasedReactive for a description and instructions of use.
The pure virtual interface between a real or simulated robot and any CAbstractNavigator-derived class...
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020