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-2018, 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::nav
15 {
16 /** \defgroup nav_reactive Reactive navigation classes
17  * \ingroup mrpt_nav_grp
18  */
19 
20 /** See base class CAbstractPTGBasedReactive for a description and instructions
21 * of use.
22 * This particular implementation assumes a 2D robot shape which can be polygonal
23 * or circular (depending on the selected PTGs).
24 *
25 * Publications:
26 * - Blanco, Jose-Luis, Javier Gonzalez, and Juan-Antonio Fernandez-Madrigal.
27 * ["Extending obstacle avoidance methods through multiple parameter-space
28 * transformations"](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.190.4672&rep=rep1&type=pdf).
29 * Autonomous Robots 24.1 (2008): 29-48.
30 *
31 * Class history:
32 * - 17/JUN/2004: First design.
33 * - 16/SEP/2004: Totally redesigned, according to document "MultiParametric
34 * Based Space Transformation for Reactive Navigation"
35 * - 29/SEP/2005: Totally rewritten again, for integration into MRPT library and
36 * according to the ICRA paper.
37 * - 17/OCT/2007: Whole code updated to accomodate to MRPT 0.5 and make it
38 * portable to Linux.
39 * - DEC/2013: Code refactoring between this class and
40 * CAbstractHolonomicReactiveMethod
41 * - FEB/2017: Refactoring of all parameters for a consistent organization in
42 * sections by class names (MRPT 1.5.0)
43 *
44 * This class requires a number of parameters which are usually provided via an
45 * external config (".ini") file.
46 * Alternatively, a memory-only object can be used to avoid physical files, see
47 * mrpt::config::CConfigFileMemory.
48 *
49 * A template config file can be generated at any moment by the user by calling
50 * saveConfigFile() with a default-constructed object.
51 *
52 * Next we provide a self-documented template config file; or see it online:
53 * https://github.com/MRPT/mrpt/blob/master/share/mrpt/config_files/navigation-ptgs/reactive2d_config.ini
54 * \verbinclude reactive2d_config.ini
55 *
56 * \sa CAbstractNavigator, CParameterizedTrajectoryGenerator,
57 * CAbstractHolonomicReactiveMethod
58 * \ingroup nav_reactive
59 */
61 {
62  public:
64  public:
65  /** See docs in ctor of base class */
67  CRobot2NavInterface& react_iterf_impl, bool enableConsoleOutput = true,
68  bool enableLogFile = false, const std::string& logFileDirectory =
69  std::string("./reactivenav.logs"));
70 
71  /** Destructor
72  */
74 
75  /** Defines the 2D polygonal robot shape, used for some PTGs for collision
76  * checking. */
77  void changeRobotShape(const mrpt::math::CPolygon& shape);
78  /** Defines the 2D circular robot shape radius, used for some PTGs for
79  * collision checking. */
80  void changeRobotCircularShapeRadius(const double R);
81 
82  // See base class docs:
83  virtual size_t getPTG_count() const override { return PTGs.size(); }
84  virtual CParameterizedTrajectoryGenerator* getPTG(size_t i) override
85  {
86  ASSERT_(i < PTGs.size());
87  return PTGs[i];
88  }
90  size_t i) const override
91  {
92  ASSERT_(i < PTGs.size());
93  return PTGs[i];
94  }
96  const mrpt::math::TPose2D& relative_robot_pose) const override;
97 
99  {
101  max_obstacles_height; // The range of "z" coordinates for obstacles
102  // to be considered
103 
104  virtual void loadFromConfigFile(
106  const std::string& s) override;
107  virtual void saveToConfigFile(
109  const std::string& s) const override;
111  };
112 
114 
115  virtual void loadConfigFile(const mrpt::config::CConfigFileBase& c)
116  override; // See base class docs!
118  const override; // See base class docs!
119 
120  private:
121  /** The list of PTGs to use for navigation */
122  std::vector<CParameterizedTrajectoryGenerator*> PTGs;
123 
124  // Steps for the reactive navigation sytem.
125  // ----------------------------------------------------------------------------
126  virtual void STEP1_InitPTGs() override;
127 
128  // See docs in parent class
130  mrpt::system::TTimeStamp& obs_timestamp) override;
131 
132  protected:
133  /** The robot 2D shape model. Only one of `robot_shape` or
134  * `robot_shape_circular_radius` will be used in each PTG */
136  /** Radius of the robot if approximated as a circle. Only one of
137  * `robot_shape` or `robot_shape_circular_radius` will be used in each PTG
138  */
140 
141  /** Generates a pointcloud of obstacles, and the robot shape, to be saved in
142  * the logging record for the current timestep */
143  virtual void loggingGetWSObstaclesAndShape(
144  CLogFileRecord& out_log) override;
145 
146  /** The obstacle points, as seen from the local robot frame. */
148  /** Obstacle points, before filtering (if filtering is enabled). */
150  // See docs in parent class
152  const size_t ptg_idx, std::vector<double>& out_TPObstacles,
153  mrpt::nav::ClearanceDiagram& out_clearance,
154  const mrpt::math::TPose2D& rel_pose_PTG_origin_wrt_sense,
155  const bool eval_clearance) override;
156 
157 }; // end class
158 }
159 #endif
160 
161 
std::vector< CParameterizedTrajectoryGenerator * > PTGs
The list of PTGs to use for navigation.
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
mrpt::maps::CSimplePointsMap m_WS_Obstacles
The obstacle points, as seen from the local robot frame.
void changeRobotCircularShapeRadius(const double R)
Defines the 2D circular robot shape radius, used for some PTGs for collision checking.
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:19
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.
#define MRPT_MAKE_ALIGNED_OPERATOR_NEW
Put this macro inside any class with members that require {16,32,64}-byte memory alignment (e...
A class for storing, saving and loading a reactive navigation log record for the CReactiveNavigationS...
GLdouble s
Definition: glext.h:3676
virtual void loadConfigFile(const mrpt::config::CConfigFileBase &c) override
Loads all params from a file.
#define ASSERT_(f)
Defines an assertion mechanism.
Definition: exceptions.h:113
mrpt::Clock::time_point TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:40
This is the base class for any user-defined PTG.
This class allows loading and storing values and vectors of different types from a configuration text...
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...
virtual void saveToConfigFile(mrpt::config::CConfigFileBase &c, const std::string &s) const override
This method saves the options to a ".ini"-like file or memory-stored string list. ...
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::config::CConfigFileBase &c, const std::string &s) override
This method load the options from a ".ini"-like file or memory-stored string list.
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.
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 void saveConfigFile(mrpt::config::CConfigFileBase &c) const override
Saves all current options to a config file.
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.
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020