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
Definition at line 55 of file CHolonomicND.h.
#include <mrpt/nav/holonomic/CHolonomicND.h>
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< TGap > | TGapArray |
Public Member Functions | |
void * | operator new (size_t size) |
void * | operator new[] (size_t size) |
void | operator delete (void *ptr) noexcept |
void | operator delete[] (void *ptr) noexcept |
void | operator delete (void *memory, void *ptr) noexcept |
void * | operator new (size_t size, const std::nothrow_t &) noexcept |
void | operator delete (void *ptr, const std::nothrow_t &) noexcept |
CHolonomicND (const mrpt::utils::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... | |
void | initialize (const mrpt::utils::CConfigFileBase &INI_FILE) override |
Initialize the parameters of the navigator. More... | |
virtual void | saveConfigFile (mrpt::utils::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 §Name) |
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::CParameterizedTrajectoryGenerator * | getAssociatedPTG () const |
Returns the pointer set by setAssociatedPTG() More... | |
void | enableApproachTargetSlowDown (bool enable) |
virtual mxArray * | writeToMatlab () 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... | |
RTTI classes and functions | |
mrpt::utils::CObject::Ptr | 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... | |
Static Public Member Functions | |
static void * | operator new (size_t size, void *ptr) |
static CAbstractHolonomicReactiveMethod::Ptr | Factory (const std::string &className) noexcept |
static CAbstractHolonomicReactiveMethod * | Create (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 CHolonomicND::initialize or options.loadFromConfigFile(), etc.) More... | |
Protected Member Functions | |
CSerializable virtual methods | |
void | writeToStream (mrpt::utils::CStream &out, int *getVersion) const override |
Introduces a pure virtual method responsible for writing to a CStream. More... | |
void | readFromStream (mrpt::utils::CStream &in, int version) override |
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::CParameterizedTrajectoryGenerator * | m_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_ND &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 | |
using | Ptr = std::shared_ptr< CHolonomicND > |
using | ConstPtr = std::shared_ptr< const CHolonomicND > |
static mrpt::utils::CLASSINIT | _init_CHolonomicND |
static const mrpt::utils::TRuntimeClassId | runtimeClassId |
static constexpr const char * | className = "CHolonomicND" |
static const mrpt::utils::TRuntimeClassId * | _GetBaseClass () |
static const mrpt::utils::TRuntimeClassId & | GetRuntimeClassIdStatic () |
static mrpt::utils::CObject * | CreateObject () |
template<typename... Args> | |
static Ptr | Create (Args &&... args) |
virtual const mrpt::utils::TRuntimeClassId * | GetRuntimeClass () const override |
Returns information about the class of an object in runtime. More... | |
virtual mrpt::utils::CObject * | clone () const override |
Returns a deep copy (clone) of the object, indepently of its class. More... | |
using mrpt::nav::CHolonomicND::ConstPtr = std::shared_ptr<const CHolonomicND > |
Definition at line 57 of file CHolonomicND.h.
using mrpt::nav::CHolonomicND::Ptr = std::shared_ptr< CHolonomicND > |
A typedef for the associated smart pointer
Definition at line 57 of file CHolonomicND.h.
typedef std::vector<TGap> mrpt::nav::CHolonomicND::TGapArray |
Definition at line 76 of file CHolonomicND.h.
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 80 of file CHolonomicND.h.
mrpt::nav::CHolonomicND::CHolonomicND | ( | const mrpt::utils::CConfigFileBase * | INI_FILE = nullptr | ) |
Initialize the parameters of the navigator, from some configuration file, or default values if set to nullptr.
|
staticprotected |
|
private |
Fills in the representative sector field in the gap structure:
Definition at line 446 of file CHolonomicND.cpp.
References mrpt::mrpt::utils::abs_diff(), mrpt::nav::CHolonomicND::TGap::end, mrpt::nav::CHolonomicND::TGap::ini, mrpt::utils::keep_max(), mrpt::utils::keep_min(), min, mrpt::nav::CHolonomicND::TGap::representative_sector, mrpt::utils::round(), mrpt::math::TPoint2D::x, and mrpt::math::TPoint2D::y.
|
overridevirtual |
Returns a deep copy (clone) of the object, indepently of its class.
Implements mrpt::utils::CObject.
|
inlinestatic |
Definition at line 57 of file CHolonomicND.h.
|
staticnoexceptinherited |
Class factory from class name, e.g.
"CHolonomicVFF"
, etc.
std::logic_error | On invalid or missing parameters. |
|
static |
|
private |
Definition at line 610 of file CHolonomicND.cpp.
References M_PI, mrpt::utils::round(), and mrpt::math::wrapToPi().
|
inlineinherited |
Definition at line 121 of file CAbstractHolonomicReactiveMethod.h.
References mrpt::nav::CAbstractHolonomicReactiveMethod::m_enableApproachTargetSlowDown.
Referenced by mrpt::nav::CAbstractPTGBasedReactive::build_movement_candidate().
|
private |
Evaluate each gap:
Definition at line 509 of file CHolonomicND.cpp.
References mrpt::mrpt::utils::abs_diff(), ASSERT_, mrpt::nav::CHolonomicND::TGap::end, mrpt::nav::CHolonomicND::TGap::ini, min, mrpt::utils::min3(), mrpt::math::minimumDistanceFromPointToSegment(), mrpt::nav::CHolonomicND::TGap::representative_sector, mrpt::math::square(), and mrpt::math::sum().
|
staticnoexceptinherited |
Definition at line 52 of file CAbstractHolonomicReactiveMethod.cpp.
References mrpt::utils::TRuntimeClassId::createObject(), mrpt::utils::findRegisteredClass(), and mrpt::utils::registerAllPendingClasses().
Referenced by mrpt::nav::CAbstractPTGBasedReactive::setHolonomicMethod().
|
private |
Find gaps in the obtacles.
Definition at line 132 of file CHolonomicND.cpp.
References ASSERT_, mrpt::nav::CHolonomicND::TGap::end, mrpt::nav::CHolonomicND::TGap::ini, mrpt::mrpt::utils::keep_max(), mrpt::mrpt::utils::keep_min(), mrpt::nav::CHolonomicND::TGap::maxDistance, min, mrpt::nav::CHolonomicND::TGap::minDistance, and mrpt::math::TPoint2D::norm().
|
inherited |
Returns the pointer set by setAssociatedPTG()
Definition at line 47 of file CAbstractHolonomicReactiveMethod.cpp.
References mrpt::nav::CAbstractHolonomicReactiveMethod::m_associatedPTG.
Referenced by mrpt::nav::CHolonomicFullEval::evalSingleTarget(), and mrpt::nav::CHolonomicFullEval::navigate().
|
inherited |
Gets the name of the section used in initialize()
Definition at line 36 of file CAbstractHolonomicReactiveMethod.cpp.
References mrpt::nav::CAbstractHolonomicReactiveMethod::m_cfgSectionName.
|
overridevirtual |
Returns information about the class of an object in runtime.
Reimplemented from mrpt::nav::CAbstractHolonomicReactiveMethod.
|
static |
|
inlineoverridevirtual |
Returns the actual value of this parameter [m], as set via the children class options structure.
Implements mrpt::nav::CAbstractHolonomicReactiveMethod.
Definition at line 117 of file CHolonomicND.h.
References options, and mrpt::nav::CHolonomicND::TOptions::TARGET_SLOW_APPROACHING_DISTANCE.
|
overridevirtual |
Initialize the parameters of the navigator.
Implements mrpt::nav::CAbstractHolonomicReactiveMethod.
Definition at line 38 of file CHolonomicND.cpp.
Invokes the holonomic navigation algorithm itself.
See the description of the input/output structures for details on each parameter.
Implements mrpt::nav::CAbstractHolonomicReactiveMethod.
Definition at line 50 of file CHolonomicND.cpp.
References ASSERT_, mrpt::nav::CAbstractHolonomicReactiveMethod::NavOutput::desiredDirection, mrpt::nav::CAbstractHolonomicReactiveMethod::NavOutput::desiredSpeed, mrpt::nav::CAbstractHolonomicReactiveMethod::NavOutput::logRecord, mrpt::nav::CAbstractHolonomicReactiveMethod::NavInput::maxRobotSpeed, min, mrpt::nav::CAbstractHolonomicReactiveMethod::NavInput::obstacles, and mrpt::nav::CAbstractHolonomicReactiveMethod::NavInput::targets.
Definition at line 57 of file CHolonomicND.h.
Definition at line 57 of file CHolonomicND.h.
Definition at line 57 of file CHolonomicND.h.
Definition at line 57 of file CHolonomicND.h.
|
inline |
Definition at line 57 of file CHolonomicND.h.
Definition at line 57 of file CHolonomicND.h.
|
inlinenoexcept |
Definition at line 57 of file CHolonomicND.h.
|
inline |
Definition at line 57 of file CHolonomicND.h.
|
overrideprotectedvirtual |
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.
in | The input binary stream where the object data must read from. |
version | The version of the object stored in the stream: use this version number in your code to know how to read the incoming data. |
std::exception | On any error, see CStream::ReadBuffer |
Implements mrpt::utils::CSerializable.
Definition at line 760 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, and mrpt::nav::CHolonomicND::TOptions::WIDE_GAP_SIZE_PERCENT.
|
overridevirtual |
saves all available parameters, in a forma loadable by initialize()
Implements mrpt::nav::CAbstractHolonomicReactiveMethod.
Definition at line 42 of file CHolonomicND.cpp.
|
private |
Search the best gap.
Definition at line 295 of file CHolonomicND.cpp.
References mrpt::nav::CHolonomicND::TGap::end, mrpt::nav::CLogFileRecord_ND::gaps_eval, mrpt::nav::CHolonomicND::TGap::ini, min, mrpt::math::TPoint2D::norm(), mrpt::utils::round(), mrpt::math::TPoint2D::x, and mrpt::math::TPoint2D::y.
|
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.
References mrpt::nav::CAbstractHolonomicReactiveMethod::m_associatedPTG.
|
inherited |
Defines the name of the section used in initialize()
Defines the name of the section (Default: "FULL_EVAL_CONFIG")
Definition at line 31 of file CAbstractHolonomicReactiveMethod.cpp.
References mrpt::nav::CAbstractHolonomicReactiveMethod::m_cfgSectionName.
|
inlineoverridevirtual |
Sets the actual value of this parameter [m].
Implements mrpt::nav::CAbstractHolonomicReactiveMethod.
Definition at line 121 of file CHolonomicND.h.
References options, and mrpt::nav::CHolonomicND::TOptions::TARGET_SLOW_APPROACHING_DISTANCE.
|
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.
mxArray
(caller is responsible of memory freeing) or nullptr is class does not support conversion to MATLAB. Definition at line 89 of file CSerializable.h.
|
overrideprotectedvirtual |
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.
out | The output binary stream where object must be dumped. |
getVersion | If nullptr, 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. |
std::exception | On any error, see CStream::WriteBuffer |
Implements mrpt::utils::CSerializable.
Definition at line 744 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, and mrpt::nav::CHolonomicND::TOptions::WIDE_GAP_SIZE_PERCENT.
|
staticprotected |
Definition at line 57 of file CHolonomicND.h.
|
static |
Definition at line 57 of file CHolonomicND.h.
|
protectedinherited |
If applicable, this will contain the argument of the most recent call to setAssociatedPTG()
Definition at line 129 of file CAbstractHolonomicReactiveMethod.h.
Referenced by mrpt::nav::CAbstractHolonomicReactiveMethod::getAssociatedPTG(), and mrpt::nav::CAbstractHolonomicReactiveMethod::setAssociatedPTG().
|
protectedinherited |
Whether to decrease speed when approaching target.
Definition at line 131 of file CAbstractHolonomicReactiveMethod.h.
Referenced by mrpt::nav::CAbstractHolonomicReactiveMethod::enableApproachTargetSlowDown(), and mrpt::nav::CHolonomicFullEval::navigate().
|
private |
Definition at line 127 of file CHolonomicND.h.
Referenced by readFromStream(), and writeToStream().
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 115 of file CHolonomicND.h.
Referenced by getTargetApproachSlowDownDistance(), readFromStream(), setTargetApproachSlowDownDistance(), and writeToStream().
|
staticprotected |
Definition at line 57 of file CHolonomicND.h.
Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019 |