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

Detailed Description

Full evaluation of all possible directions within the discrete set of input directions.

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

# Section name can be changed via setConfigFileSectionName()
[FULL_EVAL_CONFIG]
factorWeights = 1.0 1.0 1.0 0.05 1.0
factorNormalizeOrNot = 0 0 0 0 1
// 0: Clearness in direction
// 1: Closest approach to target along straight line (Euclidean)
// 2: Distance of end collision-free point to target (Euclidean)
// 3: Hysteresis
// 4: Clearness to nearest obstacle along path
TARGET_SLOW_APPROACHING_DISTANCE = 0.20 // Start to reduce speed when
closer than this to target [m]
TOO_CLOSE_OBSTACLE = 0.02 // Directions with collision-free
distances below this threshold are not elegible.
HYSTERESIS_SECTOR_COUNT = 5 // Range of "sectors" (directions)
for hysteresis over successive timesteps
PHASE1_FACTORS = 0 1 2 // Indices of the factors above to
be considered in phase 1
PHASE2_FACTORS = 3 4 // Indices of the factors above to
be considered in phase 2
PHASE1_THRESHOLD = 0.75 // Phase1 scores must be above this
relative range threshold [0,1] to be considered in phase 2 (Default:`0.75`)
See also
CAbstractHolonomicReactiveMethod,CReactiveNavigationSystem

Definition at line 57 of file CHolonomicFullEval.h.

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

Inheritance diagram for mrpt::nav::CHolonomicFullEval:
Inheritance graph

Classes

struct  EvalOutput
 
struct  TOptions
 Algorithm options. More...
 

Public Member Functions

voidoperator new (size_t size)
 
voidoperator new[] (size_t size)
 
void operator delete (void *ptr) noexcept
 
void operator delete[] (void *ptr) noexcept
 
void operator delete (void *memory, void *ptr) noexcept
 
voidoperator new (size_t size, const std::nothrow_t &) noexcept
 
void operator delete (void *ptr, const std::nothrow_t &) noexcept
 
 CHolonomicFullEval (const mrpt::config::CConfigFileBase *INI_FILE=nullptr)
 Initialize the parameters of the navigator, from some configuration file, or default values if set to nullptr. More...
 
void navigate (const NavInput &ni, NavOutput &no) override
 Invokes the holonomic navigation algorithm itself. More...
 
virtual void initialize (const mrpt::config::CConfigFileBase &INI_FILE) override
 Initialize the parameters of the navigator, reading from the default section name (see derived classes) or the one set via setConfigFileSectionName() More...
 
virtual void saveConfigFile (mrpt::config::CConfigFileBase &c) const override
 saves all available parameters, in a forma loadable by initialize() More...
 
double getTargetApproachSlowDownDistance () const override
 Returns the actual value of this parameter [m], as set via the children class options structure. More...
 
void setTargetApproachSlowDownDistance (const double dist) 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...
 

Static Public Member Functions

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

Public Attributes

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

Protected Member Functions

CSerializable virtual methods
uint8_t serializeGetVersion () const override
 Must return the current versioning number of the object. More...
 
void serializeTo (mrpt::serialization::CArchive &out) const override
 Pure virtual method for writing (serializing) to an abstract archive. More...
 
void serializeFrom (mrpt::serialization::CArchive &in, uint8_t serial_version) override
 Pure virtual method for reading (deserializing) from an abstract archive. 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)
 
virtual void postProcessDirectionEvaluations (std::vector< double > &dir_evals, const NavInput &ni, unsigned int trg_idx)
 
void evalSingleTarget (unsigned int target_idx, const NavInput &ni, EvalOutput &eo)
 Evals one single target of the potentially many of them in NavInput. More...
 

Private Attributes

unsigned int m_last_selected_sector
 
mrpt::math::CMatrixD m_dirs_scores
 Individual scores for each direction: (i,j), i (row) are directions, j (cols) are scores. More...
 
mrpt::obs::CSinCosLookUpTableFor2DScans m_sincos_lut
 
std::string m_cfgSectionName
 used in setConfigFileSectionName(), initialize() More...
 

RTTI stuff


using Ptr = std::shared_ptr< CHolonomicFullEval >
 
using ConstPtr = std::shared_ptr< const CHolonomicFullEval >
 
using UniquePtr = std::unique_ptr< CHolonomicFullEval >
 
using ConstUniquePtr = std::unique_ptr< const CHolonomicFullEval >
 
static mrpt::rtti::CLASSINIT _init_CHolonomicFullEval
 
static const mrpt::rtti::TRuntimeClassId runtimeClassId
 
static constexpr const char * className = "CHolonomicFullEval"
 
