Main MRPT website > C++ reference for MRPT 1.9.9
CVehicleVelCmd.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 #pragma once
10 
13 #include <string>
14 
15 namespace mrpt
16 {
17 namespace kinematics
18 {
19 /** Virtual base for velocity commands of different kinematic models of planar
20  * mobile robot.
21  * \ingroup mrpt_kinematics_grp */
23 {
25  public:
27  CVehicleVelCmd(const CVehicleVelCmd& other);
28  virtual ~CVehicleVelCmd();
30 
31  /** Get number of components in each velocity command */
32  virtual size_t getVelCmdLength() const = 0;
33  /** Get textual, human-readable description of each velocity command
34  * component */
35  virtual std::string getVelCmdDescription(const int index) const = 0;
36  /** Get each velocity command component */
37  virtual double getVelCmdElement(const int index) const = 0;
38  /** Set each velocity command component */
39  virtual void setVelCmdElement(const int index, const double val) = 0;
40  /** Returns true if the command means "do not move" / "stop". \sa setToStop
41  */
42  virtual bool isStopCmd() const = 0;
43  /** Set to a command that means "do not move" / "stop". \sa isStopCmd */
44  virtual void setToStop() = 0;
45  /** Returns a human readable description of the cmd */
46  std::string asString() const;
47 
48  /** Parameters that may be used by cmdVel_limits() in any derived classes.
49  */
51  {
52  /** Max. linear speed (m/s) [Default=-1 (not set), will raise exception
53  * if needed and not set] */
55  /** Max. angular speed (rad/s) [Default=-1 (not set), will raise
56  * exception if needed and not set] */
58  /** Min. radius of curvature of paths (m) [Default=-1 (not set), will
59  * raise exception if needed and not set] */
61 
62  TVelCmdParams();
63  /** Load any parameter required by a CVehicleVelCmd derived class. */
64  void loadConfigFile(
66  const std::string& section);
67  void saveToConfigFile(
69  };
70 
71  /** Scale the velocity command encoded in this object.
72  * \param[in] vel_scale A scale within [0,1] reflecting how much should be
73  * the raw velocity command be lessen (e.g. for safety reasons,...).
74  * \param[out] out_vel_cmd
75  *
76  * Users can directly inherit from existing implementations instead of
77  * manually redefining this method:
78  * - mrpt::kinematics::CVehicleVelCmd_DiffDriven
79  * - mrpt::kinematics::CVehicleVelCmd_Holo
80  */
81  virtual void cmdVel_scale(double vel_scale) = 0;
82 
83  /** Updates this command, computing a blended version of `beta` (within
84  * [0,1]) of `vel_cmd` and `1-beta` of `prev_vel_cmd`, simultaneously
85  * to honoring any user-side maximum velocities.
86  * \return The [0,1] ratio that the cmdvel had to be scaled down, or 1.0 if
87  * none.
88  */
89  virtual double cmdVel_limits(
90  const mrpt::kinematics::CVehicleVelCmd& prev_vel_cmd, const double beta,
91  const TVelCmdParams& params) = 0;
92 };
93 
94 } // End of namespace
95 } // End of namespace
std::string asString() const
Returns a human readable description of the cmd.
virtual size_t getVelCmdLength() const =0
Get number of components in each velocity command.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:44
virtual void cmdVel_scale(double vel_scale)=0
Scale the velocity command encoded in this object.
virtual void setVelCmdElement(const int index, const double val)=0
Set each velocity command component.
virtual double cmdVel_limits(const mrpt::kinematics::CVehicleVelCmd &prev_vel_cmd, const double beta, const TVelCmdParams &params)=0
Updates this command, computing a blended version of beta (within [0,1]) of vel_cmd and 1-beta of pre...
void saveToConfigFile(mrpt::utils::CConfigFileBase &c, const std::string &s) const
GLdouble s
Definition: glext.h:3676
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:
Virtual base for velocity commands of different kinematic models of planar mobile robot...
void loadConfigFile(const mrpt::utils::CConfigFileBase &cfg, const std::string &section)
Load any parameter required by a CVehicleVelCmd derived class.
GLuint index
Definition: glext.h:4054
const GLubyte * c
Definition: glext.h:6313
virtual void setToStop()=0
Set to a command that means "do not move" / "stop".
int val
Definition: mrpt_jpeglib.h:955
GLsizei const GLchar ** string
Definition: glext.h:4101
virtual bool isStopCmd() const =0
Returns true if the command means "do not move" / "stop".
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CVehicleVelCmd & operator=(const CVehicleVelCmd &other)
virtual std::string getVelCmdDescription(const int index) const =0
Get textual, human-readable description of each velocity command component.
Parameters that may be used by cmdVel_limits() in any derived classes.
GLenum const GLfloat * params
Definition: glext.h:3534
virtual double getVelCmdElement(const int index) const =0
Get each velocity command component.



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