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
mrpt::nav::CAbstractHolonomicReactiveMethod::~CAbstractHolonomicReactiveMethod
virtual ~CAbstractHolonomicReactiveMethod()
virtual dtor
Definition: CAbstractHolonomicReactiveMethod.cpp:28
mrpt::nav::CAbstractHolonomicReactiveMethod::getAssociatedPTG
mrpt::nav::CParameterizedTrajectoryGenerator * getAssociatedPTG() const
Returns the pointer set by setAssociatedPTG()
Definition: CAbstractHolonomicReactiveMethod.cpp:46
CParameterizedTrajectoryGenerator.h
ClearanceDiagram.h
mrpt::nav::CAbstractHolonomicReactiveMethod::NavInput
Input parameters for CAbstractHolonomicReactiveMethod::navigate()
Definition: CAbstractHolonomicReactiveMethod.h:38
CHolonomicLogFileRecord.h
mrpt::nav::CHolonomicLogFileRecord::Ptr
std::shared_ptr< CHolonomicLogFileRecord > Ptr
Definition: CHolonomicLogFileRecord.h:29
mrpt::nav::CAbstractHolonomicReactiveMethod::NavOutput::logRecord
CHolonomicLogFileRecord::Ptr logRecord
The navigation method will create a log record and store it here via a smart pointer.
Definition: CAbstractHolonomicReactiveMethod.h:75
mrpt::nav::CAbstractHolonomicReactiveMethod::m_cfgSectionName
std::string m_cfgSectionName
used in setConfigFileSectionName(), initialize()
Definition: CAbstractHolonomicReactiveMethod.h:136
c
const GLubyte * c
Definition: glext.h:6313
mrpt::nav::CAbstractHolonomicReactiveMethod::NavInput::maxObstacleDist
double maxObstacleDist
Maximum expected value to be found in obstacles.
Definition: CAbstractHolonomicReactiveMethod.h:56
mrpt::nav::CAbstractHolonomicReactiveMethod::NavOutput::desiredDirection
double desiredDirection
The desired motion direction, in the range [-PI, PI].
Definition: CAbstractHolonomicReactiveMethod.h:68
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::nav::CAbstractHolonomicReactiveMethod::NavOutput::desiredSpeed
double desiredSpeed
The desired motion speed in that direction, from 0 up to NavInput::maxRobotSpeed.
Definition: CAbstractHolonomicReactiveMethod.h:71
mrpt::nav::CAbstractHolonomicReactiveMethod::initialize
virtual void initialize(const mrpt::config::CConfigFileBase &c)=0
Initialize the parameters of the navigator, reading from the default section name (see derived classe...
mrpt::nav::CAbstractHolonomicReactiveMethod::NavInput::NavInput
NavInput()
Definition: CAbstractHolonomicReactiveMethod.cpp:73
mrpt::nav::CAbstractHolonomicReactiveMethod::Ptr
std::shared_ptr< CAbstractHolonomicReactiveMethod > Ptr
Definition: CAbstractHolonomicReactiveMethod.h:35
lightweight_geom_data.h
mrpt::nav::CAbstractHolonomicReactiveMethod::NavInput::targets
std::vector< mrpt::math::TPoint2D > targets
Relative location (x,y) of target point(s).
Definition: CAbstractHolonomicReactiveMethod.h:49
mrpt::nav::CAbstractHolonomicReactiveMethod::NavInput::obstacles
std::vector< double > obstacles
Distance to obstacles in polar coordinates, relative to the robot.
Definition: CAbstractHolonomicReactiveMethod.h:46
CConfigFileBase.h
mrpt::nav::CAbstractHolonomicReactiveMethod
A base class for holonomic reactive navigation methods.
Definition: CAbstractHolonomicReactiveMethod.h:32
mrpt::nav::CAbstractHolonomicReactiveMethod::saveConfigFile
virtual void saveConfigFile(mrpt::config::CConfigFileBase &c) const =0
saves all available parameters, in a forma loadable by initialize()
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::ClearanceDiagram
Clearance information for one particular PTG and one set of obstacles.
Definition: ClearanceDiagram.h:30
mrpt::nav::CAbstractHolonomicReactiveMethod::m_enableApproachTargetSlowDown
bool m_enableApproachTargetSlowDown
Whether to decrease speed when approaching target.
Definition: CAbstractHolonomicReactiveMethod.h:132
mrpt::nav::CAbstractHolonomicReactiveMethod::enableApproachTargetSlowDown
void enableApproachTargetSlowDown(bool enable)
Definition: CAbstractHolonomicReactiveMethod.h:122
TEnumType.h
mrpt::serialization::CSerializable
The virtual base class which provides a unified interface for all persistent objects in MRPT.
Definition: CSerializable.h:32
mrpt::nav::CAbstractHolonomicReactiveMethod::NavOutput::NavOutput
NavOutput()
Definition: CAbstractHolonomicReactiveMethod.cpp:78
mrpt::nav::CAbstractHolonomicReactiveMethod::getTargetApproachSlowDownDistance
virtual double getTargetApproachSlowDownDistance() const =0
Returns the actual value of this parameter [m], as set via the children class options structure.
mrpt::nav::CAbstractHolonomicReactiveMethod::Factory
static CAbstractHolonomicReactiveMethod::Ptr Factory(const std::string &className) noexcept
Definition: CAbstractHolonomicReactiveMethod.cpp:51
DEFINE_VIRTUAL_SERIALIZABLE
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
Definition: CSerializable.h:119
mrpt::nav::CAbstractHolonomicReactiveMethod::setAssociatedPTG
void setAssociatedPTG(mrpt::nav::CParameterizedTrajectoryGenerator *ptg)
Optionally, sets the associated PTG, just in case a derived class requires this info (not required fo...
Definition: CAbstractHolonomicReactiveMethod.cpp:40
mrpt::nav::CAbstractHolonomicReactiveMethod::setTargetApproachSlowDownDistance
virtual void setTargetApproachSlowDownDistance(const double dist)=0
Sets the actual value of this parameter [m].
mrpt::nav::CAbstractHolonomicReactiveMethod::setConfigFileSectionName
void setConfigFileSectionName(const std::string &sectName)
Defines the name of the section used in initialize()
Definition: CAbstractHolonomicReactiveMethod.cpp:30
mrpt::nav::CAbstractHolonomicReactiveMethod::NavInput::maxRobotSpeed
double maxRobotSpeed
Maximum robot speed, in the same units than obstacles, per second.
Definition: CAbstractHolonomicReactiveMethod.h:52
mrpt::nav::CAbstractHolonomicReactiveMethod::CAbstractHolonomicReactiveMethod
CAbstractHolonomicReactiveMethod(const std::string &defaultCfgSectionName)
ctor
mrpt::nav::CAbstractHolonomicReactiveMethod::NavOutput
Output for CAbstractHolonomicReactiveMethod::navigate()
Definition: CAbstractHolonomicReactiveMethod.h:65
mrpt::nav::CAbstractHolonomicReactiveMethod::m_associatedPTG
mrpt::nav::CParameterizedTrajectoryGenerator * m_associatedPTG
If applicable, this will contain the argument of the most recent call to setAssociatedPTG()
Definition: CAbstractHolonomicReactiveMethod.h:130
mrpt::nav::CAbstractHolonomicReactiveMethod::Create
static CAbstractHolonomicReactiveMethod * Create(const std::string &className) noexcept
Class factory from class name, e.g.
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::nav::CAbstractHolonomicReactiveMethod::getConfigFileSectionName
std::string getConfigFileSectionName() const
Gets the name of the section used in initialize()
Definition: CAbstractHolonomicReactiveMethod.cpp:35
CSerializable.h
mrpt::nav::CAbstractHolonomicReactiveMethod::NavInput::clearance
const mrpt::nav::ClearanceDiagram * clearance
The computed clearance for each direction (optional in some implementations).
Definition: CAbstractHolonomicReactiveMethod.h:59
mrpt::nav::CAbstractHolonomicReactiveMethod::navigate
virtual void navigate(const NavInput &ni, NavOutput &no)=0
Invokes the holonomic navigation algorithm itself.
mrpt::nav::CParameterizedTrajectoryGenerator
This is the base class for any user-defined PTG.
Definition: CParameterizedTrajectoryGenerator.h:76



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