Main MRPT website > C++ reference for MRPT 1.5.7
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-2017, 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 robot/vehicle, including odometry errors and dynamics limitations.
19  *
20  * \ingroup mrpt_kinematics_grp
21  */
23  {
24  public:
26 
28  virtual ~CVehicleSimul_DiffDriven();
29 
30  /** Change the model of delays used for the orders sent to the robot \sa movementCommand */
31  void setDelayModelParams(double TAU_delay_sec=1.8, double CMD_delay_sec=0.) {
32  cTAU = TAU_delay_sec;
33  cDELAY = CMD_delay_sec;
34  }
35 
36  void setV(double v) { m_v=v; }
37  void setW(double w) { m_w=w; }
38 
39  double getV() {return m_v;}
40  double getW() {return m_w;}
41 
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) MRPT_OVERRIDE {
49  const kinematic_cmd_t* cmd = dynamic_cast<const kinematic_cmd_t*>(&cmd_vel);
50  ASSERTMSG_(cmd, "Wrong vehicle kinematic class, expected `CVehicleVelCmd_DiffDriven`");
51  movementCommand(cmd->lin_vel, cmd->ang_vel);
52  }
53  CVehicleVelCmdPtr getVelCmdType() const MRPT_OVERRIDE {
54  return CVehicleVelCmdPtr( new kinematic_cmd_t() );
55  }
56 
57  private:
58  double m_v, m_w; //!< lin & angular velocity in the robot local frame.
59 
60  /** Dynamic limitations of the robot.
61  * Approximation to non-infinity motor forces: A first order low-pass filter, using:
62  * Command_Time: Time "t" when the last order was received.
63  * Command_v, Command_w: The user-desired velocities.
64  * Command_v0, Command_w0: Actual robot velocities at the moment of user request.
65  */
66  double Command_Time,
67  Command_v, Command_w,
68  Command_v0, Command_w0;
69 
70  double cTAU; //!< The time-constants for the first order low-pass filter for the velocities changes.
71  double cDELAY; //!< The delay constant for the velocities changes
72 
73  void internal_simulControlStep(const double dt) MRPT_OVERRIDE;
74  void internal_clear() MRPT_OVERRIDE;
75  };
76 
77  } // End of namespace
78 } // End of namespace
79 
double cDELAY
The delay constant for the velocities changes.
This class can be used to simulate the kinematics and dynamics of a differential driven planar mobile...
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
double cTAU
The time-constants for the first order low-pass filter for the velocities changes.
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:3962
CVehicleVelCmdPtr getVelCmdType() const MRPT_OVERRIDE
Gets an empty velocity command object that can be queried to find out the number of velcmd components...
Virtual base for velocity commands of different kinematic models of planar mobile robot...
Simulates the kinematics of a differential-driven planar mobile robot/vehicle, including odometry err...
const GLdouble * v
Definition: glext.h:3603
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
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.
void sendVelCmd(const CVehicleVelCmd &cmd_vel) MRPT_OVERRIDE
Sends a velocity command to the robot.
#define ASSERTMSG_(f, __ERROR_MSG)
Kinematic model for Ackermann-like or differential-driven vehicles.
double m_w
lin & angular velocity in the robot local frame.



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019