class mrpt::nav::CReactiveNavigationSystem
Overview
See base class CAbstractPTGBasedReactive for a description and instructions of use.
This particular implementation assumes a 2D robot shape which can be polygonal or circular (depending on the selected PTGs).
Publications:
Blanco, Jose-Luis, Javier Gonzalez, and Juan-Antonio Fernandez-Madrigal. “Extending obstacle avoidance methods through multiple parameter-space transformations”. Autonomous Robots 24.1 (2008): 29-48.
Class history:
17/JUN/2004: First design.
16/SEP/2004: Totally redesigned, according to document “MultiParametric Based Space Transformation for Reactive Navigation”
29/SEP/2005: Totally rewritten again, for integration into MRPT library and according to the ICRA paper.
17/OCT/2007: Whole code updated to accommodate to MRPT 0.5 and make it portable to Linux.
DEC/2013: Code refactoring between this class and CAbstractHolonomicReactiveMethod
FEB/2017: Refactoring of all parameters for a consistent organization in sections by class names (MRPT 1.5.0)
This class requires a number of parameters which are usually provided via an external config (“.ini”) file. Alternatively, a memory-only object can be used to avoid physical files, see mrpt::config::CConfigFileMemory.
A template config file can be generated at any moment by the user by calling saveConfigFile() with a default-constructed object.
Next we provide a self-documented template config file; or see it online: https://github.com/MRPT/mrpt/blob/master/share/mrpt/config_files/navigation-ptgs/reactive2d_config.ini
See also:
CAbstractNavigator, CParameterizedTrajectoryGenerator, CAbstractHolonomicReactiveMethod
#include <mrpt/nav/reactive/CReactiveNavigationSystem.h> class CReactiveNavigationSystem: public mrpt::nav::CAbstractPTGBasedReactive { public: // structs struct TReactiveNavigatorParams; // fields TReactiveNavigatorParams params_reactive_nav; // construction CReactiveNavigationSystem( CRobot2NavInterface& react_iterf_impl, bool enableConsoleOutput = true, bool enableLogFile = false, const std::string& logFileDirectory = std::string("./reactivenav.logs") ); // methods void changeRobotShape(const mrpt::math::CPolygon& shape); void changeRobotCircularShapeRadius(const double R); virtual size_t getPTG_count() const; virtual CParameterizedTrajectoryGenerator* getPTG(size_t i); virtual const CParameterizedTrajectoryGenerator* getPTG(size_t i) const; virtual bool checkCollisionWithLatestObstacles(const mrpt::math::TPose2D& relative_robot_pose) const; virtual void loadConfigFile(const mrpt::config::CConfigFileBase& c); virtual void saveConfigFile(mrpt::config::CConfigFileBase& c) const; };
Inherited Members
public: // enums enum TErrorCode; enum TState; // structs struct TMsg; struct TAbstractNavigatorParams; struct TErrorReason; struct TNavigationParams; struct TNavigationParamsBase; struct TRobotPoseVel; struct TargetInfo; struct TNavigationParamsWaypoints; struct TWaypointsNavigatorParams; struct PTGTarget; struct TAbstractPTGNavigatorParams; struct TInfoPerPTG; struct TNavigationParamsPTG; struct TSentVelCmd; // fields mrpt::system::CTimeLogger m_navProfiler {false, "mrpt::nav::CAbstractNavigator"}; TWaypointsNavigatorParams params_waypoints_navigator; TAbstractNavigatorParams params_abstract_navigator; // methods virtual void loadConfigFile(const mrpt::config::CConfigFileBase& c); virtual void saveConfigFile(mrpt::config::CConfigFileBase& c) const; virtual void initialize() = 0; virtual void navigationStep(); virtual void navigate(const TNavigationParams* params); virtual void cancel(); virtual void resume(); virtual void suspend(); virtual void resetNavError(); TState getCurrentState() const; const TErrorReason& getErrorReason() const; void setFrameTF(const std::weak_ptr<mrpt::poses::FrameTransformer<2>>& frame_tf); std::weak_ptr<mrpt::poses::FrameTransformer<2>> getFrameTF() const; void enableRethrowNavExceptions(const bool enable); const mrpt::system::CTimeLogger& getDelaysTimeLogger() const; bool isRethrowNavExceptionsEnabled() const; virtual void loadConfigFile(const mrpt::config::CConfigFileBase& c); virtual void saveConfigFile(mrpt::config::CConfigFileBase& c) const; virtual void navigateWaypoints(const TWaypointSequence& nav_request); virtual void getWaypointNavStatus(TWaypointStatusSequence& out_nav_status) const; TWaypointStatusSequence getWaypointNavStatus() const; TWaypointStatusSequence& beginWaypointsAccess(); void endWaypointsAccess(); virtual void initialize(); void setHolonomicMethod(const std::string& method, const mrpt::config::CConfigFileBase& cfgBase); void getLastLogRecord(CLogFileRecord& o); void enableKeepLogRecords(bool enable = true); void enableLogFile(bool enable); void setLogFileDirectory(const std::string& sDir); virtual void loadConfigFile(const mrpt::config::CConfigFileBase& c); virtual void saveConfigFile(mrpt::config::CConfigFileBase& c) const; void enableTimeLog(bool enable = true); const mrpt::system::CTimeLogger& getTimeLogger() const; virtual size_t getPTG_count() const = 0; virtual CParameterizedTrajectoryGenerator* getPTG(size_t i) = 0; virtual const CParameterizedTrajectoryGenerator* getPTG(size_t i) const = 0; const mrpt::kinematics::CVehicleVelCmd::TVelCmdParams& getCurrentRobotSpeedLimits() const; mrpt::kinematics::CVehicleVelCmd::TVelCmdParams& changeCurrentRobotSpeedLimits(); void setTargetApproachSlowDownDistance(const double dist); double getTargetApproachSlowDownDistance() const; virtual void navigationStep(); virtual void cancel(); bool isRelativePointReachable(const mrpt::math::TPoint2D& wp_local_wrt_robot) const;
Construction
CReactiveNavigationSystem( CRobot2NavInterface& react_iterf_impl, bool enableConsoleOutput = true, bool enableLogFile = false, const std::string& logFileDirectory = std::string("./reactivenav.logs") )
See docs in ctor of base class.
Methods
void changeRobotShape(const mrpt::math::CPolygon& shape)
Defines the 2D polygonal robot shape, used for some PTGs for collision checking.
void changeRobotCircularShapeRadius(const double R)
Defines the 2D circular robot shape radius, used for some PTGs for collision checking.
virtual size_t getPTG_count() const
Returns the number of different PTGs that have been setup.
virtual CParameterizedTrajectoryGenerator* getPTG(size_t i)
Gets the i’th PTG.
virtual const CParameterizedTrajectoryGenerator* getPTG(size_t i) const
Gets the i’th PTG.
virtual bool checkCollisionWithLatestObstacles(const mrpt::math::TPose2D& relative_robot_pose) const
Checks whether the robot shape, when placed at the given pose (relative to the current pose), is colliding with any of the latest known obstacles.
Default implementation: always returns false.
virtual void loadConfigFile(const mrpt::config::CConfigFileBase& c)
Loads all params from a file.
To be called before initialize(). Each derived class MUST load its own parameters, and then call ITS PARENT’S overridden method to ensure all params are loaded.
virtual void saveConfigFile(mrpt::config::CConfigFileBase& c) const
Saves all current options to a config file.
Each derived class MUST save its own parameters, and then call ITS PARENT’S overridden method to ensure all params are saved.