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

Detailed Description

An implementation of the holonomic reactive navigation method "Nearness-Diagram".

The algorithm "Nearness-Diagram" was proposed in:

Nearness diagram (ND) navigation: collision avoidance in troublesome scenarios, IEEE Transactions on Robotics and Automation, Minguez, J. and Montano, L., vol. 20, no. 1, pp. 45-59, 2004.

These are the optional parameters of the method which can be set by means of a configuration file passed to the constructor or to CHolonomicND::initialize() or directly in CHolonomicND::options

# Section name can be changed via setConfigFileSectionName()
[ND_CONFIG]
factorWeights=1.0 0.5 2.0 0.4
// 1: Free space
// 2: Dist. in sectors
// 3: Closer to target (euclidean)
// 4: Hysteresis
WIDE_GAP_SIZE_PERCENT = 0.25
MAX_SECTOR_DIST_FOR_D2_PERCENT = 0.25
RISK_EVALUATION_SECTORS_PERCENT = 0.25
RISK_EVALUATION_DISTANCE = 0.15 // In normalized ps-meters [0,1]
TARGET_SLOW_APPROACHING_DISTANCE = 0.60 // For stopping gradually
TOO_CLOSE_OBSTACLE = 0.02 // In normalized ps-meters
See also
CAbstractHolonomicReactiveMethod,CReactiveNavigationSystem

Definition at line 52 of file CHolonomicND.h.

#include <mrpt/nav/holonomic/CHolonomicND.h>

Inheritance diagram for mrpt::nav::CHolonomicND:
Inheritance graph

Classes

struct  TGap
 The structure used to store a detected gap in obstacles. More...
 
struct  TOptions
 Algorithm options. More...
 

Public Types

enum  TSituations { SITUATION_TARGET_DIRECTLY = 1, SITUATION_SMALL_GAP, SITUATION_WIDE_GAP, SITUATION_NO_WAY_FOUND }
 The set of posible situations for each trajectory. More...
 
typedef std::vector< TGapTGapArray
 

Public Member Functions

voidoperator new (size_t size)
 
voidoperator new[] (size_t size)
 
void operator delete (void *ptr) throw ()
 
void operator delete[] (void *ptr) throw ()
 
void operator delete (void *memory, void *ptr) throw ()
 
voidoperator new (size_t size, const std::nothrow_t &) throw ()
 
void operator delete (void *ptr, const std::nothrow_t &) throw ()
 
 CHolonomicND (const mrpt::utils::CConfigFileBase *INI_FILE=NULL)
 Initialize the parameters of the navigator, from some configuration file, or default values if set to NULL. More...
 
void navigate (const NavInput &ni, NavOutput &no) MRPT_OVERRIDE
 Invokes the holonomic navigation algorithm itself. More...
 
void initialize (const mrpt::utils::CConfigFileBase &INI_FILE) MRPT_OVERRIDE
 Initialize the parameters of the navigator. More...
 
virtual void saveConfigFile (mrpt::utils::CConfigFileBase &c) const MRPT_OVERRIDE
 saves all available parameters, in a forma loadable by initialize() More...
 
double getTargetApproachSlowDownDistance () const MRPT_OVERRIDE
 Returns the actual value of this parameter [m], as set via the children class options structure. More...
 
void setTargetApproachSlowDownDistance (const double dist) MRPT_OVERRIDE
 Sets the actual value of this parameter [m]. More...
 
void setConfigFileSectionName (const std::string &sectName)
 Defines the name of the section used in initialize() More...
 
std::string getConfigFileSectionName () const
 Gets the name of the section used in initialize() More...
 
void setAssociatedPTG (mrpt::nav::CParameterizedTrajectoryGenerator *ptg)
 Optionally, sets the associated PTG, just in case a derived class requires this info (not required for methods where the robot kinematics are totally abstracted) More...
 
mrpt::nav::CParameterizedTrajectoryGeneratorgetAssociatedPTG () const
 Returns the pointer set by setAssociatedPTG() More...
 
void enableApproachTargetSlowDown (bool enable)
 
virtual mxArraywriteToMatlab () const
 Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. More...
 
mrpt::utils::CObjectPtr duplicateGetSmartPtr () const
 Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer). More...
 
CObjectclone () const
 Cloning interface for smart pointers. More...
 

Static Public Member Functions

static voidoperator new (size_t size, void *ptr)
 
static CAbstractHolonomicReactiveMethodCreate (const std::string &className) MRPT_NO_THROWS
 Class factory from class name, e.g. More...
 

Public Attributes

TOptions options
 Parameters of the algorithm (can be set manually or loaded from CHolonomicND::initialize or options.loadFromConfigFile(), etc.) More...
 

Static Public Attributes

static const mrpt::utils::TRuntimeClassId classCObject
 
RTTI stuff
static const mrpt::utils::TRuntimeClassId classCAbstractHolonomicReactiveMethod
 
RTTI stuff
static const mrpt::utils::TRuntimeClassId classCSerializable
 

Protected Member Functions

CSerializable virtual methods
void writeToStream (mrpt::utils::CStream &out, int *getVersion) const
 Introduces a pure virtual method responsible for writing to a CStream. More...
 
void readFromStream (mrpt::utils::CStream &in, int version)
 Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori. More...
 

Protected Attributes

mrpt::nav::CParameterizedTrajectoryGeneratorm_associatedPTG
 If applicable, this will contain the argument of the most recent call to setAssociatedPTG() More...
 
bool m_enableApproachTargetSlowDown
 Whether to decrease speed when approaching target. More...
 

Private Member Functions

unsigned int direction2sector (const double a, const unsigned int N)
 
void gapsEstimator (const std::vector< double > &obstacles, const mrpt::math::TPoint2D &in_target, TGapArray &gaps)
 Find gaps in the obtacles. More...
 
void searchBestGap (const std::vector< double > &in_obstacles, const double in_maxObsRange, const TGapArray &in_gaps, const mrpt::math::TPoint2D &in_target, unsigned int &out_selDirection, double &out_selEvaluation, TSituations &out_situation, double &out_riskEvaluation, CLogFileRecord_NDPtr log)
 Search the best gap. More...
 
void calcRepresentativeSectorForGap (TGap &gap, const mrpt::math::TPoint2D &target, const std::vector< double > &obstacles)
 Fills in the representative sector field in the gap structure: More...
 
void evaluateGaps (const std::vector< double > &in_obstacles, const double in_maxObsRange, const TGapArray &in_gaps, const unsigned int TargetSector, const float TargetDist, std::vector< double > &out_gaps_evaluation)
 Evaluate each gap: More...
 

Private Attributes

unsigned int m_last_selected_sector
 

RTTI stuff

typedef CHolonomicNDPtr Ptr
 
typedef CHolonomicNDPtr ConstPtr
 
static mrpt::utils::CLASSINIT _init_CHolonomicND
 
static mrpt::utils::TRuntimeClassId classCHolonomicND
 
static const mrpt::utils::TRuntimeClassIdclassinfo
 
static const mrpt::utils::TRuntimeClassId_GetBaseClass ()
 
virtual const mrpt::utils::TRuntimeClassIdGetRuntimeClass () const
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::utils::CObjectduplicate () const
 Returns a copy of the object, indepently of its class. More...
 
static mrpt::utils::CObjectCreateObject ()
 
static CHolonomicNDPtr Create ()
 

Member Typedef Documentation

◆ ConstPtr

typedef CHolonomicNDPtr mrpt::nav::CHolonomicND::ConstPtr

Definition at line 54 of file CHolonomicND.h.

◆ Ptr

typedef CHolonomicNDPtr mrpt::nav::CHolonomicND::Ptr

A typedef for the associated smart pointer

Definition at line 54 of file CHolonomicND.h.

◆ TGapArray

Definition at line 72 of file CHolonomicND.h.

Member Enumeration Documentation

◆ TSituations

The set of posible situations for each trajectory.

(mrpt::utils::TEnumType works with this enum)

Enumerator
SITUATION_TARGET_DIRECTLY 
SITUATION_SMALL_GAP 
SITUATION_WIDE_GAP 
SITUATION_NO_WAY_FOUND 

Definition at line 75 of file CHolonomicND.h.

Constructor & Destructor Documentation

◆ CHolonomicND()

CHolonomicND::CHolonomicND ( const mrpt::utils::CConfigFileBase INI_FILE = NULL)

Initialize the parameters of the navigator, from some configuration file, or default values if set to NULL.

Initialize the parameters of the navigator, from some configuration file, or default values if filename is set to NULL.

Definition at line 30 of file CHolonomicND.cpp.

Member Function Documentation

◆ _GetBaseClass()

static const mrpt::utils::TRuntimeClassId* mrpt::nav::CHolonomicND::_GetBaseClass ( )
staticprotected

◆ calcRepresentativeSectorForGap()

void CHolonomicND::calcRepresentativeSectorForGap ( TGap gap,
const mrpt::math::TPoint2D target,
const std::vector< double > &  obstacles 
)
private