static const mrpt::rtti::TRuntimeClassId_GetBaseClass ()
 
static constexpr auto getClassName ()
 
static const mrpt::rtti::TRuntimeClassIdGetRuntimeClassIdStatic ()
 
static mrpt::rtti::CObjectCreateObject ()
 
template<typename... Args>
static Ptr Create (Args &&... args)
 
template<typename... Args>
static UniquePtr CreateUnique (Args &&... args)
 
virtual const mrpt::rtti::TRuntimeClassIdGetRuntimeClass () const override
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::rtti::CObjectclone () const override
 Returns a deep copy (clone) of the object, indepently of its class. More...
 

Member Typedef Documentation

◆ ConstPtr

Definition at line 59 of file CHolonomicFullEval.h.

◆ ConstUniquePtr

Definition at line 59 of file CHolonomicFullEval.h.

◆ Ptr

A type for the associated smart pointer

Definition at line 59 of file CHolonomicFullEval.h.

◆ UniquePtr

Definition at line 59 of file CHolonomicFullEval.h.

Constructor & Destructor Documentation

◆ CHolonomicFullEval()

CHolonomicFullEval::CHolonomicFullEval ( const mrpt::config::CConfigFileBase INI_FILE = nullptr)

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

Definition at line 32 of file CHolonomicFullEval.cpp.

Member Function Documentation

◆ _GetBaseClass()

static const mrpt::rtti::TRuntimeClassId* mrpt::nav::CHolonomicFullEval::_GetBaseClass ( )
staticprotected

◆ clone()

virtual mrpt::rtti::CObject* mrpt::nav::CHolonomicFullEval::clone ( ) const
overridevirtual

Returns a deep copy (clone) of the object, indepently of its class.

Implements mrpt::rtti::CObject.

◆ Create() [1/2]

template<typename... Args>
static Ptr mrpt::nav::CHolonomicFullEval::Create ( Args &&...  args)
inlinestatic

Definition at line 59 of file CHolonomicFullEval.h.

◆ Create() [2/2]

static CAbstractHolonomicReactiveMethod* mrpt::nav::CAbstractHolonomicReactiveMethod::Create ( const std::string className)
staticnoexceptinherited

Class factory from class name, e.g.

"CHolonomicVFF", etc.

Exceptions
std::logic_errorOn invalid or missing parameters.

◆ CreateObject()

static mrpt::rtti::CObject* mrpt::nav::CHolonomicFullEval::CreateObject ( )
static

◆ CreateUnique()

template<typename... Args>
static UniquePtr mrpt::nav::CHolonomicFullEval::CreateUnique ( Args &&...  args)
inlinestatic

Definition at line 59 of file CHolonomicFullEval.h.

◆ direction2sector()

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

Definition at line 581 of file CHolonomicFullEval.cpp.

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

◆ duplicateGetSmartPtr()

mrpt::rtti::CObject::Ptr 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 169 of file CObject.h.

References mrpt::rtti::CObject::clone().

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

◆ enableApproachTargetSlowDown()

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

◆ evalSingleTarget()

void CHolonomicFullEval::evalSingleTarget ( unsigned int  target_idx,
const NavInput ni,
EvalOutput eo 
)
private

Evals one single target of the potentially many of them in NavInput.

Definition at line 73 of file CHolonomicFullEval.cpp.

References mrpt::abs_diff(), mrpt::nav::CParameterizedTrajectoryGenerator::alpha2index(), mrpt::obs::T2DScanProperties::aperture, ASSERT_, mrpt::nav::CHolonomicFullEval::EvalOutput::best_eval, mrpt::nav::CHolonomicFullEval::EvalOutput::best_k, mrpt::nav::CAbstractHolonomicReactiveMethod::NavInput::clearance, mrpt::nav::CHolonomicFullEval::TOptions::clearance_threshold_ratio, mrpt::math::TSegment2D::distance(), mrpt::nav::CHolonomicFullEval::TOptions::factorNormalizeOrNot, mrpt::nav::CHolonomicFullEval::TOptions::factorWeights, mrpt::nav::CHolonomicFullEval::TOptions::gap_width_ratio_threshold, mrpt::nav::CAbstractHolonomicReactiveMethod::getAssociatedPTG(), mrpt::nav::ClearanceDiagram::getClearance(), mrpt::obs::CSinCosLookUpTableFor2DScans::getSinCosForScan(), mrpt::nav::CHolonomicFullEval::TOptions::HYSTERESIS_SECTOR_COUNT, INVALID_K, TGap::k_from, TGap::k_to, mrpt::keep_max(), mrpt::keep_min(), m_dirs_scores, m_last_selected_sector, M_PI, m_sincos_lut, TGap::max_eval, min, mmin(), mrpt::math::norm(), mrpt::obs::T2DScanProperties::nRays, mrpt::nav::CAbstractHolonomicReactiveMethod::NavInput::obstacles, options, mrpt::nav::CHolonomicFullEval::TOptions::PHASE_FACTORS, mrpt::nav::CHolonomicFullEval::EvalOutput::phase_scores, mrpt::nav::CHolonomicFullEval::TOptions::PHASE_THRESHOLDS, mrpt::math::TSegment2D::point1, mrpt::math::TSegment2D::point2, postProcessDirectionEvaluations(), mrpt::obs::T2DScanProperties::rightToLeft, mrpt::round(), mrpt::square(), mrpt::nav::CAbstractHolonomicReactiveMethod::NavInput::targets, mrpt::nav::CHolonomicFullEval::TOptions::TOO_CLOSE_OBSTACLE, val, mrpt::math::TPoint2D::x, and mrpt::math::TPoint2D::y.

