Main MRPT website > C++ reference for MRPT 1.5.7
CVehicleSimul_Holo.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  /** Kinematic simulator of a holonomic 2D robot capable of moving in any direction, with "blended"
19  * velocity profiles. See CVehicleSimul_Holo::sendVelCmd() for a description of the velocity commands in this kinematic model.
20  * \ingroup mrpt_kinematics_grp
21  */
23  {
24  public:
26 
28 
29  /** Sends a velocity cmd to the holonomic robot.
30  * \param[in] vel Linear speed (m/s)
31  * \param[in] dir Direction (rad) (In the odometry frame of reference)
32  * \param[in] ramp_time Blend the cmd during this period (seconds)
33  * \param[in] rot_speed Rotational speed while there is heading error and to this constant (rad/s)
34  */
35  void sendVelRampCmd(double vel, double dir, double ramp_time, double rot_speed);
36 
37  void sendVelCmd(const CVehicleVelCmd &cmd_vel) MRPT_OVERRIDE {
38  const kinematic_cmd_t* cmd = dynamic_cast<const kinematic_cmd_t*>(&cmd_vel);
39  ASSERTMSG_(cmd, "Wrong vehicle kinematic class, expected `CVehicleVelCmd_Holo`");
40  sendVelRampCmd(cmd->vel, cmd->dir_local + m_odometry.phi /* local to odometry dir */ ,cmd->ramp_time,cmd->rot_speed);
41  }
42  CVehicleVelCmdPtr getVelCmdType() const MRPT_OVERRIDE {
43  return CVehicleVelCmdPtr(new kinematic_cmd_t());
44  }
45 
46  private:
47  /** @name Vel ramp cmds
48  * @{ */
49  struct TVelRampCmd
50  {
51  double issue_time; //!< time when the cmd was issued. (<0: invalid, means there are no pending cmds to execute)
52  double target_vel_x, target_vel_y, ramp_time, rot_speed, dir;
54 
55  TVelRampCmd(): issue_time(-1.0) {}
56  };
57  TVelRampCmd m_vel_ramp_cmd; //!< the last cmd received from the user.
58  /** @} */
59 
60  void internal_simulControlStep(const double dt) MRPT_OVERRIDE;
61  void internal_clear() MRPT_OVERRIDE;
62 
63  };
64 }
65 }
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:
Virtual base for velocity commands of different kinematic models of planar mobile robot...
2D twist: 2D velocity vector (vx,vy) + planar angular velocity (omega)
double ramp_time
: Blending time between current and target time.
double dir_local
: direction, relative to the current robot heading (radians). 0 means forward.
void sendVelCmd(const CVehicleVelCmd &cmd_vel) MRPT_OVERRIDE
Sends a velocity command to the robot.
double issue_time
time when the cmd was issued. (<0: invalid, means there are no pending cmds to execute) ...
CVehicleVelCmdPtr getVelCmdType() const MRPT_OVERRIDE
Gets an empty velocity command object that can be queried to find out the number of velcmd components...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Kinematic simulator of a holonomic 2D robot capable of moving in any direction, with "blended" veloci...
TVelRampCmd m_vel_ramp_cmd
the last cmd received from the user.
#define ASSERTMSG_(f, __ERROR_MSG)
double rot_speed
: (rad/s) rotational speed for rotating such as the robot slowly faces forward.



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 8277875f6 Mon Jun 11 02:47:32 2018 +0200 at lun oct 28 01:50:49 CET 2019