Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
mrpt::nav::CPTG6 Class Reference

Detailed Description

A variation of the alpha-PTG (with fixed parameters, for now)

Definition at line 21 of file CPTG6.h.

#include <mrpt/nav/tpspace/CPTG6.h>

Inheritance diagram for mrpt::nav::CPTG6:
Inheritance graph

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

 CPTG6 (const mrpt::utils::TParameters< double > &params)
 Constructor (this PTG has no parameters)
 
std::string getDescription () const
 Gets a short textual description of the PTG and its parameters.
 
bool PTG_IsIntoDomain (float x, float y)
 To be implemented in derived classes.
 
void PTG_Generator (float alpha, float t, float x, float y, float phi, float &v, float &w)
 The main method to be implemented in derived classes.
 
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 &current_robotShape)
 

Static Public Member Functions

static CParameterizedTrajectoryGeneratorCreatePTG (const mrpt::utils::TParameters< double > &params)
 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

void initializeCollisionsGrid (float refDistance, float resolution)
 Initialized the collision grid with the given size and resolution.
 
void FreeMemory ()
 Free all the memory buffers.
 

Protected Attributes

float V_MAX
 
float W_MAX
 
float turningRadiusReference
 
std::vector< TCPointVectorCPoints
 
mrpt::utils::CDynamicGrid< TCellForLambdaFunctionm_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.
 

Member Typedef Documentation

◆ TCollisionCell

typedef std::vector<std::pair<uint16_t,float> > mrpt::nav::CParameterizedTrajectoryGenerator::TCollisionCell
inherited

A list of all the pairs (alpha,distance) such as the robot collides at that cell.

  • map key (uint16_t) -> alpha value (k)
    • map value (float) -> the MINIMUM distance (d), in meters, associated with that "k".

Definition at line 193 of file CParameterizedTrajectoryGenerator.h.

Constructor & Destructor Documentation

◆ CPTG6()

mrpt::nav::CPTG6::CPTG6 ( const mrpt::utils::TParameters< double > &  params)

Constructor (this PTG has no parameters)

Member Function Documentation

◆ alpha2index()

uint16_t mrpt::nav::CParameterizedTrajectoryGenerator::alpha2index ( float  alpha) const
inlineinherited

Discrete index value for the corresponding alpha value.

See also
index2alpha

Definition at line 157 of file CParameterizedTrajectoryGenerator.h.

References M_2PI, and M_PI.

◆ CreatePTG()

static CParameterizedTrajectoryGenerator * mrpt::nav::CParameterizedTrajectoryGenerator::CreatePTG ( const mrpt::utils::TParameters< double > &  params)
staticinherited

The class factory for creating a PTG from a list of parameters "params".

Possible values in "params" are:

Exceptions
std::logic_errorOn invalid or missing parameters.

◆ debugDumpInFiles()

bool mrpt::nav::CParameterizedTrajectoryGenerator::debugDumpInFiles ( const int  nPT)
inherited

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

Note
The directory "./reactivenav.logs/PTGs" will be created if doesn't exist.
Returns
false on any error writing to disk.

◆ directionToMotionCommand()

void mrpt::nav::CParameterizedTrajectoryGenerator::directionToMotionCommand ( uint16_t  k,
float &  out_v,
float &  out_w 
)
inherited

Converts an "alpha" value (into the discrete set) into a feasible motion command.

◆ FreeMemory()

void mrpt::nav::CParameterizedTrajectoryGenerator::FreeMemory ( )
protectedinherited

Free all the memory buffers.

◆ getAlfaValuesCount()

uint16_t mrpt::nav::CParameterizedTrajectoryGenerator::getAlfaValuesCount ( ) const
inlineinherited

Definition at line 128 of file CParameterizedTrajectoryGenerator.h.

◆ GetCPathPoint_d()

float mrpt::nav::CParameterizedTrajectoryGenerator::GetCPathPoint_d ( uint16_t  k,
int  n 
) const
inlineinherited

Definition at line 138 of file CParameterizedTrajectoryGenerator.h.

◆ GetCPathPoint_phi()

float mrpt::nav::CParameterizedTrajectoryGenerator::GetCPathPoint_phi ( uint16_t  k,
int  n 
) const
inlineinherited

Definition at line 136 of file CParameterizedTrajectoryGenerator.h.

◆ GetCPathPoint_t()

