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-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 CAbstractHolonomicReactiveMethod_H
10 #define CAbstractHolonomicReactiveMethod_H
11 
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  */
34 {
36  public:
37  /** Input parameters for CAbstractHolonomicReactiveMethod::navigate() */
38  struct NavInput
39  {
40  /** Distance to obstacles in polar coordinates, relative to the robot.
41  * First index refers to -PI direction, and last one to +PI direction.
42  * Distances can be dealed as "meters", although when used inside the
43  * PTG-based navigation system, they are "pseudometers", normalized to
44  * the range [0,1].
45  */
46  std::vector<double> obstacles;
47  /** Relative location (x,y) of target point(s). In the same units than
48  * `obstacles`. If many, last targets have higher priority. */
49  std::vector<mrpt::math::TPoint2D> targets;
50  /** Maximum robot speed, in the same units than `obstacles`, per second.
51  */
52  double maxRobotSpeed;
53  /** Maximum expected value to be found in `obstacles`. Typically, values
54  * in `obstacles` larger or equal to this value mean there is no visible
55  * obstacle in that direction. */
57  /** The computed clearance for each direction (optional in some
58  * implementations). Leave to default (NULL) if not needed. */
60 
61  NavInput();
62  };
63 
64  /** Output for CAbstractHolonomicReactiveMethod::navigate() */
65  struct NavOutput
66  {
67  /** The desired motion direction, in the range [-PI, PI] */
69  /** The desired motion speed in that direction, from 0 up to
70  * NavInput::maxRobotSpeed */
71  double desiredSpeed;
72 
73  /** The navigation method will create a log record and store it here via
74  * a smart pointer. Input value is ignored. */
76 
77  NavOutput();
78  };
79 
81  const std::string& className) noexcept;
82 
83  /** Invokes the holonomic navigation algorithm itself. See the description
84  * of the input/output structures for details on each parameter. */
85  virtual void navigate(const NavInput& ni, NavOutput& no) = 0;
86 
87  /** ctor */
88  CAbstractHolonomicReactiveMethod(const std::string& defaultCfgSectionName);
89  /** virtual dtor */
91 
92  /** Initialize the parameters of the navigator, reading from the default
93  * section name (see derived classes) or the one set via
94  * setConfigFileSectionName() */
95  virtual void initialize(const mrpt::config::CConfigFileBase& c) = 0;
96  /** saves all available parameters, in a forma loadable by `initialize()` */
97  virtual void saveConfigFile(mrpt::config::CConfigFileBase& c) const = 0;
98  /** Defines the name of the section used in initialize() */
99  void setConfigFileSectionName(const std::string& sectName);
100  /** Gets the name of the section used in initialize() */
102 
103  /** Returns the actual value of this parameter [m], as set via the children
104  * class options structure. \sa setTargetApproachSlowDownDistance() */
105  virtual double getTargetApproachSlowDownDistance() const = 0;
106  /** Sets the actual value of this parameter [m]. \sa
107  * getTargetApproachSlowDownDistance() */
108  virtual void setTargetApproachSlowDownDistance(const double dist) = 0;
109 
110  /** Class factory from class name, e.g. `"CHolonomicVFF"`, etc.
111  * \exception std::logic_error On invalid or missing parameters. */
113  const std::string& className) noexcept;
114 
115  /** Optionally, sets the associated PTG, just in case a derived class
116  * requires this info (not required for methods where the robot kinematics
117  * are totally abstracted) */
119  /** Returns the pointer set by setAssociatedPTG() */
121 
123  {
125  }
126 
127  protected:
128  /** If applicable, this will contain the argument of the most recent call to
129  * setAssociatedPTG() */
131  /** Whether to decrease speed when approaching target */
133 
134  private:
135  /** used in setConfigFileSectionName(), initialize() */
137 };
138 /** @} */
139 }
140 }
141 
142 #endif
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.
std::vector< mrpt::math::TPoint2D > targets
Relative location (x,y) of target point(s).
#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.
This class allows loading and storing values and vectors of different types from a configuration text...
virtual void saveConfigFile(mrpt::config::CConfigFileBase &c) const =0
saves all available parameters, in a forma loadable by initialize()
const GLubyte * c
Definition: glext.h:6313
double desiredDirection
The desired motion direction, in the range [-PI, PI].
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() ...
virtual void initialize(const mrpt::config::CConfigFileBase &c)=0
Initialize the parameters of the navigator, reading from the default section name (see derived classe...
static CAbstractHolonomicReactiveMethod::Ptr Factory(const std::string &className) noexcept
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:32
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: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019