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::kinematics
15 {
16 /** Simulates the kinematics of a differential-driven planar mobile
17  * robot/vehicle, including odometry errors and dynamics limitations.
18  *
19  * \ingroup mrpt_kinematics_grp
20  */
22 {
23  public:
25 
27  virtual ~CVehicleSimul_DiffDriven();
28 
29  /** Change the model of delays used for the orders sent to the robot \sa
30  * movementCommand */
32  double TAU_delay_sec = 1.8, double CMD_delay_sec = 0.)
33  {
34  cTAU = TAU_delay_sec;
35  cDELAY = CMD_delay_sec;
36  }
37 
38  void setV(double v) { m_v = v; }
39  void setW(double w) { m_w = w; }
40  double getV() { return m_v; }
41  double getW() { return m_w; }
42  /** Used to command the robot a desired movement:
43  * \param lin_vel Linar velocity (m/s)
44  * \param ang_vel Angular velocity (rad/s)
45  */
46  void movementCommand(double lin_vel, double ang_vel);
47 
48  void sendVelCmd(const CVehicleVelCmd& cmd_vel) override
49  {
50  const kinematic_cmd_t* cmd =
51  dynamic_cast<const kinematic_cmd_t*>(&cmd_vel);
52  ASSERTMSG_(
53  cmd,
54  "Wrong vehicle kinematic class, expected "
55  "`CVehicleVelCmd_DiffDriven`");
56  movementCommand(cmd->lin_vel, cmd->ang_vel);
57  }
59  {
61  }
62 
63  private:
64  /** lin & angular velocity in the robot local frame. */
65  double m_v, m_w;
66 
67  /** Dynamic limitations of the robot.
68  * Approximation to non-infinity motor forces: A first order low-pass
69  * filter, using:
70  * Command_Time: Time "t" when the last order was received.
71  * Command_v, Command_w: The user-desired velocities.
72  * Command_v0, Command_w0: Actual robot velocities at the moment of
73  * user request.
74  */
76 
77  /** The time-constants for the first order low-pass filter for the
78  * velocities changes. */
79  double cTAU;
80  /** The delay constant for the velocities changes */
81  double cDELAY;
82 
83  void internal_simulControlStep(const double dt) override;
84  void internal_clear() override;
85 };
86 
87 }
88 
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
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020