Main MRPT website > C++ reference for MRPT 1.9.9
CVehicleSimul_DiffDriven.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 
14 namespace mrpt
15 {
16 namespace kinematics
17 {
18 /** Simulates the kinematics of a differential-driven planar mobile
19  * robot/vehicle, including odometry errors and dynamics limitations.
20  *
21  * \ingroup mrpt_kinematics_grp
22  */
24 {
25  public:
27 
29  virtual ~CVehicleSimul_DiffDriven();
30 
31  /** Change the model of delays used for the orders sent to the robot \sa
32  * movementCommand */
34  double TAU_delay_sec = 1.8, double CMD_delay_sec = 0.)
35  {
36  cTAU = TAU_delay_sec;
37  cDELAY = CMD_delay_sec;
38  }
39 
40  void setV(double v) { m_v = v; }
41  void setW(double w) { m_w = w; }
42  double getV() { return m_v; }
43  double getW() { return m_w; }
44  /** Used to command the robot a desired movement:
45  * \param lin_vel Linar velocity (m/s)
46  * \param ang_vel Angular velocity (rad/s)
47  */
48  void movementCommand(double lin_vel, double ang_vel);
49 
50  void sendVelCmd(const CVehicleVelCmd& cmd_vel) override
51  {
52  const kinematic_cmd_t* cmd =
53  dynamic_cast<const kinematic_cmd_t*>(&cmd_vel);
54  ASSERTMSG_(
55  cmd,
56  "Wrong vehicle kinematic class, expected "
57  "`CVehicleVelCmd_DiffDriven`");
58  movementCommand(cmd->lin_vel, cmd->ang_vel);
59  }
61  {
63  }
64 
65  private:
66  /** lin & angular velocity in the robot local frame. */
67  double m_v, m_w;
68 
69  /** Dynamic limitations of the robot.
70  * Approximation to non-infinity motor forces: A first order low-pass
71  * filter, using:
72  * Command_Time: Time "t" when the last order was received.
73  * Command_v, Command_w: The user-desired velocities.
74  * Command_v0, Command_w0: Actual robot velocities at the moment of
75  * user request.
76  */
78 
79  /** The time-constants for the first order low-pass filter for the
80  * velocities changes. */
81  double cTAU;
82  /** The delay constant for the velocities changes */
83  double cDELAY;
84 
85  void internal_simulControlStep(const double dt) override;
86  void internal_clear() override;
87 };
88 
89 } // End of namespace
90 } // End of namespace
double cDELAY
The delay constant for the velocities changes.
double m_v
lin & angular velocity in the robot local frame.
This class can be used to simulate the kinematics and dynamics of a differential driven planar mobile...
double cTAU
The time-constants for the first order low-pass filter for the velocities changes.
double Command_Time
Dynamic limitations of the robot.
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:4178
Virtual base for velocity commands of different kinematic models of planar mobile robot...
void movementCommand(double lin_vel, double ang_vel)
Used to command the robot a desired movement:
Simulates the kinematics of a differential-driven planar mobile robot/vehicle, including odometry err...
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
Definition: exceptions.h:101
const GLdouble * v
Definition: glext.h:3678
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void internal_clear() override
Resets all pending cmds.
void setDelayModelParams(double TAU_delay_sec=1.8, double CMD_delay_sec=0.)
Change the model of delays used for the orders sent to the robot.
std::shared_ptr< CVehicleVelCmd > Ptr
CVehicleVelCmd::Ptr getVelCmdType() const override
Gets an empty velocity command object that can be queried to find out the number of velcmd components...
Kinematic model for Ackermann-like or differential-driven vehicles.
void internal_simulControlStep(const double dt) override
void sendVelCmd(const CVehicleVelCmd &cmd_vel) override
Sends a velocity command to the robot.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019