Main MRPT website > C++ reference for MRPT 1.5.7
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 
14 #include <string>
15 
16 namespace mrpt
17 {
18  namespace kinematics
19  {
21 
22  /** Virtual base for velocity commands of different kinematic models of planar mobile robot.
23  * \ingroup mrpt_kinematics_grp */
24  class KINEMATICS_IMPEXP CVehicleVelCmd : public mrpt::utils::CSerializable
25  {
27  public:
29  CVehicleVelCmd(const CVehicleVelCmd &other);
30  virtual ~CVehicleVelCmd();
31  CVehicleVelCmd & operator =(const CVehicleVelCmd &other);
32 
33  virtual size_t getVelCmdLength() const = 0; //!< Get number of components in each velocity command
34  virtual std::string getVelCmdDescription(const int index) const = 0; //!< Get textual, human-readable description of each velocity command component
35  virtual double getVelCmdElement(const int index) const = 0; //!< Get each velocity command component
36  virtual void setVelCmdElement(const int index, const double val) = 0; //!< Set each velocity command component
37  virtual bool isStopCmd() const = 0; //!< Returns true if the command means "do not move" / "stop". \sa setToStop
38  virtual void setToStop() = 0; //!< Set to a command that means "do not move" / "stop". \sa isStopCmd
39  std::string asString() const; //!< Returns a human readable description of the cmd
40 
41  /** Parameters that may be used by cmdVel_limits() in any derived classes. */
43  {
44  double robotMax_V_mps; //!< Max. linear speed (m/s) [Default=-1 (not set), will raise exception if needed and not set]
45  double robotMax_W_radps; //!< Max. angular speed (rad/s) [Default=-1 (not set), will raise exception if needed and not set]
46  double robotMinCurvRadius; //!< Min. radius of curvature of paths (m) [Default=-1 (not set), will raise exception if needed and not set]
47 
48  TVelCmdParams();
49  /** Load any parameter required by a CVehicleVelCmd derived class. */
50  void loadConfigFile(const mrpt::utils::CConfigFileBase &cfg, const std::string &section);
51  void saveToConfigFile(mrpt::utils::CConfigFileBase & c, const std::string & s) const;
52  };
53 
54  /** Scale the velocity command encoded in this object.
55  * \param[in] vel_scale A scale within [0,1] reflecting how much should be the raw velocity command be lessen (e.g. for safety reasons,...).
56  * \param[out] out_vel_cmd
57  *
58  * Users can directly inherit from existing implementations instead of manually redefining this method:
59  * - mrpt::kinematics::CVehicleVelCmd_DiffDriven
60  * - mrpt::kinematics::CVehicleVelCmd_Holo
61  */
62  virtual void cmdVel_scale(double vel_scale) = 0;
63 
64  /** Updates this command, computing a blended version of `beta` (within [0,1]) of `vel_cmd` and `1-beta` of `prev_vel_cmd`, simultaneously
65  * to honoring any user-side maximum velocities.
66  * \return The [0,1] ratio that the cmdvel had to be scaled down, or 1.0 if none.
67  */
68  virtual double cmdVel_limits(const mrpt::kinematics::CVehicleVelCmd &prev_vel_cmd, const double beta, const TVelCmdParams &params) = 0;
69  };
71 
72 
73  } // End of namespace
74 } // End of namespace
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:39
GLdouble s
Definition: glext.h:3602
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...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
GLuint index
Definition: glext.h:3891
const GLubyte * c
Definition: glext.h:5590
double robotMax_W_radps
Max. angular speed (rad/s) [Default=-1 (not set), will raise exception if needed and not set]...
int val
Definition: mrpt_jpeglib.h:953
GLsizei const GLchar ** string
Definition: glext.h:3919
double robotMinCurvRadius
Min. radius of curvature of paths (m) [Default=-1 (not set), will raise exception if needed and not s...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
double robotMax_V_mps
Max. linear speed (m/s) [Default=-1 (not set), will raise exception if needed and not set]...
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
Parameters that may be used by cmdVel_limits() in any derived classes.
GLenum const GLfloat * params
Definition: glext.h:3514



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019