Referenced by navigate().

◆ Factory()

CAbstractHolonomicReactiveMethod::Ptr CAbstractHolonomicReactiveMethod::Factory ( const std::string className)
staticnoexceptinherited

◆ getAssociatedPTG()

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

◆ getClassName()

static constexpr auto mrpt::nav::CHolonomicFullEval::getClassName ( )
inlinestaticconstexpr

Definition at line 59 of file CHolonomicFullEval.h.

◆ getConfigFileSectionName()

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

Gets the name of the section used in initialize()

Definition at line 35 of file CAbstractHolonomicReactiveMethod.cpp.

References mrpt::nav::CAbstractHolonomicReactiveMethod::m_cfgSectionName.

◆ GetRuntimeClass()

virtual const mrpt::rtti::TRuntimeClassId* mrpt::nav::CHolonomicFullEval::GetRuntimeClass ( ) const
overridevirtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::nav::CAbstractHolonomicReactiveMethod.

◆ GetRuntimeClassIdStatic()

static const mrpt::rtti::TRuntimeClassId& mrpt::nav::CHolonomicFullEval::GetRuntimeClassIdStatic ( )
static

◆ getTargetApproachSlowDownDistance()

double mrpt::nav::CHolonomicFullEval::getTargetApproachSlowDownDistance ( ) const
inlineoverridevirtual

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 123 of file CHolonomicFullEval.h.

References options, and mrpt::nav::CHolonomicFullEval::TOptions::TARGET_SLOW_APPROACHING_DISTANCE.

◆ initialize()

void CHolonomicFullEval::initialize ( const mrpt::config::CConfigFileBase c)
overridevirtual

Initialize the parameters of the navigator, reading from the default section name (see derived classes) or the one set via setConfigFileSectionName()

Implements mrpt::nav::CAbstractHolonomicReactiveMethod.

Definition at line 45 of file CHolonomicFullEval.cpp.

◆ navigate()

void CHolonomicFullEval::navigate ( const NavInput ni,
NavOutput no 
)
overridevirtual

◆ operator delete() [1/3]

void mrpt::nav::CHolonomicFullEval::operator delete ( void memory,
void ptr 
)
inlinenoexcept

Definition at line 59 of file CHolonomicFullEval.h.

◆ operator delete() [2/3]

void mrpt::nav::CHolonomicFullEval::operator delete ( void ptr)
inlinenoexcept

Definition at line 59 of file CHolonomicFullEval.h.

◆ operator delete() [3/3]

void mrpt::nav::CHolonomicFullEval::operator delete ( void ptr,
const std::nothrow_t &   
)
inlinenoexcept

Definition at line 59 of file CHolonomicFullEval.h.

◆ operator delete[]()

void mrpt::nav::CHolonomicFullEval::operator delete[] ( void ptr)
inlinenoexcept

Definition at line 59 of file CHolonomicFullEval.h.

◆ operator new() [1/3]

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

Definition at line 59 of file CHolonomicFullEval.h.

◆ operator new() [2/3]

void* mrpt::nav::CHolonomicFullEval::operator new ( size_t  size,
const std::nothrow_t &   
)
inlinenoexcept

Definition at line 59 of file CHolonomicFullEval.h.

◆ operator new() [3/3]

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

Definition at line 59 of file CHolonomicFullEval.h.

◆ operator new[]()

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

Definition at line 59 of file CHolonomicFullEval.h.

◆ postProcessDirectionEvaluations()

void CHolonomicFullEval::postProcessDirectionEvaluations ( std::vector< double > &  dir_evals,
const NavInput ni,
unsigned int  trg_idx 
)
privatevirtual

