36 case 0:
return "lin_vel";
break;
37 case 1:
return "ang_vel";
break;
47 case 0:
return lin_vel;
break;
48 case 1:
return ang_vel;
break;
58 case 0: lin_vel =
val;
break;
59 case 1: ang_vel =
val;
break;
67 return lin_vel == .0 && ang_vel == .0;
72 lin_vel = ang_vel = .0;
80 in >> lin_vel >> ang_vel;
94 out << lin_vel << ang_vel;
100 ang_vel *= vel_scale;
108 ASSERTMSG_(prevcmd,
"Expected prevcmd of type `CVehicleVelCmd_DiffDriven`");
110 double speed_scale = filter_max_vw(lin_vel, ang_vel,
params);
112 if (std::abs(lin_vel) < 0.01)
114 ang_vel = beta*ang_vel + (1 - beta)*prevcmd->
ang_vel;
119 float ratio = ang_vel / lin_vel;
120 lin_vel = beta*lin_vel + (1 - beta)*prevcmd->
lin_vel;
121 ang_vel = ratio * lin_vel;
123 speed_scale*= filter_max_vw(lin_vel, ang_vel,
params);
131 double speed_scale = 1.0;
133 if (std::abs(
v) >
p.robotMax_V_mps) {
135 const double F = std::abs(
p.robotMax_V_mps /
v);
141 if (std::abs(
w) >
p.robotMax_W_radps) {
143 const double F = std::abs(
p.robotMax_W_radps /
w);
double cmdVel_limits(const mrpt::kinematics::CVehicleVelCmd &prev_vel_cmd, const double beta, const TVelCmdParams ¶ms) MRPT_OVERRIDE
See base class docs.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
double filter_max_vw(double &v, double &w, const TVelCmdParams &p)
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
virtual ~CVehicleVelCmd_DiffDriven()
size_t getVelCmdLength() const MRPT_OVERRIDE
Get number of components in each velocity command.
GLubyte GLubyte GLubyte GLubyte w
Virtual base for velocity commands of different kinematic models of planar mobile robot...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
double ang_vel
Angular velocity (rad/s)
void cmdVel_scale(double vel_scale) MRPT_OVERRIDE
See docs of method in base class.
GLsizei const GLchar ** string
void setToStop() MRPT_OVERRIDE
Set to a command that means "do not move" / "stop".
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
double lin_vel
Linear velocity (m/s)
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
std::string getVelCmdDescription(const int index) const MRPT_OVERRIDE
Get textual, human-readable description of each velocity command component.
double getVelCmdElement(const int index) const MRPT_OVERRIDE
Get each velocity command component.
Parameters that may be used by cmdVel_limits() in any derived classes.
#define ASSERTMSG_(f, __ERROR_MSG)
GLenum const GLfloat * params
void setVelCmdElement(const int index, const double val) MRPT_OVERRIDE
Set each velocity command component.
Kinematic model for Ackermann-like or differential-driven vehicles.
bool isStopCmd() const MRPT_OVERRIDE
Returns true if the command means "do not move" / "stop".