Main MRPT website > C++ reference for MRPT 1.5.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  DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(CPTG_Holo_Blend, CParameterizedTrajectoryGenerator, NAV_IMPEXP)
19 
20  /** A PTG for circular-shaped robots with holonomic kinematics.
21  * - **Compatible kinematics**: Holonomic robot capable of velocity commands with a linear interpolation ("ramp "or "blending") time. See 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:
33  CPTG_Holo_Blend(const mrpt::utils::CConfigFileBase &cfg,const std::string &sSection);
34  virtual ~CPTG_Holo_Blend();
35 
36  virtual void loadFromConfigFile(const mrpt::utils::CConfigFileBase &cfg,const std::string &sSection) MRPT_OVERRIDE;
37  virtual void saveToConfigFile(mrpt::utils::CConfigFileBase &cfg,const std::string &sSection) const MRPT_OVERRIDE;
38  virtual void loadDefaultParams() MRPT_OVERRIDE;
39  virtual bool supportVelCmdNOP() const MRPT_OVERRIDE;
40  virtual double maxTimeInVelCmdNOP(int path_k) const MRPT_OVERRIDE;
41 
42  std::string getDescription() const MRPT_OVERRIDE;
43  bool inverseMap_WS2TP(double x, double y, int &out_k, double &out_d, double tolerance_dist = 0.10) const MRPT_OVERRIDE;
44  bool PTG_IsIntoDomain( double x, double y ) const MRPT_OVERRIDE;
45  void onNewNavDynamicState() MRPT_OVERRIDE;
46 
47  /** Converts a discretized "alpha" value into a feasible motion command or action. See derived classes for the meaning of these actions */
48  virtual mrpt::kinematics::CVehicleVelCmdPtr directionToMotionCommand(uint16_t k) const MRPT_OVERRIDE;
49  virtual mrpt::kinematics::CVehicleVelCmdPtr getSupportedKinematicVelocityCommand() const MRPT_OVERRIDE;
50 
51  size_t getPathStepCount(uint16_t k) const MRPT_OVERRIDE;
52  void getPathPose(uint16_t k, uint32_t step, mrpt::math::TPose2D &p) const MRPT_OVERRIDE;
53  double getPathDist(uint16_t k, uint32_t step) const MRPT_OVERRIDE;
54  bool getPathStepForDist(uint16_t k, double dist, uint32_t &out_step) const MRPT_OVERRIDE;
55  double getPathStepDuration() const MRPT_OVERRIDE;
56  double getMaxLinVel() const MRPT_OVERRIDE { return V_MAX; }
57  double getMaxAngVel() const MRPT_OVERRIDE { return W_MAX; }
58 
59  void updateTPObstacle(double ox, double oy, std::vector<double> &tp_obstacles) const MRPT_OVERRIDE;
60  void updateTPObstacleSingle(double ox, double oy, uint16_t k, double &tp_obstacle_k) const MRPT_OVERRIDE;
61 
62  static double PATH_TIME_STEP; //!< Duration of each PTG "step" (default: 10e-3=10 ms)
63  static double eps; //!< Mathematical "epsilon", to detect ill-conditioned situations (e.g. 1/0) (Default: 1e-4)
64 
65  protected:
66  double T_ramp_max;
67  double V_MAX, W_MAX;
69 
70  std::string expr_V, expr_W, expr_T_ramp;
71  mutable std::vector<int> m_pathStepCountCache;
72 
73  // Compilation of user-given expressions
75  double m_expr_dir; // Used as symbol "dir" in m_expr_v and m_expr_w
76 
77  double internal_get_v(const double dir) const; //!< Evals expr_v
78  double internal_get_w(const double dir) const; //!< Evals expr_w
79  double internal_get_T_ramp(const double dir) const; //!< Evals expr_T_ramp
80 
81  void internal_construct_exprs();
82 
83  void internal_processNewRobotShape() MRPT_OVERRIDE;
84  void internal_initialize(const std::string & cacheFilename = std::string(), const bool verbose = true) MRPT_OVERRIDE;
85  void internal_deinitialize() MRPT_OVERRIDE;
86 
87  public:
88 
89  /** Axiliary function for computing the line-integral distance along the trajectory, handling special cases of 1/0: */
90  static double calc_trans_distance_t_below_Tramp(double k2, double k4, double vxi, double vyi, double t);
91  /** Axiliary function for calc_trans_distance_t_below_Tramp() and others */
92  static double calc_trans_distance_t_below_Tramp_abc(double t, double a, double b, double c);
93 
94  };
96 
97  }
98 }
99 
double getMaxAngVel() const MRPT_OVERRIDE
Returns the maximum angular velocity expected from this PTG [rad/s].
GLdouble GLdouble t
Definition: glext.h:3610
unsigned __int16 uint16_t
Definition: rptypes.h:46
static double PATH_TIME_STEP
Duration of each PTG "step" (default: 10e-3=10 ms)
Base class for all PTGs using a 2D circular robot shape model.
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
mrpt::math::CRuntimeCompiledExpression m_expr_w
STL namespace.
A wrapper of exprtk runtime expression compiler: it takes a string representing an expression (from a...
This class allows loading and storing values and vectors of different types from a configuration text...
This is the base class for any user-defined PTG.
A PTG for circular-shaped robots with holonomic kinematics.
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
const GLubyte * c
Definition: glext.h:5590
std::vector< int > m_pathStepCountCache
GLubyte GLubyte b
Definition: glext.h:5575
GLsizei const GLchar ** string
Definition: glext.h:3919
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...
GLenum GLint GLint y
Definition: glext.h:3516
GLenum GLint x
Definition: glext.h:3516
static double eps
Mathematical "epsilon", to detect ill-conditioned situations (e.g. 1/0) (Default: 1e-4) ...
unsigned __int32 uint32_t
Definition: rptypes.h:49
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
GLubyte GLubyte GLubyte a
Definition: glext.h:5575
GLfloat GLfloat p
Definition: glext.h:5587



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