MRPT  1.9.9
CReactiveNavigationSystem.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
12 
13 namespace mrpt::nav
14 {
15 /** \defgroup nav_reactive Reactive navigation classes
16  * \ingroup mrpt_nav_grp
17  */
18 
19 /** See base class CAbstractPTGBasedReactive for a description and instructions
20  * of use.
21  * This particular implementation assumes a 2D robot shape which can be
22  * polygonal or circular (depending on the selected PTGs).
23  *
24  * Publications:
25  * - Blanco, Jose-Luis, Javier Gonzalez, and Juan-Antonio Fernandez-Madrigal.
26  * ["Extending obstacle avoidance methods through multiple parameter-space
27  * transformations"](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.190.4672&rep=rep1&type=pdf).
28  * Autonomous Robots 24.1 (2008): 29-48.
29  *
30  * Class history:
31  * - 17/JUN/2004: First design.
32  * - 16/SEP/2004: Totally redesigned, according to document "MultiParametric
33  * Based Space Transformation for Reactive Navigation"
34  * - 29/SEP/2005: Totally rewritten again, for integration into MRPT library and
35  * according to the ICRA paper.
36  * - 17/OCT/2007: Whole code updated to accomodate to MRPT 0.5 and make it
37  * portable to Linux.
38  * - DEC/2013: Code refactoring between this class and
39  * CAbstractHolonomicReactiveMethod
40  * - FEB/2017: Refactoring of all parameters for a consistent organization in
41  * sections by class names (MRPT 1.5.0)
42  *
43  * This class requires a number of parameters which are usually provided via an
44  * external config (".ini") file.
45  * Alternatively, a memory-only object can be used to avoid physical files, see
46  * mrpt::config::CConfigFileMemory.
47  *
48  * A template config file can be generated at any moment by the user by calling
49  * saveConfigFile() with a default-constructed object.
50  *
51  * Next we provide a self-documented template config file; or see it online:
52  * https://github.com/MRPT/mrpt/blob/master/share/mrpt/config_files/navigation-ptgs/reactive2d_config.ini
53  * \verbinclude reactive2d_config.ini
54  *
55  * \sa CAbstractNavigator, CParameterizedTrajectoryGenerator,
56  * CAbstractHolonomicReactiveMethod
57  * \ingroup nav_reactive
58  */
60 {
61  public:
62  public:
63  /** See docs in ctor of base class */
65  CRobot2NavInterface& react_iterf_impl, bool enableConsoleOutput = true,
66  bool enableLogFile = false,
67  const std::string& logFileDirectory =
68  std::string("./reactivenav.logs"));
69 
70  /** Destructor
71  */
72  ~CReactiveNavigationSystem() override;
73 
74  /** Defines the 2D polygonal robot shape, used for some PTGs for collision
75  * checking. */
76  void changeRobotShape(const mrpt::math::CPolygon& shape);
77  /** Defines the 2D circular robot shape radius, used for some PTGs for
78  * collision checking. */
79  void changeRobotCircularShapeRadius(const double R);
80 
81  // See base class docs:
82  size_t getPTG_count() const override { return PTGs.size(); }
84  {
85  ASSERT_(i < PTGs.size());
86  return PTGs[i].get();
87  }
88  const CParameterizedTrajectoryGenerator* getPTG(size_t i) const override
89  {
90  ASSERT_(i < PTGs.size());
91  return PTGs[i].get();
92  }
94  const mrpt::math::TPose2D& relative_robot_pose) const override;
95 
97  {
98  double min_obstacles_height{0.0},
100  10.0}; // The range of "z" coordinates for obstacles
101  // to be considered
102 
103  void loadFromConfigFile(
105  const std::string& s) override;
106  void saveToConfigFile(
108  const std::string& s) const override;
110  };
111 
113 
115  override; // See base class docs!
117  const override; // See base class docs!
118 
119  private:
120  /** The list of PTGs to use for navigation */
121  std::vector<CParameterizedTrajectoryGenerator::Ptr> PTGs;
122 
123  // Steps for the reactive navigation sytem.
124  // ----------------------------------------------------------------------------
125  void STEP1_InitPTGs() override;
126 
127  // See docs in parent class
129  mrpt::system::TTimeStamp& obs_timestamp) override;
130 
131  protected:
132  /** The robot 2D shape model. Only one of `robot_shape` or
133  * `robot_shape_circular_radius` will be used in each PTG */
135  /** Radius of the robot if approximated as a circle. Only one of
136  * `robot_shape` or `robot_shape_circular_radius` will be used in each PTG
137  */
139 
140  /** Generates a pointcloud of obstacles, and the robot shape, to be saved in
141  * the logging record for the current timestep */
142  void loggingGetWSObstaclesAndShape(CLogFileRecord& out_log) override;
143 
144  /** The obstacle points, as seen from the local robot frame. */
146  /** Obstacle points, before filtering (if filtering is enabled). */
148  // See docs in parent class
150  const size_t ptg_idx, std::vector<double>& out_TPObstacles,
151  mrpt::nav::ClearanceDiagram& out_clearance,
152  const mrpt::math::TPose2D& rel_pose_PTG_origin_wrt_sense,
153  const bool eval_clearance) override;
154 
155 }; // end class
156 } // namespace mrpt::nav
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).
size_t getPTG_count() const override
Returns the number of different PTGs that have been setup.
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. ...
std::vector< CParameterizedTrajectoryGenerator::Ptr > PTGs
The list of PTGs to use for navigation.
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:3682
void loadConfigFile(const mrpt::config::CConfigFileBase &c) override
Loads all params from a file.
#define ASSERT_(f)
Defines an assertion mechanism.
Definition: exceptions.h:120
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...
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...
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:6406
Base class for reactive navigator systems based on TP-Space, with an arbitrary holonomic reactive met...
GLsizei const GLchar ** string
Definition: glext.h:4116
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.
CParameterizedTrajectoryGenerator * getPTG(size_t i) override
Gets the i&#39;th PTG.
const float R
const CParameterizedTrajectoryGenerator * getPTG(size_t i) const override
Gets the i&#39;th PTG.
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.
Definition: TPose2D.h:22
double m_robotShapeCircularRadius
Radius of the robot if approximated as a circle.
See base class CAbstractPTGBasedReactive for a description and instructions of use.
void saveConfigFile(mrpt::config::CConfigFileBase &c) const override
Saves all current options to a config file.
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: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019