This is the base class for any user-defined PTG.
The class factory interface in CParameterizedTrajectoryGenerator::CreatePTG.
Papers:
Changes history:
Definition at line 56 of file CParameterizedTrajectoryGenerator.h.
#include <mrpt/nav/tpspace/CParameterizedTrajectoryGenerator.h>
Classes | |
class | CColisionGrid |
An internal class for storing the collision grid More... | |
struct | TCellForLambdaFunction |
Specifies the min/max values for "k" and "n", respectively. More... | |
Public Types | |
typedef std::vector< std::pair< uint16_t, float > > | TCollisionCell |
A list of all the pairs (alpha,distance) such as the robot collides at that cell. | |
Public Member Functions | |
virtual std::string | getDescription () const =0 |
Gets a short textual description of the PTG and its parameters. | |
virtual | ~CParameterizedTrajectoryGenerator () |
Destructor. | |
void | simulateTrajectories (uint16_t alphaValuesCount, float max_time, float max_dist, unsigned int max_n, float diferencial_t, float min_dist, float *out_max_acc_v=NULL, float *out_max_acc_w=NULL) |
The main method: solves the diferential equation to generate a family of parametrical trajectories. | |
void | saveTrajectories (mrpt::utils::CStream &out) const |
Saves the simulated trajectories and other parameters to a target stream. | |
virtual std::string | loadTrajectories (mrpt::utils::CStream &in) |
Loads the simulated trajectories and other parameters from a target stream. | |
virtual bool | inverseMap_WS2TP (float x, float y, int &out_k, float &out_d, float tolerance_dist=0.10f) const |
Computes the closest (alpha,d) TP coordinates of the trajectory point closest to the Workspace (WS) Cartesian coordinates (x,y). | |
void | lambdaFunction (float x, float y, int &out_k, float &out_d) \ |
The "lambda" function, see paper for info. | |
void | directionToMotionCommand (uint16_t k, float &out_v, float &out_w) |
Converts an "alpha" value (into the discrete set) into a feasible motion command. | |
uint16_t | getAlfaValuesCount () const |
size_t | getPointsCountInCPath_k (uint16_t k) const |
void | getCPointWhen_d_Is (float d, uint16_t k, float &x, float &y, float &phi, float &t, float *v=NULL, float *w=NULL) |
Returns the C-Space coordinates (pose) when the robot has transversed a distance d along trajectory index \k. | |
float | GetCPathPoint_x (uint16_t k, int n) const |
float | GetCPathPoint_y (uint16_t k, int n) const |
float | GetCPathPoint_phi (uint16_t k, int n) const |
float | GetCPathPoint_t (uint16_t k, int n) const |
float | GetCPathPoint_d (uint16_t k, int n) const |
float | GetCPathPoint_v (uint16_t k, int n) const |
float | GetCPathPoint_w (uint16_t k, int n) const |
float | getMax_V () const |
float | getMax_W () const |
float | getMax_V_inTPSpace () const |
float | index2alpha (uint16_t k) const |
Alfa value for the discrete corresponding value. | |
uint16_t | alpha2index (float alpha) const |
Discrete index value for the corresponding alpha value. | |
bool | debugDumpInFiles (const int nPT) |
Dump PTG trajectories in a binary file "./reactivenav.logs/PTGs/PTG%i.dat", with "%i" being the user-supplied parameter "nPT", and in FIVE text files: "./reactivenav.logs/PTGs/PTG%i_{x,y,phi,t,d}.txt". | |
void | renderPathAsSimpleLine (const uint16_t k, mrpt::opengl::CSetOfLines &gl_obj, const float decimate_distance=0.1f, const float max_path_distance=0.0f) const |
Returns the representation of one trajectory of this PTG as a 3D OpenGL object (a simple curved line). | |
bool | SaveColGridsToFile (const std::string &filename, const mrpt::math::CPolygon &computed_robotShape) |
bool | LoadColGridsFromFile (const std::string &filename, const mrpt::math::CPolygon ¤t_robotShape) |
virtual void | PTG_Generator (float alpha, float t, float x, float y, float phi, float &v, float &w)=0 |
The main method to be implemented in derived classes. | |
virtual bool | PTG_IsIntoDomain (float x, float y)=0 |
To be implemented in derived classes. | |
Static Public Member Functions | |
static CParameterizedTrajectoryGenerator * | CreatePTG (const mrpt::utils::TParameters< double > ¶ms) |
The class factory for creating a PTG from a list of parameters "params". | |
Public Attributes | |
CColisionGrid | m_collisionGrid |
The collision grid. | |
float | refDistance |
Protected Member Functions | |
CParameterizedTrajectoryGenerator (const mrpt::utils::TParameters< double > ¶ms) | |
Constructor: possible values in "params": | |
void | initializeCollisionsGrid (float refDistance, float resolution) |
Initialized the collision grid with the given size and resolution. | |
CParameterizedTrajectoryGenerator () | |
Protected constructor for CPTG_Dummy; does not init collision grid. | |
void | FreeMemory () |
Free all the memory buffers. | |
Protected Attributes | |
float | V_MAX |
float | W_MAX |
float | turningRadiusReference |
std::vector< TCPointVector > | CPoints |
mrpt::utils::CDynamicGrid< TCellForLambdaFunction > | m_lambdaFunctionOptimizer |
This grid will contain indexes data for speeding-up the default, brute-force lambda function. | |
float | maxV_inTPSpace |
uint16_t | m_alphaValuesCount |
The number of discrete values for "alpha" between -PI and +PI. | |
typedef std::vector<std::pair<uint16_t,float> > mrpt::nav::CParameterizedTrajectoryGenerator::TCollisionCell |
A list of all the pairs (alpha,distance) such as the robot collides at that cell.
Definition at line 193 of file CParameterizedTrajectoryGenerator.h.
|
protected |
Constructor: possible values in "params":
See docs of derived classes for additional parameters:
|
inlinevirtual |
Destructor.
Definition at line 88 of file CParameterizedTrajectoryGenerator.h.
|
inlineprotected |
Protected constructor for CPTG_Dummy; does not init collision grid.
Not for normal usage
Definition at line 243 of file CParameterizedTrajectoryGenerator.h.
|
inline |
Discrete index value for the corresponding alpha value.
Definition at line 157 of file CParameterizedTrajectoryGenerator.h.
|
static |
The class factory for creating a PTG from a list of parameters "params".
Possible values in "params" are:
std::logic_error | On invalid or missing parameters. |
bool mrpt::nav::CParameterizedTrajectoryGenerator::debugDumpInFiles | ( | const int | nPT | ) |
Dump PTG trajectories in a binary file "./reactivenav.logs/PTGs/PTG%i.dat", with "%i" being the user-supplied parameter "nPT", and in FIVE text files: "./reactivenav.logs/PTGs/PTG%i_{x,y,phi,t,d}.txt".
Text files are loadable from MATLAB/Octave, and can be visualized with the script [MRPT_DIR]/scripts/viewPTG.m , also online: http://mrpt.googlecode.com/svn/trunk/scripts/viewPTG.m
void mrpt::nav::CParameterizedTrajectoryGenerator::directionToMotionCommand | ( | uint16_t | k, |
float & | out_v, | ||
float & | out_w | ||
) |
Converts an "alpha" value (into the discrete set) into a feasible motion command.
|
protected |
Free all the memory buffers.
|
inline |
Definition at line 128 of file CParameterizedTrajectoryGenerator.h.
|
inline |
Definition at line 138 of file CParameterizedTrajectoryGenerator.h.
|
inline |
Definition at line 136 of file CParameterizedTrajectoryGenerator.h.
|
inline |
Definition at line 137 of file CParameterizedTrajectoryGenerator.h.
|
inline |
Definition at line 139 of file CParameterizedTrajectoryGenerator.h.
|
inline |
Definition at line 140 of file CParameterizedTrajectoryGenerator.h.
|
inline |
Definition at line 134 of file CParameterizedTrajectoryGenerator.h.
|
inline |
Definition at line 135 of file CParameterizedTrajectoryGenerator.h.
void mrpt::nav::CParameterizedTrajectoryGenerator::getCPointWhen_d_Is | ( | float | d, |
uint16_t | k, | ||
float & | x, | ||
float & | y, | ||
float & | phi, | ||
float & | t, | ||
float * | v = NULL , |
||
float * | w = NULL |
||
) |
Returns the C-Space coordinates (pose) when the robot has transversed a distance d along trajectory index \k.
Returns (0,0,0) if out of bounds.
|
pure virtual |
Gets a short textual description of the PTG and its parameters.
Implemented in mrpt::nav::CPTG_Dummy, mrpt::nav::CPTG1, mrpt::nav::CPTG2, mrpt::nav::CPTG3, mrpt::nav::CPTG4, mrpt::nav::CPTG5, mrpt::nav::CPTG6, and mrpt::nav::CPTG7.
|
inline |
Definition at line 142 of file CParameterizedTrajectoryGenerator.h.
|
inline |
Definition at line 144 of file CParameterizedTrajectoryGenerator.h.
|
inline |
Definition at line 143 of file CParameterizedTrajectoryGenerator.h.
|
inline |
Definition at line 129 of file CParameterizedTrajectoryGenerator.h.
|
inline |
Alfa value for the discrete corresponding value.
Definition at line 149 of file CParameterizedTrajectoryGenerator.h.
References M_PI.
|
protected |
Initialized the collision grid with the given size and resolution.
|
virtual |
Computes the closest (alpha,d) TP coordinates of the trajectory point closest to the Workspace (WS) Cartesian coordinates (x,y).
[in] | x | X coordinate of the query point. |
[in] | y | Y coordinate of the query point. |
[out] | out_k | Trajectory parameter index (discretized alpha value, 0-based index). |
[out] | out_d | Trajectory distance, normalized such that D_max becomes 1. |
Reimplemented in mrpt::nav::CPTG1.
void mrpt::nav::CParameterizedTrajectoryGenerator::lambdaFunction | ( | float | x, |
float | y, | ||
int & | out_k, | ||
float & | out_d | ||
) |
The "lambda" function, see paper for info.
It takes the (a,d) pair that is closest to a given location.
bool mrpt::nav::CParameterizedTrajectoryGenerator::LoadColGridsFromFile | ( | const std::string & | filename, |
const mrpt::math::CPolygon & | current_robotShape | ||
) |
|
virtual |
Loads the simulated trajectories and other parameters from a target stream.
Reimplemented in mrpt::nav::CPTG_Dummy.
|
pure virtual |
The main method to be implemented in derived classes.
Implemented in mrpt::nav::CPTG_Dummy, mrpt::nav::CPTG1, mrpt::nav::CPTG2, mrpt::nav::CPTG3, mrpt::nav::CPTG4, mrpt::nav::CPTG5, mrpt::nav::CPTG6, and mrpt::nav::CPTG7.
|
pure virtual |
To be implemented in derived classes.
Implemented in mrpt::nav::CPTG_Dummy, mrpt::nav::CPTG1, mrpt::nav::CPTG2, mrpt::nav::CPTG3, mrpt::nav::CPTG4, mrpt::nav::CPTG5, mrpt::nav::CPTG6, and mrpt::nav::CPTG7.
void mrpt::nav::CParameterizedTrajectoryGenerator::renderPathAsSimpleLine | ( | const uint16_t | k, |
mrpt::opengl::CSetOfLines & | gl_obj, | ||
const float | decimate_distance = 0.1f , |
||
const float | max_path_distance = 0.0f |
||
) | const |
Returns the representation of one trajectory of this PTG as a 3D OpenGL object (a simple curved line).
[in] | k | The 0-based index of the selected trajectory (discrete "alpha" parameter). |
[out] | gl_obj | Output object. |
[in] | decimate_distance | Minimum distance between path points (in meters). |
[in] | max_path_distance | If >0, cut the path at this distance (in meters). |
bool mrpt::nav::CParameterizedTrajectoryGenerator::SaveColGridsToFile | ( | const std::string & | filename, |
const mrpt::math::CPolygon & | computed_robotShape | ||
) |
void mrpt::nav::CParameterizedTrajectoryGenerator::saveTrajectories | ( | mrpt::utils::CStream & | out | ) | const |
Saves the simulated trajectories and other parameters to a target stream.
void mrpt::nav::CParameterizedTrajectoryGenerator::simulateTrajectories | ( | uint16_t | alphaValuesCount, |
float | max_time, | ||
float | max_dist, | ||
unsigned int | max_n, | ||
float | diferencial_t, | ||
float | min_dist, | ||
float * | out_max_acc_v = NULL , |
||
float * | out_max_acc_w = NULL |
||
) |
The main method: solves the diferential equation to generate a family of parametrical trajectories.
|
protected |
Definition at line 247 of file CParameterizedTrajectoryGenerator.h.
|
protected |
The number of discrete values for "alpha" between -PI and +PI.
Definition at line 276 of file CParameterizedTrajectoryGenerator.h.
CColisionGrid mrpt::nav::CParameterizedTrajectoryGenerator::m_collisionGrid |
The collision grid.
Definition at line 226 of file CParameterizedTrajectoryGenerator.h.
|
protected |
This grid will contain indexes data for speeding-up the default, brute-force lambda function.
Definition at line 269 of file CParameterizedTrajectoryGenerator.h.
|
protected |
Definition at line 272 of file CParameterizedTrajectoryGenerator.h.
float mrpt::nav::CParameterizedTrajectoryGenerator::refDistance |
Definition at line 233 of file CParameterizedTrajectoryGenerator.h.
|
protected |
Definition at line 246 of file CParameterizedTrajectoryGenerator.h.
|
protected |
Definition at line 245 of file CParameterizedTrajectoryGenerator.h.
|
protected |
Definition at line 245 of file CParameterizedTrajectoryGenerator.h.
Page generated by Doxygen 1.9.8 for MRPT 1.4.0 SVN: at Thu Dec 14 16:54:58 UTC 2023 |