Definition at line 843 of file CHolonomicFullEval.cpp.

Referenced by evalSingleTarget().

◆ saveConfigFile()

void CHolonomicFullEval::saveConfigFile ( mrpt::config::CConfigFileBase c) const
overridevirtual

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

Implements mrpt::nav::CAbstractHolonomicReactiveMethod.

Definition at line 40 of file CHolonomicFullEval.cpp.

◆ serializeFrom()

void CHolonomicFullEval::serializeFrom ( mrpt::serialization::CArchive in,
uint8_t  serial_version 
)
overrideprotectedvirtual

◆ serializeGetVersion()

uint8_t CHolonomicFullEval::serializeGetVersion ( ) const
overrideprotectedvirtual

Must return the current versioning number of the object.

Start in zero for new classes, and increments each time there is a change in the stored format.

Implements mrpt::serialization::CSerializable.

Definition at line 773 of file CHolonomicFullEval.cpp.

◆ serializeTo()

void CHolonomicFullEval::serializeTo ( mrpt::serialization::CArchive out) const
overrideprotectedvirtual

◆ 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 40 of file CAbstractHolonomicReactiveMethod.cpp.

References mrpt::nav::CAbstractHolonomicReactiveMethod::m_associatedPTG.

◆ 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 30 of file CAbstractHolonomicReactiveMethod.cpp.

References mrpt::nav::CAbstractHolonomicReactiveMethod::m_cfgSectionName.

◆ setTargetApproachSlowDownDistance()

void mrpt::nav::CHolonomicFullEval::setTargetApproachSlowDownDistance ( const double  dist)
inlineoverridevirtual

◆ writeToMatlab()

virtual mxArray* mrpt::serialization::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 nullptr is class does not support conversion to MATLAB.

Definition at line 70 of file CSerializable.h.

Member Data Documentation

◆ _init_CHolonomicFullEval

mrpt::rtti::CLASSINIT mrpt::nav::CHolonomicFullEval::_init_CHolonomicFullEval
staticprotected

Definition at line 59 of file CHolonomicFullEval.h.

◆ className

constexpr const char* mrpt::nav::CHolonomicFullEval::className = "CHolonomicFullEval"
staticconstexpr

Definition at line 59 of file CHolonomicFullEval.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 130 of file CAbstractHolonomicReactiveMethod.h.

Referenced by mrpt::nav::CAbstractHolonomicReactiveMethod::getAssociatedPTG(), and mrpt::nav::CAbstractHolonomicReactiveMethod::setAssociatedPTG().

◆ m_cfgSectionName

std::string mrpt::nav::CAbstractHolonomicReactiveMethod::m_cfgSectionName
privateinherited

◆ m_dirs_scores

mrpt::math::CMatrixD mrpt::nav::CHolonomicFullEval::m_dirs_scores
private

Individual scores for each direction: (i,j), i (row) are directions, j (cols) are scores.

Not all directions may have evaluations, in which case a "-1" value will be found.

Definition at line 138 of file CHolonomicFullEval.h.

Referenced by evalSingleTarget(), and navigate().

◆ m_enableApproachTargetSlowDown

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

Whether to decrease speed when approaching target.

Definition at line 132 of file CAbstractHolonomicReactiveMethod.h.

Referenced by mrpt::nav::CAbstractHolonomicReactiveMethod::enableApproachTargetSlowDown(), and navigate().

◆ m_last_selected_sector

unsigned int mrpt::nav::CHolonomicFullEval::m_last_selected_sector
private

Definition at line 133 of file CHolonomicFullEval.h.

Referenced by evalSingleTarget(), navigate(), serializeFrom(), and serializeTo().

◆ m_sincos_lut

mrpt::obs::CSinCosLookUpTableFor2DScans mrpt::nav::CHolonomicFullEval::m_sincos_lut
private

Definition at line 158 of file CHolonomicFullEval.h.

Referenced by evalSingleTarget().

◆ options

TOptions mrpt::nav::CHolonomicFullEval::options

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

Definition at line 121 of file CHolonomicFullEval.h.

Referenced by evalSingleTarget(), getTargetApproachSlowDownDistance(), navigate(), serializeFrom(), serializeTo(), and setTargetApproachSlowDownDistance().

◆ runtimeClassId

const mrpt::rtti::TRuntimeClassId mrpt::nav::CHolonomicFullEval::runtimeClassId
staticprotected

Definition at line 59 of file CHolonomicFullEval.h.

in
GLuint in
Definition: glext.h:7274
range
GLsizei range
Definition: glext.h:5907



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST