Main MRPT website > C++ reference for MRPT 1.9.9
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
23 * of use.
24 * This particular implementation assumes a 2D robot shape which can be polygonal
25 * or circular (depending on the selected PTGs).
26 *
27 * Publications:
28 * - Blanco, Jose-Luis, Javier Gonzalez, and Juan-Antonio Fernandez-Madrigal.
29 * ["Extending obstacle avoidance methods through multiple parameter-space
30 * transformations"](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.190.4672&rep=rep1&type=pdf).
31 * Autonomous Robots 24.1 (2008): 29-48.
32 *
33 * Class history:
34 * - 17/JUN/2004: First design.
35 * - 16/SEP/2004: Totally redesigned, according to document "MultiParametric
36 * Based Space Transformation for Reactive Navigation"
37 * - 29/SEP/2005: Totally rewritten again, for integration into MRPT library and
38 * according to the ICRA paper.
39 * - 17/OCT/2007: Whole code updated to accomodate to MRPT 0.5 and make it
40 * portable to Linux.
41 * - DEC/2013: Code refactoring between this class and
42 * CAbstractHolonomicReactiveMethod
43 * - FEB/2017: Refactoring of all parameters for a consistent organization in
44 * sections by class names (MRPT 1.5.0)
45 *
46 * This class requires a number of parameters which are usually provided via an
47 * external config (".ini") file.
48 * Alternatively, a memory-only object can be used to avoid physical files, see
49 * mrpt::utils::CConfigFileMemory.
50 *
51 * A template config file can be generated at any moment by the user by calling
52 * saveConfigFile() with a default-constructed object.
53 *
54 * Next we provide a self-documented template config file; or see it online:
55 * https://github.com/MRPT/mrpt/blob/master/share/mrpt/config_files/navigation-ptgs/reactive2d_config.ini
56 * \verbinclude reactive2d_config.ini
57 *
58 * \sa CAbstractNavigator, CParameterizedTrajectoryGenerator,
59 * CAbstractHolonomicReactiveMethod
60 * \ingroup nav_reactive
61 */
63 {
64  public:
66  public:
67  /** See docs in ctor of base class */
69  CRobot2NavInterface& react_iterf_impl, bool enableConsoleOutput = true,
70  bool enableLogFile = false, const std::string& logFileDirectory =
71  std::string("./reactivenav.logs"));
72 
73  /** Destructor
74  */
76 
77  /** Defines the 2D polygonal robot shape, used for some PTGs for collision
78  * checking. */
79  void changeRobotShape(const mrpt::math::CPolygon& shape);
80  /** Defines the 2D circular robot shape radius, used for some PTGs for
81  * collision checking. */
82  void changeRobotCircularShapeRadius(const double R);
83 
84  // See base class docs:
85  virtual size_t getPTG_count() const override { return PTGs.size(); }
86  virtual CParameterizedTrajectoryGenerator* getPTG(size_t i) override
87  {
88  ASSERT_(i < PTGs.size());
89  return PTGs[i];
90  }
92  size_t i) const override
93  {
94  ASSERT_(i < PTGs.size());
95  return PTGs[i];
96  }
98  const mrpt::math::TPose2D& relative_robot_pose) const override;
99 
101  {
103  max_obstacles_height; // The range of "z" coordinates for obstacles
104  // to be considered
105 
106  virtual void loadFromConfigFile(
108  const std::string& s) override;
109  virtual void saveToConfigFile(
111  const std::string& s) const override;
113  };
114 
116 
117  virtual void loadConfigFile(const mrpt::utils::CConfigFileBase& c)
118  override; // See base class docs!
120  const override; // See base class docs!
121 
122  private:
123  /** The list of PTGs to use for navigation */
124  std::vector<CParameterizedTrajectoryGenerator*> PTGs;
125 
126  // Steps for the reactive navigation sytem.
127  // ----------------------------------------------------------------------------
128  virtual void STEP1_InitPTGs() override;
129 
130  // See docs in parent class
132  mrpt::system::TTimeStamp& obs_timestamp) override;
133 
134  protected:
135  /** The robot 2D shape model. Only one of `robot_shape` or
136  * `robot_shape_circular_radius` will be used in each PTG */
138  /** Radius of the robot if approximated as a circle. Only one of
139  * `robot_shape` or `robot_shape_circular_radius` will be used in each PTG
140  */
142 
143  /** Generates a pointcloud of obstacles, and the robot shape, to be saved in
144  * the logging record for the current timestep */
145  virtual void loggingGetWSObstaclesAndShape(
146  CLogFileRecord& out_log) override;
147 
148  /** The obstacle points, as seen from the local robot frame. */
150  /** Obstacle points, before filtering (if filtering is enabled). */
152  // See docs in parent class
154  const size_t ptg_idx, std::vector<double>& out_TPObstacles,
155  mrpt::nav::ClearanceDiagram& out_clearance,
156  const mrpt::math::TPose2D& rel_pose_PTG_origin_wrt_sense,
157  const bool eval_clearance) override;
158 
159 }; // end class
160 }
161 }
162 
163 #endif
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:32
std::vector< CParameterizedTrajectoryGenerator * > PTGs
The list of PTGs to use for navigation.
mrpt::maps::CSimplePointsMap m_WS_Obstacles
The obstacle points, as seen from the local robot frame.
#define MRPT_MAKE_ALIGNED_OPERATOR_NEW
Definition: memory.h:134
void changeRobotCircularShapeRadius(const double R)
Defines the 2D circular robot shape radius, used for some PTGs for collision checking.
virtual void loadConfigFile(const mrpt::utils::CConfigFileBase &c) override
Loads all params from a file.
mrpt::maps::CSimplePointsMap m_WS_Obstacles_original
Obstacle points, before filtering (if filtering is enabled).
void enableLogFile(bool enable)
Enables/disables saving log files.
A wrapper of a TPolygon2D class, implementing CSerializable.
Definition: CPolygon.h:22
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
Clearance information for one particular PTG and one set of obstacles.
A class for storing, saving and loading a reactive navigation log record for the CReactiveNavigationS...
GLdouble s
Definition: glext.h:3676
This class allows loading and storing values and vectors of different types from a configuration text...
virtual void saveToConfigFile(mrpt::utils::CConfigFileBase &c, const std::string &s) const override
This method saves the options to a ".ini"-like file or memory-stored string list. ...
This is the base class for any user-defined PTG.
virtual void loggingGetWSObstaclesAndShape(CLogFileRecord &out_log) override
Generates a pointcloud of obstacles, and the robot shape, to be saved in the logging record for the c...
const GLubyte * c
Definition: glext.h:6313
Base class for reactive navigator systems based on TP-Space, with an arbitrary holonomic reactive met...
virtual CParameterizedTrajectoryGenerator * getPTG(size_t i) override
Gets the i&#39;th PTG.
GLsizei const GLchar ** string
Definition: glext.h:4101
virtual const CParameterizedTrajectoryGenerator * getPTG(size_t i) const override
Gets the i&#39;th PTG.
virtual void loadFromConfigFile(const mrpt::utils::CConfigFileBase &c, const std::string &s) override
This method load the options from a ".ini"-like file or memory-stored string list.
virtual void saveConfigFile(mrpt::utils::CConfigFileBase &c) const override
Saves all current options to a config file.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void changeRobotShape(const mrpt::math::CPolygon &shape)
Defines the 2D polygonal robot shape, used for some PTGs for collision checking.
const float R
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) override
Builds TP-Obstacles from Workspace obstacles for the given PTG.
Lightweight 2D pose.
#define ASSERT_(f)
double m_robotShapeCircularRadius
Radius of the robot if approximated as a circle.
virtual size_t getPTG_count() const override
Returns the number of different PTGs that have been setup.
See base class CAbstractPTGBasedReactive for a description and instructions of use.
virtual bool checkCollisionWithLatestObstacles(const mrpt::math::TPose2D &relative_robot_pose) const override
Checks whether the robot shape, when placed at the given pose (relative to the current pose)...
The pure virtual interface between a real or simulated robot and any CAbstractNavigator-derived class...
mrpt::math::CPolygon m_robotShape
The robot 2D shape model.
CReactiveNavigationSystem(CRobot2NavInterface &react_iterf_impl, bool enableConsoleOutput=true, bool enableLogFile=false, const std::string &logFileDirectory=std::string("./reactivenav.logs"))
See docs in ctor of base class.
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
bool implementSenseObstacles(mrpt::system::TTimeStamp &obs_timestamp) override
Return false on any fatal error.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019