Main MRPT website > C++ reference for MRPT 1.9.9
CPTG_Holo_Blend.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 nav
17 {
18 /** A PTG for circular-shaped robots with holonomic kinematics.
19  * - **Compatible kinematics**: Holonomic robot capable of velocity commands
20  * with a linear interpolation ("ramp "or "blending") time. See
21  * mrpt::kinematics::CVehicleSimul_Holo
22  * - **Compatible robot shape**: Circular robots
23  * - **PTG parameters**: Use the app `ptg-configurator`
24  *
25  * \note [New in MRPT 1.5.0]
26  * \ingroup nav_tpspace
27  */
29 {
31  public:
34  const mrpt::utils::CConfigFileBase& cfg, const std::string& sSection);
35  virtual ~CPTG_Holo_Blend();
36 
37  virtual void loadFromConfigFile(
39  const std::string& sSection) override;
40  virtual void saveToConfigFile(
42  const std::string& sSection) const override;
43  virtual void loadDefaultParams() override;
44  virtual bool supportVelCmdNOP() const override;
45  virtual double maxTimeInVelCmdNOP(int path_k) const override;
46 
47  std::string getDescription() const override;
48  bool inverseMap_WS2TP(
49  double x, double y, int& out_k, double& out_d,
50  double tolerance_dist = 0.10) const override;
51  bool PTG_IsIntoDomain(double x, double y) const override;
52  void onNewNavDynamicState() override;
53 
54  /** Converts a discretized "alpha" value into a feasible motion command or
55  * action. See derived classes for the meaning of these actions */
57  uint16_t k) const override;
59  getSupportedKinematicVelocityCommand() const override;
60 
61  size_t getPathStepCount(uint16_t k) const override;
62  void getPathPose(
63  uint16_t k, uint32_t step, mrpt::math::TPose2D& p) const override;
64  double getPathDist(uint16_t k, uint32_t step) const override;
65  bool getPathStepForDist(
66  uint16_t k, double dist, uint32_t& out_step) const override;
67  double getPathStepDuration() const override;
68  double getMaxLinVel() const override { return V_MAX; }
69  double getMaxAngVel() const override { return W_MAX; }
70  void updateTPObstacle(
71  double ox, double oy, std::vector<double>& tp_obstacles) const override;
73  double ox, double oy, uint16_t k, double& tp_obstacle_k) const override;
74 
75  /** Duration of each PTG "step" (default: 10e-3=10 ms) */
76  static double PATH_TIME_STEP;
77  /** Mathematical "epsilon", to detect ill-conditioned situations (e.g. 1/0)
78  * (Default: 1e-4) */
79  static double eps;
80 
81  protected:
82  double T_ramp_max;
83  double V_MAX, W_MAX;
85 
87  mutable std::vector<int> m_pathStepCountCache;
88 
89  // Compilation of user-given expressions
90  mrpt::math::CRuntimeCompiledExpression m_expr_v, m_expr_w, m_expr_T_ramp;
91  double m_expr_dir; // Used as symbol "dir" in m_expr_v and m_expr_w
92 
93  /** Evals expr_v */
94  double internal_get_v(const double dir) const;
95  /** Evals expr_w */
96  double internal_get_w(const double dir) const;
97  /** Evals expr_T_ramp */
98  double internal_get_T_ramp(const double dir) const;
99 
101 
102  void internal_processNewRobotShape() override;
103  void internal_initialize(
104  const std::string& cacheFilename = std::string(),
105  const bool verbose = true) override;
106  void internal_deinitialize() override;
107 
108  public:
109  /** Axiliary function for computing the line-integral distance along the
110  * trajectory, handling special cases of 1/0: */
111  static double calc_trans_distance_t_below_Tramp(
112  double k2, double k4, double vxi, double vyi, double t);
113  /** Axiliary function for calc_trans_distance_t_below_Tramp() and others */
115  double t, double a, double b, double c);
116 };
117 }
118 }
void internal_initialize(const std::string &cacheFilename=std::string(), const bool verbose=true) override
Must be called after setting all PTG parameters and before requesting converting obstacles to TP-Spac...
GLdouble GLdouble t
Definition: glext.h:3689
unsigned __int16 uint16_t
Definition: rptypes.h:44
std::string getDescription() const override
Gets a short textual description of the PTG and its parameters.
Base class for all PTGs using a 2D circular robot shape model.
double getPathDist(uint16_t k, uint32_t step) const override
Access path k ([0,N-1]=>[-pi,pi] in alpha): traversed distance at discrete step step.
mrpt::math::CRuntimeCompiledExpression m_expr_w
bool getPathStepForDist(uint16_t k, double dist, uint32_t &out_step) const override
Access path k ([0,N-1]=>[-pi,pi] in alpha): largest step count for which the traversed distance is < ...
double getMaxAngVel() const override
Returns the maximum angular velocity expected from this PTG [rad/s].
bool PTG_IsIntoDomain(double x, double y) const override
Returns the same than inverseMap_WS2TP() but without any additional cost.
mrpt::math::CRuntimeCompiledExpression m_expr_T_ramp
void internal_deinitialize() override
This must be called to de-initialize the PTG if some parameter is to be changed.
virtual void loadFromConfigFile(const mrpt::utils::CConfigFileBase &cfg, const std::string &sSection) override
Parameters accepted by this base class:
static double calc_trans_distance_t_below_Tramp(double k2, double k4, double vxi, double vyi, double t)
Axiliary function for computing the line-integral distance along the trajectory, handling special cas...
virtual double maxTimeInVelCmdNOP(int path_k) const override
Only for PTGs supporting supportVelCmdNOP(): this is the maximum time (in seconds) for which the path...
This class allows loading and storing values and vectors of different types from a configuration text...
double internal_get_v(const double dir) const
Evals expr_v.
void getPathPose(uint16_t k, uint32_t step, mrpt::math::TPose2D &p) const override
Access path k ([0,N-1]=>[-pi,pi] in alpha): pose of the vehicle at discrete step step.
A PTG for circular-shaped robots with holonomic kinematics.
double getPathStepDuration() const override
Returns the duration (in seconds) of each "step".
const GLubyte * c
Definition: glext.h:6313
std::vector< int > m_pathStepCountCache
double internal_get_w(const double dir) const
Evals expr_w.
virtual void loadDefaultParams() override
Loads a set of default parameters; provided exclusively for the PTG-configurator tool.
GLubyte GLubyte b
Definition: glext.h:6279
void onNewNavDynamicState() override
Invoked when m_nav_dyn_state has changed; gives the PTG the opportunity to react and parameterize pat...
void updateTPObstacle(double ox, double oy, std::vector< double > &tp_obstacles) const override
Updates the radial map of closest TP-Obstacles given a single obstacle point at (ox,oy)
virtual bool supportVelCmdNOP() const override
Returns true if it is possible to stop sending velocity commands to the robot and, still, the robot controller will be able to keep following the last sent trajectory ("NOP" velocity commands).
GLsizei const GLchar ** string
Definition: glext.h:4101
bool inverseMap_WS2TP(double x, double y, int &out_k, double &out_d, double tolerance_dist=0.10) const override
Computes the closest (alpha,d) TP coordinates of the trajectory point closest to the Workspace (WS) C...
void updateTPObstacleSingle(double ox, double oy, uint16_t k, double &tp_obstacle_k) const override
Like updateTPObstacle() but for one direction only (k) in TP-Space.
static double calc_trans_distance_t_below_Tramp_abc(double t, double a, double b, double c)
Axiliary function for calc_trans_distance_t_below_Tramp() and others.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
static double PATH_TIME_STEP
Duration of each PTG "step" (default: 10e-3=10 ms)
double internal_get_T_ramp(const double dir) const
Evals expr_T_ramp.
Lightweight 2D pose.
void internal_processNewRobotShape() override
Will be called whenever the robot shape is set / updated.
double getMaxLinVel() const override
Returns the maximum linear velocity expected from this PTG [m/s].
GLenum GLint GLint y
Definition: glext.h:3538
size_t getPathStepCount(uint16_t k) const override
Access path k ([0,N-1]=>[-pi,pi] in alpha): number of discrete "steps" along the trajectory.
static double eps
Mathematical "epsilon", to detect ill-conditioned situations (e.g.
GLenum GLint x
Definition: glext.h:3538
std::shared_ptr< CVehicleVelCmd > Ptr
unsigned __int32 uint32_t
Definition: rptypes.h:47
GLubyte GLubyte GLubyte a
Definition: glext.h:6279
GLfloat GLfloat p
Definition: glext.h:6305
mrpt::math::CRuntimeCompiledExpression m_expr_v
virtual mrpt::kinematics::CVehicleVelCmd::Ptr directionToMotionCommand(uint16_t k) const override
Converts a discretized "alpha" value into a feasible motion command or action.
virtual mrpt::kinematics::CVehicleVelCmd::Ptr getSupportedKinematicVelocityCommand() const override
Returns an empty kinematic velocity command object of the type supported by this PTG.
virtual void saveToConfigFile(mrpt::utils::CConfigFileBase &cfg, const std::string &sSection) const override
This method saves the options to a ".ini"-like file or memory-stored string list. ...



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019