float mrpt::nav::CParameterizedTrajectoryGenerator::GetCPathPoint_t ( uint16_t  k,
int  n 
) const
inlineinherited

Definition at line 137 of file CParameterizedTrajectoryGenerator.h.

◆ GetCPathPoint_v()

float mrpt::nav::CParameterizedTrajectoryGenerator::GetCPathPoint_v ( uint16_t  k,
int  n 
) const
inlineinherited

Definition at line 139 of file CParameterizedTrajectoryGenerator.h.

◆ GetCPathPoint_w()

float mrpt::nav::CParameterizedTrajectoryGenerator::GetCPathPoint_w ( uint16_t  k,
int  n 
) const
inlineinherited

Definition at line 140 of file CParameterizedTrajectoryGenerator.h.

◆ GetCPathPoint_x()

float mrpt::nav::CParameterizedTrajectoryGenerator::GetCPathPoint_x ( uint16_t  k,
int  n 
) const
inlineinherited

Definition at line 134 of file CParameterizedTrajectoryGenerator.h.

◆ GetCPathPoint_y()

float mrpt::nav::CParameterizedTrajectoryGenerator::GetCPathPoint_y ( uint16_t  k,
int  n 
) const
inlineinherited

Definition at line 135 of file CParameterizedTrajectoryGenerator.h.

◆ getCPointWhen_d_Is()

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 
)
inherited

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.

◆ getDescription()

std::string mrpt::nav::CPTG6::getDescription ( ) const
virtual

Gets a short textual description of the PTG and its parameters.

Implements mrpt::nav::CParameterizedTrajectoryGenerator.

◆ getMax_V()

float mrpt::nav::CParameterizedTrajectoryGenerator::getMax_V ( ) const
inlineinherited

Definition at line 142 of file CParameterizedTrajectoryGenerator.h.

◆ getMax_V_inTPSpace()

float mrpt::nav::CParameterizedTrajectoryGenerator::getMax_V_inTPSpace ( ) const
inlineinherited

Definition at line 144 of file CParameterizedTrajectoryGenerator.h.

◆ getMax_W()

float mrpt::nav::CParameterizedTrajectoryGenerator::getMax_W ( ) const
inlineinherited

Definition at line 143 of file CParameterizedTrajectoryGenerator.h.

◆ getPointsCountInCPath_k()

size_t mrpt::nav::CParameterizedTrajectoryGenerator::getPointsCountInCPath_k ( uint16_t  k) const
inlineinherited

Definition at line 129 of file CParameterizedTrajectoryGenerator.h.

◆ index2alpha()

float mrpt::nav::CParameterizedTrajectoryGenerator::index2alpha ( uint16_t  k) const
inlineinherited

Alfa value for the discrete corresponding value.

See also
alpha2index

Definition at line 149 of file CParameterizedTrajectoryGenerator.h.

References M_PI.

◆ initializeCollisionsGrid()

void mrpt::nav::CParameterizedTrajectoryGenerator::initializeCollisionsGrid ( float  refDistance,
float  resolution 
)
protectedinherited

Initialized the collision grid with the given size and resolution.

◆ inverseMap_WS2TP()

virtual bool mrpt::nav::CParameterizedTrajectoryGenerator::inverseMap_WS2TP ( float  x,
float  y,
int &  out_k,
float &  out_d,
float  tolerance_dist = 0.10f 
) const
virtualinherited

Computes the closest (alpha,d) TP coordinates of the trajectory point closest to the Workspace (WS) Cartesian coordinates (x,y).

Parameters
[in]xX coordinate of the query point.
[in]yY coordinate of the query point.
[out]out_kTrajectory parameter index (discretized alpha value, 0-based index).
[out]out_dTrajectory distance, normalized such that D_max becomes 1.
Returns
true if the distance between (x,y) and the actual trajectory point is below the given tolerance (in meters).
Note
The default implementation in CParameterizedTrajectoryGenerator relies on a look-up-table. Derived classes may redefine this to closed-form expressions, when they exist.

Reimplemented in mrpt::nav::CPTG1.

◆ lambdaFunction()

void mrpt::nav::CParameterizedTrajectoryGenerator::lambdaFunction ( float  x,
float  y,
int &  out_k,
float &  out_d 
)
inherited

The "lambda" function, see paper for info.

It takes the (a,d) pair that is closest to a given location.

