Main MRPT website > C++ reference for MRPT 1.9.9
CVehicleVelCmd.cpp
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 
10 #include "kinematics-precomp.h" // Precompiled header
13 
14 using namespace mrpt::kinematics;
15 
17 
19 CVehicleVelCmd::CVehicleVelCmd(const CVehicleVelCmd& other) { *this = other; }
22 {
23  std::string s;
24  s += "(";
25  for (size_t i = 0; i < getVelCmdLength(); i++)
26  {
27  s += mrpt::format(
28  "%s=%.03f ", getVelCmdDescription(i).c_str(), getVelCmdElement(i));
29  }
30  s += ")";
31  return s;
32 }
33 
35 {
36  const size_t nThis = this->getVelCmdLength();
37  ASSERTMSG_(
38  typeid(*this) == typeid(other), "Trying to copy incompatible classes");
39  for (size_t i = 0; i < nThis; i++)
40  this->setVelCmdElement(i, other.getVelCmdElement(i));
41  return *this;
42 }
43 
45  const mrpt::config::CConfigFileBase& cfg, const std::string& section)
46 {
47  MRPT_LOAD_CONFIG_VAR_NO_DEFAULT(robotMax_V_mps, double, cfg, section);
49  robotMax_W_degps, double, robotMax_W_radps, cfg, section);
50  MRPT_LOAD_CONFIG_VAR(robotMinCurvRadius, double, cfg, section);
51 }
52 
55 {
57  robotMax_V_mps,
58  "Max. linear speed (m/s) [Default=-1 (not set), will raise exception "
59  "if needed and not set]");
61  "robotMax_W_degps", robotMax_W_radps,
62  "Max. angular speed (deg/s) [Default=-1 (not set), will raise "
63  "exception if needed and not set]");
65  robotMinCurvRadius,
66  "Min. radius of curvature of paths (m) [Default=-1 (not set), will "
67  "raise exception if needed and not set]");
68 }
69 
71  : robotMax_V_mps(-1.), robotMax_W_radps(-1.), robotMinCurvRadius(-1.)
72 {
73 }
s
GLdouble s
Definition: glext.h:3676
MRPT_SAVE_CONFIG_VAR_COMMENT
#define MRPT_SAVE_CONFIG_VAR_COMMENT(variableName, __comment)
Definition: config/CConfigFileBase.h:459
MRPT_LOAD_CONFIG_VAR
#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...
Definition: config/CConfigFileBase.h:282
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::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
MRPT_LOAD_CONFIG_VAR_NO_DEFAULT
#define MRPT_LOAD_CONFIG_VAR_NO_DEFAULT( variableName, variableType, configFileObject, sectionNameStr)
Definition: config/CConfigFileBase.h:377
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
kinematics-precomp.h
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::format
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:16
mrpt::kinematics::CVehicleVelCmd::TVelCmdParams::robotMinCurvRadius
double robotMinCurvRadius
Min.
Definition: CVehicleVelCmd.h:60
MRPT_SAVE_CONFIG_VAR_DEGREES_COMMENT
#define MRPT_SAVE_CONFIG_VAR_DEGREES_COMMENT( __entryName, __variable, __comment)
Definition: config/CConfigFileBase.h:466
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_LOAD_HERE_CONFIG_VAR_DEGREES_NO_DEFAULT
#define MRPT_LOAD_HERE_CONFIG_VAR_DEGREES_NO_DEFAULT( variableName, variableType, targetVariable, configFileObject, sectionNameStr)
Definition: config/CConfigFileBase.h:357
IMPLEMENTS_VIRTUAL_SERIALIZABLE
#define IMPLEMENTS_VIRTUAL_SERIALIZABLE( class_name, base_class_name, NameSpace)
This must be inserted as implementation of some required members for virtual CSerializable classes:
Definition: CSerializable.h:125
mrpt::kinematics::CVehicleVelCmd::TVelCmdParams::robotMax_W_radps
double robotMax_W_radps
Max.
Definition: CVehicleVelCmd.h:57
ASSERTMSG_
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
Definition: exceptions.h:101
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
Definition: CKinematicChain.h:19
CArchive.h
mrpt::kinematics::CVehicleVelCmd::getVelCmdLength
virtual size_t getVelCmdLength() const =0
Get number of components in each velocity command.
mrpt::kinematics::CVehicleVelCmd
Virtual base for velocity commands of different kinematic models of planar mobile robot.
Definition: CVehicleVelCmd.h:22
mrpt::kinematics::CVehicleVelCmd::operator=
CVehicleVelCmd & operator=(const CVehicleVelCmd &other)
Definition: CVehicleVelCmd.cpp:34
CVehicleVelCmd.h



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