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-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 #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
mrpt::kinematics::CVehicleVelCmd::isStopCmd
virtual bool isStopCmd() const =0
Returns true if the command means "do not move" / "stop".
s
GLdouble s
Definition: glext.h:3676
mrpt::kinematics::CVehicleVelCmd::asString
std::string asString() const
Returns a human readable description of the cmd.
Definition: CVehicleVelCmd.cpp:21
c
const GLubyte * c
Definition: glext.h:6313
mrpt::kinematics::CVehicleVelCmd::TVelCmdParams
Parameters that may be used by cmdVel_limits() in any derived classes.
Definition: CVehicleVelCmd.h:50
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::kinematics::CVehicleVelCmd::TVelCmdParams::saveToConfigFile
void saveToConfigFile(mrpt::config::CConfigFileBase &c, const std::string &s) const
Definition: CVehicleVelCmd.cpp:53
mrpt::kinematics::CVehicleVelCmd::setVelCmdElement
virtual void setVelCmdElement(const int index, const double val)=0
Set each velocity command component.
mrpt::kinematics::CVehicleVelCmd::~CVehicleVelCmd
virtual ~CVehicleVelCmd()
Definition: CVehicleVelCmd.cpp:20
CConfigFileBase.h
val
int val
Definition: mrpt_jpeglib.h:955
mrpt::kinematics::CVehicleVelCmd::TVelCmdParams::loadConfigFile
void loadConfigFile(const mrpt::config::CConfigFileBase &cfg, const std::string &section)
Load any parameter required by a CVehicleVelCmd derived class.
Definition: CVehicleVelCmd.cpp:44
mrpt::kinematics::CVehicleVelCmd::cmdVel_scale
virtual void cmdVel_scale(double vel_scale)=0
Scale the velocity command encoded in this object.
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::kinematics::CVehicleVelCmd::TVelCmdParams::robotMinCurvRadius
double robotMinCurvRadius
Min.
Definition: CVehicleVelCmd.h:60
index
GLuint index
Definition: glext.h:4054
mrpt::serialization::CSerializable
The virtual base class which provides a unified interface for all persistent objects in MRPT.
Definition: CSerializable.h:32
mrpt::kinematics::CVehicleVelCmd::getVelCmdElement
virtual double getVelCmdElement(const int index) const =0
Get each velocity command component.
mrpt::kinematics::CVehicleVelCmd::CVehicleVelCmd
CVehicleVelCmd()
Definition: CVehicleVelCmd.cpp:18
mrpt::kinematics::CVehicleVelCmd::setToStop
virtual void setToStop()=0
Set to a command that means "do not move" / "stop".
mrpt::kinematics::CVehicleVelCmd::TVelCmdParams::robotMax_W_radps
double robotMax_W_radps
Max.
Definition: CVehicleVelCmd.h:57
DEFINE_VIRTUAL_SERIALIZABLE
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
Definition: CSerializable.h:119
mrpt::kinematics::CVehicleVelCmd::getVelCmdDescription
virtual std::string getVelCmdDescription(const int index) const =0
Get textual, human-readable description of each velocity command component.
mrpt::kinematics::CVehicleVelCmd::TVelCmdParams::robotMax_V_mps
double robotMax_V_mps
Max.
Definition: CVehicleVelCmd.h:54
mrpt::kinematics::CVehicleVelCmd::TVelCmdParams::TVelCmdParams
TVelCmdParams()
Definition: CVehicleVelCmd.cpp:70
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::kinematics::CVehicleVelCmd::getVelCmdLength
virtual size_t getVelCmdLength() const =0
Get number of components in each velocity command.
CSerializable.h
mrpt::kinematics::CVehicleVelCmd
Virtual base for velocity commands of different kinematic models of planar mobile robot.
Definition: CVehicleVelCmd.h:22
mrpt::kinematics::CVehicleVelCmd::cmdVel_limits
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...
mrpt::kinematics::CVehicleVelCmd::operator=
CVehicleVelCmd & operator=(const CVehicleVelCmd &other)
Definition: CVehicleVelCmd.cpp:34
params
GLenum const GLfloat * params
Definition: glext.h:3534



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