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-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
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::config::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::config::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
mrpt::nav::CLogFileRecord
A class for storing, saving and loading a reactive navigation log record for the CReactiveNavigationS...
Definition: CLogFileRecord.h:32
CAbstractPTGBasedReactive.h
mrpt::nav::CAbstractPTGBasedReactive
Base class for reactive navigator systems based on TP-Space, with an arbitrary holonomic reactive met...
Definition: CAbstractPTGBasedReactive.h:95
s
GLdouble s
Definition: glext.h:3676
mrpt::nav::CReactiveNavigationSystem::getPTG
virtual CParameterizedTrajectoryGenerator * getPTG(size_t i) override
Gets the i'th PTG.
Definition: CReactiveNavigationSystem.h:86
mrpt::nav::CReactiveNavigationSystem::~CReactiveNavigationSystem
virtual ~CReactiveNavigationSystem()
Destructor.
Definition: CReactiveNavigationSystem.cpp:36
c
const GLubyte * c
Definition: glext.h:6313
mrpt::nav::CReactiveNavigationSystem::PTGs
std::vector< CParameterizedTrajectoryGenerator * > PTGs
The list of PTGs to use for navigation.
Definition: CReactiveNavigationSystem.h:124
mrpt::nav::CAbstractPTGBasedReactive::enableLogFile
void enableLogFile(bool enable)
Enables/disables saving log files.
Definition: CAbstractPTGBasedReactive.cpp:132
mrpt::nav::CReactiveNavigationSystem::saveConfigFile
virtual void saveConfigFile(mrpt::config::CConfigFileBase &c) const override
Saves all current options to a config file.
Definition: CReactiveNavigationSystem.cpp:64
mrpt::nav::CReactiveNavigationSystem::params_reactive_nav
TReactiveNavigatorParams params_reactive_nav
Definition: CReactiveNavigationSystem.h:115
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::nav::CReactiveNavigationSystem::m_robotShape
mrpt::math::CPolygon m_robotShape
The robot 2D shape model.
Definition: CReactiveNavigationSystem.h:137
mrpt::nav::CReactiveNavigationSystem::TReactiveNavigatorParams::max_obstacles_height
double max_obstacles_height
Definition: CReactiveNavigationSystem.h:103
mrpt::nav::CReactiveNavigationSystem::m_WS_Obstacles_original
mrpt::maps::CSimplePointsMap m_WS_Obstacles_original
Obstacle points, before filtering (if filtering is enabled).
Definition: CReactiveNavigationSystem.h:151
mrpt::nav::CRobot2NavInterface
The pure virtual interface between a real or simulated robot and any CAbstractNavigator-derived class...
Definition: CRobot2NavInterface.h:44
R
const float R
Definition: CKinematicChain.cpp:138
ASSERT_
#define ASSERT_(f)
Defines an assertion mechanism.
Definition: exceptions.h:113
mrpt::system::TTimeStamp
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1,...
Definition: datetime.h:31
mrpt::nav::CReactiveNavigationSystem::STEP3_WSpaceToTPSpace
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.
Definition: CReactiveNavigationSystem.cpp:224
mrpt::nav::CReactiveNavigationSystem::changeRobotCircularShapeRadius
void changeRobotCircularShapeRadius(const double R)
Defines the 2D circular robot shape radius, used for some PTGs for collision checking.
Definition: CReactiveNavigationSystem.cpp:57
mrpt::nav::CReactiveNavigationSystem::m_robotShapeCircularRadius
double m_robotShapeCircularRadius
Radius of the robot if approximated as a circle.
Definition: CReactiveNavigationSystem.h:141
mrpt::nav::CReactiveNavigationSystem::loadConfigFile
virtual void loadConfigFile(const mrpt::config::CConfigFileBase &c) override
Loads all params from a file.
Definition: CReactiveNavigationSystem.cpp:76
mrpt::nav::CReactiveNavigationSystem::TReactiveNavigatorParams::TReactiveNavigatorParams
TReactiveNavigatorParams()
Definition: CReactiveNavigationSystem.cpp:302
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
mrpt::nav::CReactiveNavigationSystem::TReactiveNavigatorParams::saveToConfigFile
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.
Definition: CReactiveNavigationSystem.cpp:289
mrpt::nav::ClearanceDiagram
Clearance information for one particular PTG and one set of obstacles.
Definition: ClearanceDiagram.h:30
mrpt::config::CLoadableOptions
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
Definition: config/CLoadableOptions.h:28
mrpt::math::TPose2D
Lightweight 2D pose.
Definition: lightweight_geom_data.h:186
mrpt::maps::CSimplePointsMap
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans.
Definition: CSimplePointsMap.h:31
mrpt::nav::CReactiveNavigationSystem::loggingGetWSObstaclesAndShape
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...
Definition: CReactiveNavigationSystem.cpp:264
mrpt::nav::CReactiveNavigationSystem::CReactiveNavigationSystem
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.
Definition: CReactiveNavigationSystem.cpp:26
mrpt::nav::CReactiveNavigationSystem::checkCollisionWithLatestObstacles
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),...
Definition: CReactiveNavigationSystem.cpp:307
mrpt::nav::CReactiveNavigationSystem::STEP1_InitPTGs
virtual void STEP1_InitPTGs() override
Definition: CReactiveNavigationSystem.cpp:137
mrpt::nav::CReactiveNavigationSystem::getPTG
virtual const CParameterizedTrajectoryGenerator * getPTG(size_t i) const override
Gets the i'th PTG.
Definition: CReactiveNavigationSystem.h:91
mrpt::math::CPolygon
A wrapper of a TPolygon2D class, implementing CSerializable.
Definition: CPolygon.h:21
mrpt::nav::CReactiveNavigationSystem::implementSenseObstacles
bool implementSenseObstacles(mrpt::system::TTimeStamp &obs_timestamp) override
Return false on any fatal error.
Definition: CReactiveNavigationSystem.cpp:184
mrpt::nav::CReactiveNavigationSystem
See base class CAbstractPTGBasedReactive for a description and instructions of use.
Definition: CReactiveNavigationSystem.h:62
mrpt::nav::CReactiveNavigationSystem::TReactiveNavigatorParams::loadFromConfigFile
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.
Definition: CReactiveNavigationSystem.cpp:282
mrpt::nav::CReactiveNavigationSystem::m_WS_Obstacles
mrpt::maps::CSimplePointsMap m_WS_Obstacles
The obstacle points, as seen from the local robot frame.
Definition: CReactiveNavigationSystem.h:149
MRPT_MAKE_ALIGNED_OPERATOR_NEW
#define MRPT_MAKE_ALIGNED_OPERATOR_NEW
Put this macro inside any class with members that require {16,32,64}-byte memory alignment (e....
Definition: aligned_allocator.h:90
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::nav::CReactiveNavigationSystem::getPTG_count
virtual size_t getPTG_count() const override
Returns the number of different PTGs that have been setup.
Definition: CReactiveNavigationSystem.h:85
mrpt::nav::CReactiveNavigationSystem::TReactiveNavigatorParams
Definition: CReactiveNavigationSystem.h:100
mrpt::nav::CReactiveNavigationSystem::TReactiveNavigatorParams::min_obstacles_height
double min_obstacles_height
Definition: CReactiveNavigationSystem.h:102
mrpt::nav::CParameterizedTrajectoryGenerator
This is the base class for any user-defined PTG.
Definition: CParameterizedTrajectoryGenerator.h:76
mrpt::nav::CReactiveNavigationSystem::changeRobotShape
void changeRobotShape(const mrpt::math::CPolygon &shape)
Defines the 2D polygonal robot shape, used for some PTGs for collision checking.
Definition: CReactiveNavigationSystem.cpp:48



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST