MRPT  1.9.9
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-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 /** Kinematic simulator of a holonomic 2D robot capable of moving in any
17  * direction, with "blended"
18  * velocity profiles. See CVehicleSimul_Holo::sendVelCmd() for a description of
19  * 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
34  * to this constant (rad/s)
35  */
36  void sendVelRampCmd(
37  double vel, double dir, double ramp_time, double rot_speed);
38 
39  void sendVelCmd(const CVehicleVelCmd& cmd_vel) override
40  {
41  const kinematic_cmd_t* cmd =
42  dynamic_cast<const kinematic_cmd_t*>(&cmd_vel);
43  ASSERTMSG_(
44  cmd,
45  "Wrong vehicle kinematic class, expected `CVehicleVelCmd_Holo`");
47  cmd->vel,
48  cmd->dir_local + m_odometry.phi /* local to odometry dir */,
49  cmd->ramp_time, cmd->rot_speed);
50  }
52  {
54  }
55 
56  private:
57  /** @name Vel ramp cmds
58  * @{ */
59  struct TVelRampCmd
60  {
61  /** time when the cmd was issued. (<0: invalid, means there are no
62  * pending cmds to execute) */
63  double issue_time;
66 
67  TVelRampCmd() : issue_time(-1.0) {}
68  };
69  /** the last cmd received from the user. */
71  /** @} */
72 
73  void internal_simulControlStep(const double dt) override;
74  void internal_clear() override;
75 };
76 }
77 
CVehicleVelCmd::Ptr getVelCmdType() const override
Gets an empty velocity command object that can be queried to find out the number of velcmd components...
This class can be used to simulate the kinematics and dynamics of a differential driven planar mobile...
void sendVelRampCmd(double vel, double dir, double ramp_time, double rot_speed)
Sends a velocity cmd to the holonomic robot.
void internal_simulControlStep(const double dt) override
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.
void sendVelCmd(const CVehicleVelCmd &cmd_vel) override
Sends a velocity command to the robot.
double dir_local
: direction, relative to the current robot heading (radians).
double issue_time
time when the cmd was issued.
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
Definition: exceptions.h:101
auto dir
Kinematic simulator of a holonomic 2D robot capable of moving in any direction, with "blended" veloci...
void internal_clear() override
Resets all pending cmds.
std::shared_ptr< CVehicleVelCmd > Ptr
TVelRampCmd m_vel_ramp_cmd
the last cmd received from the user.
double rot_speed
: (rad/s) rotational speed for rotating such as the robot slowly faces forward.
double phi
Orientation (rads)



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