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::kinematics
16 {
17 /** Virtual base for velocity commands of different kinematic models of planar
18  * mobile robot.
19  * \ingroup mrpt_kinematics_grp */
21 {
23  public:
25  CVehicleVelCmd(const CVehicleVelCmd& other);
26  virtual ~CVehicleVelCmd();
28 
29  /** Get number of components in each velocity command */
30  virtual size_t getVelCmdLength() const = 0;
31  /** Get textual, human-readable description of each velocity command
32  * component */
33  virtual std::string getVelCmdDescription(const int index) const = 0;
34  /** Get each velocity command component */
35  virtual double getVelCmdElement(const int index) const = 0;
36  /** Set each velocity command component */
37  virtual void setVelCmdElement(const int index, const double val) = 0;
38  /** Returns true if the command means "do not move" / "stop". \sa setToStop
39  */
40  virtual bool isStopCmd() const = 0;
41  /** Set to a command that means "do not move" / "stop". \sa isStopCmd */
42  virtual void setToStop() = 0;
43  /** Returns a human readable description of the cmd */
44  std::string asString() const;
45 
46  /** Parameters that may be used by cmdVel_limits() in any derived classes.
47  */
49  {
50  /** Max. linear speed (m/s) [Default=-1 (not set), will raise exception
51  * if needed and not set] */
53  /** Max. angular speed (rad/s) [Default=-1 (not set), will raise
54  * exception if needed and not set] */
56  /** Min. radius of curvature of paths (m) [Default=-1 (not set), will
57  * raise exception if needed and not set] */
59 
60  TVelCmdParams();
61  /** Load any parameter required by a CVehicleVelCmd derived class. */
62  void loadConfigFile(
64  const std::string& section);
65  void saveToConfigFile(
67  };
68 
69  /** Scale the velocity command encoded in this object.
70  * \param[in] vel_scale A scale within [0,1] reflecting how much should be
71  * the raw velocity command be lessen (e.g. for safety reasons,...).
72  * \param[out] out_vel_cmd
73  *
74  * Users can directly inherit from existing implementations instead of
75  * manually redefining this method:
76  * - mrpt::kinematics::CVehicleVelCmd_DiffDriven
77  * - mrpt::kinematics::CVehicleVelCmd_Holo
78  */
79  virtual void cmdVel_scale(double vel_scale) = 0;
80 
81  /** Updates this command, computing a blended version of `beta` (within
82  * [0,1]) of `vel_cmd` and `1-beta` of `prev_vel_cmd`, simultaneously
83  * to honoring any user-side maximum velocities.
84  * \return The [0,1] ratio that the cmdvel had to be scaled down, or 1.0 if
85  * none.
86  */
87  virtual double cmdVel_limits(
88  const mrpt::kinematics::CVehicleVelCmd& prev_vel_cmd, const double beta,
89  const TVelCmdParams& params) = 0;
90 };
91 
92 }
93 
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.
void saveToConfigFile(mrpt::config::CConfigFileBase &c, const std::string &s) const
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...
GLdouble s
Definition: glext.h:3676
#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...
This class allows loading and storing values and vectors of different types from a configuration text...
GLuint index
Definition: glext.h:4054
const GLubyte * c
Definition: glext.h:6313
void loadConfigFile(const mrpt::config::CConfigFileBase &cfg, const std::string &section)
Load any parameter required by a CVehicleVelCmd derived class.
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".
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:30
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020