Main MRPT website > C++ reference for 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
15 {
16 namespace kinematics
17 {
18 /** Kinematic simulator of a holonomic 2D robot capable of moving in any
19  * direction, with "blended"
20  * velocity profiles. See CVehicleSimul_Holo::sendVelCmd() for a description of
21  * the velocity commands in this kinematic model.
22  * \ingroup mrpt_kinematics_grp
23  */
25 {
26  public:
28 
30 
31  /** Sends a velocity cmd to the holonomic robot.
32  * \param[in] vel Linear speed (m/s)
33  * \param[in] dir Direction (rad) (In the odometry frame of reference)
34  * \param[in] ramp_time Blend the cmd during this period (seconds)
35  * \param[in] rot_speed Rotational speed while there is heading error and
36  * to this constant (rad/s)
37  */
38  void sendVelRampCmd(
39  double vel, double dir, double ramp_time, double rot_speed);
40 
41  void sendVelCmd(const CVehicleVelCmd& cmd_vel) override
42  {
43  const kinematic_cmd_t* cmd =
44  dynamic_cast<const kinematic_cmd_t*>(&cmd_vel);
45  ASSERTMSG_(
46  cmd,
47  "Wrong vehicle kinematic class, expected `CVehicleVelCmd_Holo`");
49  cmd->vel,
50  cmd->dir_local + m_odometry.phi /* local to odometry dir */,
51  cmd->ramp_time, cmd->rot_speed);
52  }
54  {
56  }
57 
58  private:
59  /** @name Vel ramp cmds
60  * @{ */
61  struct TVelRampCmd
62  {
63  /** time when the cmd was issued. (<0: invalid, means there are no
64  * pending cmds to execute) */
65  double issue_time;
68 
69  TVelRampCmd() : issue_time(-1.0) {}
70  };
71  /** the last cmd received from the user. */
73  /** @} */
74 
75  void internal_simulControlStep(const double dt) override;
76  void internal_clear() override;
77 };
78 }
79 }
mrpt::kinematics::CVehicleSimul_Holo::TVelRampCmd::rot_speed
double rot_speed
Definition: CVehicleSimul_Holo.h:66
CVehicleVelCmd_Holo.h
mrpt::kinematics::CVehicleSimulVirtualBase
This class can be used to simulate the kinematics and dynamics of a differential driven planar mobile...
Definition: CVehicleSimulVirtualBase.h:33
mrpt::kinematics::CVehicleSimul_Holo::TVelRampCmd::dir
double dir
Definition: CVehicleSimul_Holo.h:66
mrpt::math::TPose2D::phi
double phi
Orientation (rads)
Definition: lightweight_geom_data.h:195
mrpt::kinematics::CVehicleSimul_Holo::CVehicleSimul_Holo
CVehicleSimul_Holo()
Definition: CVehicleSimul_Holo.cpp:17
mrpt::kinematics::CVehicleSimul_Holo::sendVelCmd
void sendVelCmd(const CVehicleVelCmd &cmd_vel) override
Sends a velocity command to the robot.
Definition: CVehicleSimul_Holo.h:41
mrpt::kinematics::CVehicleVelCmd_Holo::vel
double vel
speed(m / s)
Definition: CVehicleVelCmd_Holo.h:26
mrpt::kinematics::CVehicleSimul_Holo::TVelRampCmd::ramp_time
double ramp_time
Definition: CVehicleSimul_Holo.h:66
mrpt::kinematics::CVehicleSimul_Holo::m_vel_ramp_cmd
TVelRampCmd m_vel_ramp_cmd
the last cmd received from the user.
Definition: CVehicleSimul_Holo.h:72
mrpt::kinematics::CVehicleSimul_Holo::TVelRampCmd::target_vel_x
double target_vel_x
Definition: CVehicleSimul_Holo.h:66
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::kinematics::CVehicleSimul_Holo::kinematic_cmd_t
CVehicleVelCmd_Holo kinematic_cmd_t
Definition: CVehicleSimul_Holo.h:27
CVehicleSimulVirtualBase.h
mrpt::kinematics::CVehicleSimul_Holo::TVelRampCmd::target_vel_y
double target_vel_y
Definition: CVehicleSimul_Holo.h:66
mrpt::kinematics::CVehicleVelCmd_Holo::ramp_time
double ramp_time
: Blending time between current and target time.
Definition: CVehicleVelCmd_Holo.h:31
mrpt::kinematics::CVehicleVelCmd_Holo::dir_local
double dir_local
: direction, relative to the current robot heading (radians).
Definition: CVehicleVelCmd_Holo.h:29
mrpt::kinematics::CVehicleSimul_Holo
Kinematic simulator of a holonomic 2D robot capable of moving in any direction, with "blended" veloci...
Definition: CVehicleSimul_Holo.h:24
mrpt::kinematics::CVehicleSimul_Holo::getVelCmdType
CVehicleVelCmd::Ptr getVelCmdType() const override
Gets an empty velocity command object that can be queried to find out the number of velcmd components...
Definition: CVehicleSimul_Holo.h:53
mrpt::kinematics::CVehicleSimul_Holo::TVelRampCmd
Definition: CVehicleSimul_Holo.h:61
ASSERTMSG_
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
Definition: exceptions.h:101
mrpt::kinematics::CVehicleSimul_Holo::TVelRampCmd::TVelRampCmd
TVelRampCmd()
Definition: CVehicleSimul_Holo.h:69
mrpt::kinematics::CVehicleVelCmd::Ptr
std::shared_ptr< CVehicleVelCmd > Ptr
Definition: CVehicleVelCmd.h:24
mrpt::kinematics::CVehicleSimul_Holo::internal_clear
void internal_clear() override
Resets all pending cmds.
Definition: CVehicleSimul_Holo.cpp:72
mrpt::kinematics::CVehicleSimul_Holo::internal_simulControlStep
void internal_simulControlStep(const double dt) override
Definition: CVehicleSimul_Holo.cpp:23
mrpt::kinematics::CVehicleSimul_Holo::TVelRampCmd::issue_time
double issue_time
time when the cmd was issued.
Definition: CVehicleSimul_Holo.h:65
mrpt::kinematics::CVehicleVelCmd_Holo
Kinematic model for.
Definition: CVehicleVelCmd_Holo.h:21
mrpt::kinematics::CVehicleSimulVirtualBase::m_odometry
mrpt::math::TPose2D m_odometry
Definition: CVehicleSimulVirtualBase.h:125
mrpt::kinematics::CVehicleVelCmd_Holo::rot_speed
double rot_speed
: (rad/s) rotational speed for rotating such as the robot slowly faces forward.
Definition: CVehicleVelCmd_Holo.h:34
mrpt::kinematics::CVehicleSimul_Holo::TVelRampCmd::init_vel
mrpt::math::TTwist2D init_vel
Definition: CVehicleSimul_Holo.h:67
mrpt::kinematics::CVehicleVelCmd
Virtual base for velocity commands of different kinematic models of planar mobile robot.
Definition: CVehicleVelCmd.h:22
mrpt::math::TTwist2D
2D twist: 2D velocity vector (vx,vy) + planar angular velocity (omega)
Definition: lightweight_geom_data.h:2145
mrpt::kinematics::CVehicleSimul_Holo::sendVelRampCmd
void sendVelRampCmd(double vel, double dir, double ramp_time, double rot_speed)
Sends a velocity cmd to the holonomic robot.
Definition: CVehicleSimul_Holo.cpp:73



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST