Main MRPT website > C++ reference for MRPT 1.9.9
CAbstractHolonomicReactiveMethod.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 CAbstractHolonomicReactiveMethod_H
10 #define CAbstractHolonomicReactiveMethod_H
11 
13 #include <mrpt/utils/TEnumType.h>
18 
20 
21 namespace mrpt
22 {
23 namespace nav
24 {
25 /** \addtogroup nav_holo Holonomic navigation methods
26  * \ingroup mrpt_nav_grp
27  * @{ */
28 
29 /** A base class for holonomic reactive navigation methods.
30  * \sa CHolonomicVFF,CHolonomicND,CHolonomicFullEval, CReactiveNavigationSystem
31  */
33 {
35  public:
36  /** Input parameters for CAbstractHolonomicReactiveMethod::navigate() */
37  struct NavInput
38  {
39  /** Distance to obstacles in polar coordinates, relative to the robot.
40  * First index refers to -PI direction, and last one to +PI direction.
41  * Distances can be dealed as "meters", although when used inside the
42  * PTG-based navigation system, they are "pseudometers", normalized to
43  * the range [0,1].
44  */
45  std::vector<double> obstacles;
46  /** Relative location (x,y) of target point(s). In the same units than
47  * `obstacles`. If many, last targets have higher priority. */
48  std::vector<mrpt::math::TPoint2D> targets;
49  /** Maximum robot speed, in the same units than `obstacles`, per second.
50  */
51  double maxRobotSpeed;
52  /** Maximum expected value to be found in `obstacles`. Typically, values
53  * in `obstacles` larger or equal to this value mean there is no visible
54  * obstacle in that direction. */
56  /** The computed clearance for each direction (optional in some
57  * implementations). Leave to default (NULL) if not needed. */
59 
60  NavInput();
61  };
62 
63  /** Output for CAbstractHolonomicReactiveMethod::navigate() */
64  struct NavOutput
65  {
66  /** The desired motion direction, in the range [-PI, PI] */
68  /** The desired motion speed in that direction, from 0 up to
69  * NavInput::maxRobotSpeed */
70  double desiredSpeed;
71 
72  /** The navigation method will create a log record and store it here via
73  * a smart pointer. Input value is ignored. */
75 
76  NavOutput();
77  };
78 
80  const std::string& className) noexcept;
81 
82  /** Invokes the holonomic navigation algorithm itself. See the description
83  * of the input/output structures for details on each parameter. */
84  virtual void navigate(const NavInput& ni, NavOutput& no) = 0;
85 
86  /** ctor */
87  CAbstractHolonomicReactiveMethod(const std::string& defaultCfgSectionName);
88  /** virtual dtor */
90 
91  /** Initialize the parameters of the navigator, reading from the default
92  * section name (see derived classes) or the one set via
93  * setConfigFileSectionName() */
94  virtual void initialize(const mrpt::utils::CConfigFileBase& c) = 0;
95  /** saves all available parameters, in a forma loadable by `initialize()` */
96  virtual void saveConfigFile(mrpt::utils::CConfigFileBase& c) const = 0;
97  /** Defines the name of the section used in initialize() */
98  void setConfigFileSectionName(const std::string& sectName);
99  /** Gets the name of the section used in initialize() */
101 
102  /** Returns the actual value of this parameter [m], as set via the children
103  * class options structure. \sa setTargetApproachSlowDownDistance() */
104  virtual double getTargetApproachSlowDownDistance() const = 0;
105  /** Sets the actual value of this parameter [m]. \sa
106  * getTargetApproachSlowDownDistance() */
107  virtual void setTargetApproachSlowDownDistance(const double dist) = 0;
108 
109  /** Class factory from class name, e.g. `"CHolonomicVFF"`, etc.
110  * \exception std::logic_error On invalid or missing parameters. */
112  const std::string& className) noexcept;
113 
114  /** Optionally, sets the associated PTG, just in case a derived class
115  * requires this info (not required for methods where the robot kinematics
116  * are totally abstracted) */
118  /** Returns the pointer set by setAssociatedPTG() */
120 
122  {
124  }
125 
126  protected:
127  /** If applicable, this will contain the argument of the most recent call to
128  * setAssociatedPTG() */
130  /** Whether to decrease speed when approaching target */
132 
133  private:
134  /** used in setConfigFileSectionName(), initialize() */
136 };
137 /** @} */
138 }
139 }
140 
141 #endif
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:44
void setAssociatedPTG(mrpt::nav::CParameterizedTrajectoryGenerator *ptg)
Optionally, sets the associated PTG, just in case a derived class requires this info (not required fo...
std::vector< double > obstacles
Distance to obstacles in polar coordinates, relative to the robot.
A base class for holonomic reactive navigation methods.
CAbstractHolonomicReactiveMethod(const std::string &defaultCfgSectionName)
ctor
Clearance information for one particular PTG and one set of obstacles.
bool m_enableApproachTargetSlowDown
Whether to decrease speed when approaching target.
virtual void saveConfigFile(mrpt::utils::CConfigFileBase &c) const =0
saves all available parameters, in a forma loadable by initialize()
std::vector< mrpt::math::TPoint2D > targets
Relative location (x,y) of target point(s).
This class allows loading and storing values and vectors of different types from a configuration text...
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
double maxRobotSpeed
Maximum robot speed, in the same units than obstacles, per second.
This is the base class for any user-defined PTG.
std::shared_ptr< CHolonomicLogFileRecord > Ptr
virtual void initialize(const mrpt::utils::CConfigFileBase &c)=0
Initialize the parameters of the navigator, reading from the default section name (see derived classe...
const GLubyte * c
Definition: glext.h:6313
double desiredDirection
The desired motion direction, in the range [-PI, PI].
std::shared_ptr< CAbstractHolonomicReactiveMethod > Ptr
CHolonomicLogFileRecord::Ptr logRecord
The navigation method will create a log record and store it here via a smart pointer.
double maxObstacleDist
Maximum expected value to be found in obstacles.
GLsizei const GLchar ** string
Definition: glext.h:4101
double desiredSpeed
The desired motion speed in that direction, from 0 up to NavInput::maxRobotSpeed. ...
const mrpt::nav::ClearanceDiagram * clearance
The computed clearance for each direction (optional in some implementations).
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
mrpt::nav::CParameterizedTrajectoryGenerator * m_associatedPTG
If applicable, this will contain the argument of the most recent call to setAssociatedPTG() ...
static CAbstractHolonomicReactiveMethod::Ptr Factory(const std::string &className) noexcept
std::string getConfigFileSectionName() const
Gets the name of the section used in initialize()
virtual double getTargetApproachSlowDownDistance() const =0
Returns the actual value of this parameter [m], as set via the children class options structure...
std::string m_cfgSectionName
used in setConfigFileSectionName(), initialize()
virtual void navigate(const NavInput &ni, NavOutput &no)=0
Invokes the holonomic navigation algorithm itself.
Input parameters for CAbstractHolonomicReactiveMethod::navigate()
Output for CAbstractHolonomicReactiveMethod::navigate()
void setConfigFileSectionName(const std::string &sectName)
Defines the name of the section used in initialize()
virtual void setTargetApproachSlowDownDistance(const double dist)=0
Sets the actual value of this parameter [m].
static CAbstractHolonomicReactiveMethod * Create(const std::string &className) noexcept
Class factory from class name, e.g.
mrpt::nav::CParameterizedTrajectoryGenerator * getAssociatedPTG() const
Returns the pointer set by setAssociatedPTG()



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