◆ LoadColGridsFromFile()

bool mrpt::nav::CParameterizedTrajectoryGenerator::LoadColGridsFromFile ( const std::string &  filename,
const mrpt::math::CPolygon current_robotShape 
)
inherited

◆ loadTrajectories()

virtual std::string mrpt::nav::CParameterizedTrajectoryGenerator::loadTrajectories ( mrpt::utils::CStream in)
virtualinherited

Loads the simulated trajectories and other parameters from a target stream.

Returns
The PTG textual description

Reimplemented in mrpt::nav::CPTG_Dummy.

◆ PTG_Generator()

void mrpt::nav::CPTG6::PTG_Generator ( float  alpha,
float  t,
float  x,
float  y,
float  phi,
float &  v,
float &  w 
)
virtual

The main method to be implemented in derived classes.

Implements mrpt::nav::CParameterizedTrajectoryGenerator.

◆ PTG_IsIntoDomain()

bool mrpt::nav::CPTG6::PTG_IsIntoDomain ( float  x,
float  y 
)
virtual

To be implemented in derived classes.

Implements mrpt::nav::CParameterizedTrajectoryGenerator.

◆ renderPathAsSimpleLine()

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
inherited

Returns the representation of one trajectory of this PTG as a 3D OpenGL object (a simple curved line).

Parameters
[in]kThe 0-based index of the selected trajectory (discrete "alpha" parameter).
[out]gl_objOutput object.
[in]decimate_distanceMinimum distance between path points (in meters).
[in]max_path_distanceIf >0, cut the path at this distance (in meters).

◆ SaveColGridsToFile()

bool mrpt::nav::CParameterizedTrajectoryGenerator::SaveColGridsToFile ( const std::string &  filename,
const mrpt::math::CPolygon computed_robotShape 
)
inherited

◆ saveTrajectories()

void mrpt::nav::CParameterizedTrajectoryGenerator::saveTrajectories ( mrpt::utils::CStream out) const
inherited

Saves the simulated trajectories and other parameters to a target stream.

◆ simulateTrajectories()

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 
)
inherited

The main method: solves the diferential equation to generate a family of parametrical trajectories.

Member Data Documentation

◆ CPoints

std::vector<TCPointVector> mrpt::nav::CParameterizedTrajectoryGenerator::CPoints
protectedinherited

Definition at line 247 of file CParameterizedTrajectoryGenerator.h.

◆ m_alphaValuesCount

uint16_t mrpt::nav::CParameterizedTrajectoryGenerator::m_alphaValuesCount
protectedinherited

The number of discrete values for "alpha" between -PI and +PI.

Definition at line 276 of file CParameterizedTrajectoryGenerator.h.

◆ m_collisionGrid

CColisionGrid mrpt::nav::CParameterizedTrajectoryGenerator::m_collisionGrid
inherited

The collision grid.

Definition at line 226 of file CParameterizedTrajectoryGenerator.h.

◆ m_lambdaFunctionOptimizer

mrpt::utils::CDynamicGrid<TCellForLambdaFunction> mrpt::nav::CParameterizedTrajectoryGenerator::m_lambdaFunctionOptimizer
protectedinherited

This grid will contain indexes data for speeding-up the default, brute-force lambda function.

Definition at line 269 of file CParameterizedTrajectoryGenerator.h.

◆ maxV_inTPSpace

float mrpt::nav::CParameterizedTrajectoryGenerator::maxV_inTPSpace
protectedinherited

Definition at line 272 of file CParameterizedTrajectoryGenerator.h.

◆ refDistance

float mrpt::nav::CParameterizedTrajectoryGenerator::refDistance
inherited

Definition at line 233 of file CParameterizedTrajectoryGenerator.h.

◆ turningRadiusReference

float mrpt::nav::CParameterizedTrajectoryGenerator::turningRadiusReference
protectedinherited

Definition at line 246 of file CParameterizedTrajectoryGenerator.h.

◆ V_MAX

float mrpt::nav::CParameterizedTrajectoryGenerator::V_MAX
protectedinherited

Definition at line 245 of file CParameterizedTrajectoryGenerator.h.

◆ W_MAX

float mrpt::nav::CParameterizedTrajectoryGenerator::W_MAX
protectedinherited

Definition at line 245 of file CParameterizedTrajectoryGenerator.h.




Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Wed Mar 22 04:35:51 UTC 2023