◆ clone()

CObject* mrpt::utils::CObject::clone ( ) const
inlineinherited

Cloning interface for smart pointers.

Definition at line 143 of file CObject.h.

◆ Create() [1/2]

static CHolonomicNDPtr mrpt::nav::CHolonomicND::Create ( )
static

◆ Create() [2/2]

CAbstractHolonomicReactiveMethod * CAbstractHolonomicReactiveMethod::Create ( const std::string className)
staticinherited

Class factory from class name, e.g.

"CHolonomicVFF", etc.

Exceptions
std::logic_errorOn invalid or missing parameters.

Definition at line 50 of file CAbstractHolonomicReactiveMethod.cpp.

References mrpt::utils::TRuntimeClassId::createObject(), mrpt::utils::findRegisteredClass(), and mrpt::utils::registerAllPendingClasses().

Referenced by mrpt::nav::CAbstractPTGBasedReactive::setHolonomicMethod().

◆ CreateObject()

static mrpt::utils::CObject* mrpt::nav::CHolonomicND::CreateObject ( )
static

◆ direction2sector()

unsigned int CHolonomicND::direction2sector ( const double  a,
const unsigned int  N 
)
private

Definition at line 590 of file CHolonomicND.cpp.

References M_PI, mrpt::utils::round(), and mrpt::math::wrapToPi().

◆ duplicate()

virtual mrpt::utils::CObject* mrpt::nav::CHolonomicND::duplicate ( ) const
virtual

Returns a copy of the object, indepently of its class.

Implements mrpt::utils::CObject.

◆ duplicateGetSmartPtr()

mrpt::utils::CObjectPtr mrpt::utils::CObject::duplicateGetSmartPtr ( ) const
inlineinherited

Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).

Definition at line 140 of file CObject.h.

Referenced by mrpt::obs::CRawlog::addActions(), mrpt::slam::CIncrementalMapPartitioner::addMapFrame(), and mrpt::obs::CRawlog::addObservations().

◆ enableApproachTargetSlowDown()

void mrpt::nav::CAbstractHolonomicReactiveMethod::enableApproachTargetSlowDown ( bool  enable)
inlineinherited

◆ evaluateGaps()

void CHolonomicND::evaluateGaps ( const std::vector< double > &  in_obstacles,
const double  in_maxObsRange,
const TGapArray in_gaps,
const unsigned int  TargetSector,
const float  TargetDist,
std::vector< double > &  out_gaps_evaluation 
)
private

◆ gapsEstimator()

void CHolonomicND::gapsEstimator ( const std::vector< double > &  obstacles,
const mrpt::math::TPoint2D in_target,
TGapArray gaps 
)
private

◆ getAssociatedPTG()

mrpt::nav::CParameterizedTrajectoryGenerator * CAbstractHolonomicReactiveMethod::getAssociatedPTG ( ) const
inherited

◆ getConfigFileSectionName()

std::string CAbstractHolonomicReactiveMethod::getConfigFileSectionName ( ) const
inherited

Gets the name of the section used in initialize()

Definition at line 37 of file CAbstractHolonomicReactiveMethod.cpp.

◆ GetRuntimeClass()

virtual const mrpt::utils::TRuntimeClassId* mrpt::nav::CHolonomicND::GetRuntimeClass ( ) const
virtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::nav::CAbstractHolonomicReactiveMethod.

◆ getTargetApproachSlowDownDistance()

double mrpt::nav::CHolonomicND::getTargetApproachSlowDownDistance ( ) const
inlinevirtual

Returns the actual value of this parameter [m], as set via the children class options structure.

See also
setTargetApproachSlowDownDistance()

Implements mrpt::nav::CAbstractHolonomicReactiveMethod.

Definition at line 103 of file CHolonomicND.h.

References mrpt::nav::CHolonomicND::TOptions::TARGET_SLOW_APPROACHING_DISTANCE.

◆ initialize()

void CHolonomicND::initialize ( const mrpt::utils::CConfigFileBase INI_FILE)
virtual

Initialize the parameters of the navigator.

Implements mrpt::nav::CAbstractHolonomicReactiveMethod.

Definition at line 38 of file CHolonomicND.cpp.

◆ navigate()

void CHolonomicND::navigate ( const NavInput ni,
NavOutput no 
)
virtual

◆ operator delete() [1/3]

void mrpt::nav::CHolonomicND::operator delete ( void ptr)
throw (
)
inline

Definition at line 54 of file CHolonomicND.h.

◆ operator delete() [2/3]

