34 const int WN = 25, WV = 30;
38 sSection,
"K", K, WN, WV,
39 "K=+1 forward paths; K=-1 for backwards paths.");
72 [[maybe_unused]]
float alpha, [[maybe_unused]]
float t,
73 [[maybe_unused]]
float x, [[maybe_unused]]
float y,
74 [[maybe_unused]]
float phi, [[maybe_unused]]
float& v,
75 [[maybe_unused]]
float& w)
const 80 w = (alpha /
M_PI) * W_MAX *
sign(K);
84 [[maybe_unused]]
double x, [[maybe_unused]]
double y)
const 90 double x,
double y,
int& k_out,
double& d_out,
91 [[maybe_unused]]
double tolerance_dist)
const 96 double R = (x * x + y * y) / (2 * y);
97 const double Rmin = std::abs(V_MAX / W_MAX);
104 theta = atan2((
double)x, fabs(
R) - y);
106 theta = atan2((
double)x, y + fabs(
R));
111 theta = atan2(-(
double)x, fabs(
R) - y);
113 theta = atan2(-(
double)x, y + fabs(
R));
120 d_out = (float)(theta * (fabs(
R) + turningRadiusReference));
122 if (std::abs(
R) < Rmin)
129 const double a =
M_PI * V_MAX / (W_MAX *
R);
130 k_out = alpha2index((
float)a);
136 k_out = alpha2index(0);
142 k_out = m_alphaValuesCount - 1;
149 d_out = d_out / refDistance;
bool PTG_IsIntoDomain(double x, double y) const override
Returns the same than inverseMap_WS2TP() but without any additional cost.
void loadFromConfigFile(const mrpt::config::CConfigFileBase &cfg, const std::string &sSection) override
Possible values in "params" (those in CParameterizedTrajectoryGenerator, which is called internally...
std::string std::string format(std::string_view fmt, ARGS &&... args)
void loadDefaultParams() override
Loads a set of default parameters; provided exclusively for the PTG-configurator tool.
#define ASSERT_BELOW_(__A, __B)
void saveToConfigFile(mrpt::config::CConfigFileBase &cfg, const std::string &sSection) const override
This method saves the options to a ".ini"-like file or memory-stored string list. ...
void internal_readFromStream(mrpt::serialization::CArchive &in) override
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
void ptgDiffDriveSteeringFunction(float alpha, float t, float x, float y, float phi, float &v, float &w) const override
The main method to be implemented in derived classes: it defines the differential-driven differential...
std::string getDescription() const override
Gets a short textual description of the PTG and its parameters.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This is the base class for any user-defined PTG.
This class allows loading and storing values and vectors of different types from a configuration text...
int sign(T x)
Returns the sign of X as "1" or "-1".
#define MRPT_LOAD_CONFIG_VAR_NO_DEFAULT( variableName, variableType, configFileObject, sectionNameStr)
#define ASSERT_ABOVEEQ_(__A, __B)
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
void write(const std::string §ion, const std::string &name, enum_t value, const int name_padding_width=-1, const int value_padding_width=-1, const std::string &comment=std::string())
void wrapTo2PiInPlace(T &a)
Modifies the given angle to translate it into the [0,2pi[ range.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
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...
Virtual base class for "archives": classes abstracting I/O streams.
mrpt::vision::TStereoCalibResults out
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
IMPLEMENTS_SERIALIZABLE(CPTG_DiffDrive_C, CParameterizedTrajectoryGenerator, mrpt::nav) void CPTG_DiffDrive_C
void loadDefaultParams() override
Loads a set of default parameters; provided exclusively for the PTG-configurator tool.
void loadFromConfigFile(const mrpt::config::CConfigFileBase &cfg, const std::string &sSection) override
Parameters accepted by this base class:
void saveToConfigFile(mrpt::config::CConfigFileBase &cfg, const std::string &sSection) const override
This method saves the options to a ".ini"-like file or memory-stored string list. ...
A PTG for circular paths ("C" type PTG in papers).
void internal_writeToStream(mrpt::serialization::CArchive &out) const override