MRPT  2.0.4
CVehicleVelCmd.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "kinematics-precomp.h" // Precompiled header
11 
14 
15 using namespace mrpt::kinematics;
16 
18 
20 CVehicleVelCmd::CVehicleVelCmd(const CVehicleVelCmd& other) { *this = other; }
23 {
24  std::string s;
25  s += "(";
26  for (size_t i = 0; i < getVelCmdLength(); i++)
27  {
28  s += mrpt::format(
29  "%s=%.03f ", getVelCmdDescription(i).c_str(), getVelCmdElement(i));
30  }
31  s += ")";
32  return s;
33 }
34 
36 {
37  const size_t nThis = this->getVelCmdLength();
38  ASSERTMSG_(
39  typeid(*this) == typeid(other), "Trying to copy incompatible classes");
40  for (size_t i = 0; i < nThis; i++)
41  this->setVelCmdElement(i, other.getVelCmdElement(i));
42  return *this;
43 }
44 
46  const mrpt::config::CConfigFileBase& cfg, const std::string& section)
47 {
48  MRPT_LOAD_CONFIG_VAR_NO_DEFAULT(robotMax_V_mps, double, cfg, section);
50  robotMax_W_degps, double, robotMax_W_radps, cfg, section);
51  MRPT_LOAD_CONFIG_VAR(robotMinCurvRadius, double, cfg, section);
52 }
53 
55  mrpt::config::CConfigFileBase& c, const std::string& s) const
56 {
58  robotMax_V_mps,
59  "Max. linear speed (m/s) [Default=-1 (not set), will raise exception "
60  "if needed and not set]");
62  "robotMax_W_degps", robotMax_W_radps,
63  "Max. angular speed (deg/s) [Default=-1 (not set), will raise "
64  "exception if needed and not set]");
66  robotMinCurvRadius,
67  "Min. radius of curvature of paths (m) [Default=-1 (not set), will "
68  "raise exception if needed and not set]");
69 }
70 
#define IMPLEMENTS_VIRTUAL_SERIALIZABLE(class_name, base_class, NS)
This must be inserted as implementation of some required members for virtual CSerializable classes: ...
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.
#define MRPT_LOAD_HERE_CONFIG_VAR_DEGREES_NO_DEFAULT( variableName, variableType, targetVariable, configFileObject, sectionNameStr)
std::string std::string format(std::string_view fmt, ARGS &&... args)
Definition: format.h:26
void saveToConfigFile(mrpt::config::CConfigFileBase &c, const std::string &s) const
virtual void setVelCmdElement(const int index, const double val)=0
Set each velocity command component.
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...
void loadConfigFile(const mrpt::config::CConfigFileBase &cfg, const std::string &section)
Load any parameter required by a CVehicleVelCmd derived class.
#define MRPT_LOAD_CONFIG_VAR_NO_DEFAULT( variableName, variableType, configFileObject, sectionNameStr)
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
Definition: exceptions.h:108
#define MRPT_LOAD_CONFIG_VAR( variableName, variableType, configFileObject, sectionNameStr)
An useful macro for loading variables stored in a INI-like file under a key with the same name that t...
#define MRPT_SAVE_CONFIG_VAR_COMMENT(variableName, __comment)
CVehicleVelCmd & operator=(const CVehicleVelCmd &other)
#define MRPT_SAVE_CONFIG_VAR_DEGREES_COMMENT( __entryName, __variable, __comment)
virtual double getVelCmdElement(const int index) const =0
Get each velocity command component.



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020