void mrpt::nav::CHolonomicND::operator delete ( void memory,
void ptr 
)
throw (
)
inline

Definition at line 54 of file CHolonomicND.h.

◆ operator delete() [3/3]

void mrpt::nav::CHolonomicND::operator delete ( void ptr,
const std::nothrow_t &   
)
throw (
)
inline

Definition at line 54 of file CHolonomicND.h.

◆ operator delete[]()

void mrpt::nav::CHolonomicND::operator delete[] ( void ptr)
throw (
)
inline

Definition at line 54 of file CHolonomicND.h.

◆ operator new() [1/3]

void* mrpt::nav::CHolonomicND::operator new ( size_t  size,
const std::nothrow_t &   
)
throw (
)
inline

Definition at line 54 of file CHolonomicND.h.

◆ operator new() [2/3]

static void* mrpt::nav::CHolonomicND::operator new ( size_t  size,
void ptr 
)
inlinestatic

Definition at line 54 of file CHolonomicND.h.

◆ operator new() [3/3]

void* mrpt::nav::CHolonomicND::operator new ( size_t  size)
inline

Definition at line 54 of file CHolonomicND.h.

◆ operator new[]()

void* mrpt::nav::CHolonomicND::operator new[] ( size_t  size)
inline

Definition at line 54 of file CHolonomicND.h.

◆ readFromStream()

void CHolonomicND::readFromStream ( mrpt::utils::CStream in,
int  version 
)
protectedvirtual

Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori.

Parameters
inThe input binary stream where the object data must read from.
versionThe version of the object stored in the stream: use this version number in your code to know how to read the incoming data.
Exceptions
std::exceptionOn any error, see CStream::ReadBuffer
See also
CStream

Implements mrpt::utils::CSerializable.

Definition at line 720 of file CHolonomicND.cpp.

References mrpt::nav::CHolonomicND::TOptions::factorWeights, m_last_selected_sector, mrpt::nav::CHolonomicND::TOptions::MAX_SECTOR_DIST_FOR_D2_PERCENT, MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION, options, mrpt::nav::CHolonomicND::TOptions::RISK_EVALUATION_DISTANCE, mrpt::nav::CHolonomicND::TOptions::RISK_EVALUATION_SECTORS_PERCENT, mrpt::nav::CHolonomicND::TOptions::TARGET_SLOW_APPROACHING_DISTANCE, mrpt::nav::CHolonomicND::TOptions::TOO_CLOSE_OBSTACLE, version, and mrpt::nav::CHolonomicND::TOptions::WIDE_GAP_SIZE_PERCENT.

◆ saveConfigFile()

void CHolonomicND::saveConfigFile ( mrpt::utils::CConfigFileBase c) const
virtual

saves all available parameters, in a forma loadable by initialize()

Implements mrpt::nav::CAbstractHolonomicReactiveMethod.

Definition at line 42 of file CHolonomicND.cpp.

◆ searchBestGap()

void CHolonomicND::searchBestGap ( const std::vector< double > &  in_obstacles,
const double  in_maxObsRange,
const TGapArray in_gaps,
const mrpt::math::TPoint2D in_target,
unsigned int &  out_selDirection,
double &  out_selEvaluation,
TSituations out_situation,
double &  out_riskEvaluation,
CLogFileRecord_NDPtr  log 
)
private

◆ setAssociatedPTG()

void CAbstractHolonomicReactiveMethod::setAssociatedPTG ( mrpt::nav::CParameterizedTrajectoryGenerator ptg)
inherited

Optionally, sets the associated PTG, just in case a derived class requires this info (not required for methods where the robot kinematics are totally abstracted)

Definition at line 41 of file CAbstractHolonomicReactiveMethod.cpp.

◆ setConfigFileSectionName()

void CAbstractHolonomicReactiveMethod::setConfigFileSectionName ( const std::string sectName)
inherited

Defines the name of the section used in initialize()

Defines the name of the section (Default: "FULL_EVAL_CONFIG")

Definition at line 33 of file CAbstractHolonomicReactiveMethod.cpp.

◆ setTargetApproachSlowDownDistance()

void mrpt::nav::CHolonomicND::setTargetApproachSlowDownDistance ( const double  dist)
inlinevirtual

Sets the actual value of this parameter [m].

See also
getTargetApproachSlowDownDistance()

Implements mrpt::nav::CAbstractHolonomicReactiveMethod.

Definition at line 104 of file CHolonomicND.h.

References mrpt::nav::CHolonomicND::TOptions::TARGET_SLOW_APPROACHING_DISTANCE.

