class mrpt::nav::CWaypointsNavigator
Overview
Extends CAbstractNavigator with sequential waypoint following.
Accepts a TWaypointSequence and navigates the robot through each waypoint in order, optionally skipping waypoints marked with allow_skip=true if the underlying navigator determines that it is more efficient to do so. Each time a waypoint is reached or skipped, sendWaypointReachedEvent() is called; sendNavigationEndEvent() is called only for the final waypoint.
This class extends CAbstractNavigator with the capability of following a list of waypoints. By default, waypoints are followed one by one, but, if they are tagged with allow_skip=true and the derived navigator class supports it, the navigator may choose to skip some to make a smoother, safer and shorter navigation.
Waypoints have an optional target_heading field, which will be honored only for waypoints that are skipped, and if the underlying robot interface supports the pure-rotation methods.
Notes on navigation status and event dispatchment:
Navigation state may briefly pass by the
IDLEstatus between a waypoint is reached and a new navigation command is issued towards the next waypoint.sendNavigationEndEvent()will be called only when the last waypoint is reached.Reaching an intermediary waypoint (or skipping it if considered so by the navigator) generates a call to
sendWaypointReachedEvent()instead.
See also:
Base class CAbstractNavigator, CWaypointsNavigator::navigateWaypoints(), and derived classes.
#include <mrpt/nav/reactive/CWaypointsNavigator.h> class CWaypointsNavigator: public mrpt::nav::CAbstractNavigator { public: // structs struct TNavigationParamsWaypoints; struct TWaypointsNavigatorParams; // classes class WaypointsAccessGuard; // construction CWaypointsNavigator(CRobot2NavInterface& robot_interface_impl); // methods virtual void loadConfigFile(const mrpt::config::CConfigFileBase& c); virtual void saveConfigFile(mrpt::config::CConfigFileBase& c) const; }; // direct descendants struct MinimalWaypointsNav; class CAbstractPTGBasedReactive;
Inherited Members
public: // enums enum TErrorCode; enum TState; // structs struct TMsg; struct TAbstractNavigatorParams; struct TErrorReason; struct TNavigationParams; struct TNavigationParamsBase; struct TRobotPoseVel; struct TargetInfo; // fields mrpt::system::CTimeLogger m_navProfiler {false, "mrpt::nav::CAbstractNavigator"}; // methods COutputLogger& operator = (const COutputLogger&); COutputLogger& operator = (COutputLogger&&); 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;
Construction
CWaypointsNavigator(CRobot2NavInterface& robot_interface_impl)
ctor
Methods
virtual void loadConfigFile(const mrpt::config::CConfigFileBase& c)
Loads all navigator parameters from a config file.
Must be called before initialize(). Derived classes must call the parent implementation after loading their own parameters.
Parameters:
c |
The configuration source to read from. |
virtual void saveConfigFile(mrpt::config::CConfigFileBase& c) const
Saves all current navigator parameters to a config file.
Derived classes must call the parent implementation after saving their own parameters.
Parameters:
c |
The configuration file to write to. |