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::nav
22 {
23 /** \addtogroup nav_holo Holonomic navigation methods
24  * \ingroup mrpt_nav_grp
25  * @{ */
26 
27 /** A base class for holonomic reactive navigation methods.
28  * \sa CHolonomicVFF,CHolonomicND,CHolonomicFullEval, CReactiveNavigationSystem
29  */
32 {
34  public:
35  /** Input parameters for CAbstractHolonomicReactiveMethod::navigate() */
36  struct NavInput
37  {
38  /** Distance to obstacles in polar coordinates, relative to the robot.
39  * First index refers to -PI direction, and last one to +PI direction.
40  * Distances can be dealed as "meters", although when used inside the
41  * PTG-based navigation system, they are "pseudometers", normalized to
42  * the range [0,1].
43  */
44  std::vector<double> obstacles;
45  /** Relative location (x,y) of target point(s). In the same units than
46  * `obstacles`. If many, last targets have higher priority. */
47  std::vector<mrpt::math::TPoint2D> targets;
48  /** Maximum robot speed, in the same units than `obstacles`, per second.
49  */
50  double maxRobotSpeed;
51  /** Maximum expected value to be found in `obstacles`. Typically, values
52  * in `obstacles` larger or equal to this value mean there is no visible
53  * obstacle in that direction. */
55  /** The computed clearance for each direction (optional in some
56  * implementations). Leave to default (NULL) if not needed. */
58 
59  NavInput();
60  };
61 
62  /** Output for CAbstractHolonomicReactiveMethod::navigate() */
63  struct NavOutput
64  {
65  /** The desired motion direction, in the range [-PI, PI] */
67  /** The desired motion speed in that direction, from 0 up to
68  * NavInput::maxRobotSpeed */
69  double desiredSpeed;
70 
71  /** The navigation method will create a log record and store it here via
72  * a smart pointer. Input value is ignored. */
74 
75  NavOutput();
76  };
77 
79  const std::string& className) noexcept;
80 
81  /** Invokes the holonomic navigation algorithm itself. See the description
82  * of the input/output structures for details on each parameter. */
83  virtual void navigate(const NavInput& ni, NavOutput& no) = 0;
84 
85  /** ctor */
86  CAbstractHolonomicReactiveMethod(const std::string& defaultCfgSectionName);
87  /** virtual dtor */
89 
90  /** Initialize the parameters of the navigator, reading from the default
91  * section name (see derived classes) or the one set via
92  * setConfigFileSectionName() */
93  virtual void initialize(const mrpt::config::CConfigFileBase& c) = 0;
94  /** saves all available parameters, in a forma loadable by `initialize()` */
95  virtual void saveConfigFile(mrpt::config::CConfigFileBase& c) const = 0;
96  /** Defines the name of the section used in initialize() */
97  void setConfigFileSectionName(const std::string& sectName);
98  /** Gets the name of the section used in initialize() */
100 
101  /** Returns the actual value of this parameter [m], as set via the children
102  * class options structure. \sa setTargetApproachSlowDownDistance() */
103  virtual double getTargetApproachSlowDownDistance() const = 0;
104  /** Sets the actual value of this parameter [m]. \sa
105  * getTargetApproachSlowDownDistance() */
106  virtual void setTargetApproachSlowDownDistance(const double dist) = 0;
107 
108  /** Class factory from class name, e.g. `"CHolonomicVFF"`, etc.
109  * \exception std::logic_error On invalid or missing parameters. */
111  const std::string& className) noexcept;
112 
113  /** Optionally, sets the associated PTG, just in case a derived class
114  * requires this info (not required for methods where the robot kinematics
115  * are totally abstracted) */
117  /** Returns the pointer set by setAssociatedPTG() */
119 
121  {
123  }
124 
125  protected:
126  /** If applicable, this will contain the argument of the most recent call to
127  * setAssociatedPTG() */
129  /** Whether to decrease speed when approaching target */
131 
132  private:
133  /** used in setConfigFileSectionName(), initialize() */
135 };
136 /** @} */
137 }
138 #endif
139 
140 
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).
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:30
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020