◆ writeToMatlab()

virtual mxArray* mrpt::utils::CSerializable::writeToMatlab ( ) const
inlinevirtualinherited

Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class.

Returns
A new mxArray (caller is responsible of memory freeing) or NULL is class does not support conversion to MATLAB.

Definition at line 79 of file CSerializable.h.

◆ writeToStream()

void CHolonomicND::writeToStream ( mrpt::utils::CStream out,
int *  getVersion 
) const
protectedvirtual

Introduces a pure virtual method responsible for writing to a CStream.

This can not be used directly be users, instead use "stream << object;" for writing it to a stream.

Parameters
outThe output binary stream where object must be dumped.
getVersionIf NULL, the object must be dumped. If not, only the version of the object dump must be returned in this pointer. This enables the versioning of objects dumping and backward compatibility with previously stored data.
Exceptions
std::exceptionOn any error, see CStream::WriteBuffer
See also
CStream

Implements mrpt::utils::CSerializable.

Definition at line 706 of file CHolonomicND.cpp.

References mrpt::nav::CHolonomicND::TOptions::factorWeights, m_last_selected_sector, mrpt::nav::CHolonomicND::TOptions::MAX_SECTOR_DIST_FOR_D2_PERCENT, options, mrpt::nav::CHolonomicND::TOptions::RISK_EVALUATION_DISTANCE, mrpt::nav::CHolonomicND::TOptions::RISK_EVALUATION_SECTORS_PERCENT, mrpt::nav::CHolonomicND::TOptions::TARGET_SLOW_APPROACHING_DISTANCE, mrpt::nav::CHolonomicND::TOptions::TOO_CLOSE_OBSTACLE, version, and mrpt::nav::CHolonomicND::TOptions::WIDE_GAP_SIZE_PERCENT.

Member Data Documentation

◆ _init_CHolonomicND

mrpt::utils::CLASSINIT mrpt::nav::CHolonomicND::_init_CHolonomicND
staticprotected

Definition at line 54 of file CHolonomicND.h.

◆ classCAbstractHolonomicReactiveMethod

const mrpt::utils::TRuntimeClassId mrpt::nav::CAbstractHolonomicReactiveMethod::classCAbstractHolonomicReactiveMethod
staticinherited

Definition at line 47 of file CAbstractHolonomicReactiveMethod.h.

◆ classCHolonomicND

mrpt::utils::TRuntimeClassId mrpt::nav::CHolonomicND::classCHolonomicND
static

Definition at line 54 of file CHolonomicND.h.

◆ classCObject

const mrpt::utils::TRuntimeClassId mrpt::utils::CObject::classCObject
staticinherited

Definition at line 128 of file CObject.h.

◆ classCSerializable

const mrpt::utils::TRuntimeClassId mrpt::utils::CSerializable::classCSerializable
staticinherited

Definition at line 42 of file CSerializable.h.

◆ classinfo

const mrpt::utils::TRuntimeClassId* mrpt::nav::CHolonomicND::classinfo
static

Definition at line 54 of file CHolonomicND.h.

◆ m_associatedPTG

mrpt::nav::CParameterizedTrajectoryGenerator* mrpt::nav::CAbstractHolonomicReactiveMethod::m_associatedPTG
protectedinherited

If applicable, this will contain the argument of the most recent call to setAssociatedPTG()

Definition at line 102 of file CAbstractHolonomicReactiveMethod.h.

◆ m_enableApproachTargetSlowDown

bool mrpt::nav::CAbstractHolonomicReactiveMethod::m_enableApproachTargetSlowDown
protectedinherited

Whether to decrease speed when approaching target.

Definition at line 103 of file CAbstractHolonomicReactiveMethod.h.

Referenced by mrpt::nav::CHolonomicFullEval::navigate().

◆ m_last_selected_sector

unsigned int mrpt::nav::CHolonomicND::m_last_selected_sector
private

Definition at line 107 of file CHolonomicND.h.

Referenced by readFromStream(), and writeToStream().

◆ options

TOptions mrpt::nav::CHolonomicND::options

Parameters of the algorithm (can be set manually or loaded from CHolonomicND::initialize or options.loadFromConfigFile(), etc.)

Definition at line 101 of file CHolonomicND.h.

Referenced by readFromStream(), and writeToStream().




Page generated by Doxygen 1.8.14 for MRPT 1.5.6 Git: 4c65e8431 Tue Apr 24 08:18:17 2018 +0200 at lun oct 28 01:35:26 CET 2019