Main MRPT website > C++ reference for MRPT 1.5.9
CVehicleSimul_DiffDriven.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-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 
10 #include "kinematics-precomp.h" // Precompiled header
11 
13 
14 using namespace mrpt::kinematics;
15 
16 
18  cTAU(.0),
19  cDELAY(.0)
20 {
21  resetStatus();
22  resetTime();
23 }
25 {
26 }
27 
29 {
30  Command_Time = .0;
31  Command_v = .0;
32  Command_w = .0;
33  m_v=m_w=0;
34 }
35 
37 {
38  // Change velocities:
39  // ----------------------------------------------------------------
40  double elapsed_time = this->m_time - Command_Time;
41  elapsed_time-=cDELAY;
42  elapsed_time = std::max(0.0,elapsed_time);
43 
44  if (cTAU==0 && cDELAY==0)
45  {
46  m_v = Command_v;
47  m_w = Command_w;
48  }
49  else
50  {
51  m_v = Command_v0 + (Command_v-Command_v0)*(1-exp(-elapsed_time/cTAU));
52  m_w = Command_w0 + (Command_w-Command_w0)*(1-exp(-elapsed_time/cTAU));
53  }
54 
55  // Local to global frame:
59 
60 }
61 
62 /*************************************************************************
63  Gives a movement command to the robot:
64  This actually saves the command for execution later on, if we have
65  to take into account the robot low-pass behavior in velocities.
66 *************************************************************************/
67 void CVehicleSimul_DiffDriven::movementCommand ( double lin_vel, double ang_vel )
68 {
69  // Just save the command:
71  Command_v = lin_vel;
72  Command_w = ang_vel;
73 
74  // Current values:
75  Command_v0 = m_v;
76  Command_w0 = m_w;
77 }
double cDELAY
The delay constant for the velocities changes.
mrpt::math::TTwist2D m_odometric_vel
Velocity in (x,y,omega)
double cTAU
The time-constants for the first order low-pass filter for the velocities changes.
double Command_Time
Dynamic limitations of the robot.
void movementCommand(double lin_vel, double ang_vel)
Used to command the robot a desired movement:
double vy
Velocity components: X,Y (m/s)
void internal_simulControlStep(const double dt) MRPT_OVERRIDE
void resetTime()
Reset all simulator variables to 0 (except the simulation time).
void internal_clear() MRPT_OVERRIDE
Resets all pending cmds.
double phi
Orientation (rads)
double m_w
lin & angular velocity in the robot local frame.
double omega
Angular velocity (rad/s)



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020