selfdriving
DiffDrive_C.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2023, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
13 
14 namespace mpp::ptg
15 {
16 /** A PTG for circular paths ("C" type PTG in papers).
17  * - **Compatible kinematics**: differential-driven / Ackermann steering
18  * - **Compatible robot shape**: Arbitrary 2D polygon
19  * - **PTG parameters**: Use the app `ptg-configurator`
20  *
21  * This PT generator functions are:
22  *
23  * \f[ v(\alpha) = V_{MAX} sign(K) \f]
24  * \f[ \omega(\alpha) = \dfrac{\alpha}{\pi} W_{MAX} sign(K) \f]
25  *
26  * So, the radius of curvature of each trajectory is constant for each "alpha"
27  * value (the trajectory parameter):
28  *
29  * \f[ R(\alpha) = \dfrac{v}{\omega} = \dfrac{V_{MAX}}{W_{MAX}}
30  * \dfrac{\pi}{\alpha} \f]
31  *
32  * from which a minimum radius of curvature can be set by selecting the
33  * appropriate values of V_MAX and W_MAX,
34  * knowning that \f$ \alpha \in (-\pi,\pi) \f$.
35  *
36  * ![C-PTG path examples](PTG1_paths.png)
37  *
38  * \note [Before MRPT 1.5.0 this was named CPTG1]
39  * \ingroup nav_tpspace
40  */
42 {
43  DEFINE_SERIALIZABLE(DiffDrive_C, mpp::ptg)
44  public:
45  DiffDrive_C() = default;
47  const mrpt::config::CConfigFileBase& cfg, const std::string& sSection)
48  {
49  DiffDrive_C::loadFromConfigFile(cfg, sSection);
50  }
51  void loadFromConfigFile(
52  const mrpt::config::CConfigFileBase& cfg,
53  const std::string& sSection) override;
54  void saveToConfigFile(
55  mrpt::config::CConfigFileBase& cfg,
56  const std::string& sSection) const override;
57 
58  std::string getDescription() const override;
59  bool inverseMap_WS2TP(
60  double x, double y, int& out_k, double& out_d,
61  double tolerance_dist = 0.10) const override;
62  bool PTG_IsIntoDomain(double x, double y) const override;
64  float alpha, float t, float x, float y, float phi, float& v,
65  float& w) const override;
66  void loadDefaultParams() override;
67 
68  protected:
69  /** A generation parameter */
70  double K{0};
71 };
72 } // namespace mpp::ptg
bool inverseMap_WS2TP(double x, double y, int &out_k, double &out_d, double tolerance_dist=0.10) const override
std::string getDescription() const override
DiffDrive_C(const mrpt::config::CConfigFileBase &cfg, const std::string &sSection)
Definition: DiffDrive_C.h:46
void loadFromConfigFile(const mrpt::config::CConfigFileBase &cfg, const std::string &sSection) override
Definition: SpeedTrimmablePTG.h:17
Definition: DiffDriveCollisionGridBased.h:50
Definition: DiffDrive_C.h:14
Definition: DiffDrive_C.h:41
void saveToConfigFile(mrpt::config::CConfigFileBase &cfg, const std::string &sSection) const override
void loadDefaultParams() override
double K
Definition: DiffDrive_C.h:70
void ptgDiffDriveSteeringFunction(float alpha, float t, float x, float y, float phi, float &v, float &w) const override
bool PTG_IsIntoDomain(double x, double y) const override