123 virtual std::unique_ptr<TNavigationParams>
clone()
const
125 return std::make_unique<TNavigationParams>(*
this);
189 std::weak_ptr<mrpt::poses::FrameTransformer<2>>
getFrameTF()
const
272 bool call_virtual_nav_method =
true);
286 virtual bool stop(
bool isEmergencyStop);
MRPT_FILL_ENUM_MEMBER(CAbstractNavigator, IDLE)
#define MRPT_ENUM_TYPE_END()
#define MRPT_ENUM_TYPE_BEGIN(_ENUM_TYPE_WITH_NS)
#define MRPT_MAKE_ALIGNED_OPERATOR_NEW
Put this macro inside any class with members that require {16,32,64}-byte memory alignment (e....
This class allows loading and storing values and vectors of different types from a configuration text...
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
Virtual base for velocity commands of different kinematic models of planar mobile robot.
This is the base class for any reactive/planned navigation system.
mrpt::poses::CPose2DInterpolator m_latestOdomPoses
virtual bool checkHasReachedTarget(const double targetDist) const
Default implementation: check if target_dist is below the accepted distance.
CRobot2NavInterface & m_robot
The navigator-robot interface.
std::string m_last_curPoseVelUpdate_pose_frame_id
virtual void initialize()=0
Must be called before any other navigation command.
TState m_navigationState
Current internal state of navigator:
virtual void onNavigateCommandReceived()
Called after each call to CAbstractNavigator::navigate()
void dispatchPendingNavEvents()
void doEmergencyStop(const std::string &msg)
Stops the robot and set navigation state to error.
virtual void resume()
Continues with suspended navigation.
virtual ~CAbstractNavigator()
dtor
virtual void cancel()
Cancel current navegation.
virtual void suspend()
Suspend current navegation.
virtual void navigate(const TNavigationParams *params)
Navigation request to a single target location.
std::weak_ptr< mrpt::poses::FrameTransformer< 2 > > m_frame_tf
Optional, user-provided frame transformer.
const mrpt::system::CTimeLogger & getDelaysTimeLogger() const
Gives access to a const-ref to the internal time logger used to estimate delays.
mrpt::system::TTimeStamp m_badNavAlarm_lastMinDistTime
void setFrameTF(const std::weak_ptr< mrpt::poses::FrameTransformer< 2 >> &frame_tf)
Sets a user-provided frame transformer object; used only if providing targets in a frame ID different...
bool m_navigationEndEventSent
Will be false until the navigation end is sent, and it is reset with each new command.
virtual void navigationStep()
This method must be called periodically in order to effectively run the navigation.
void processNavigateCommand(const TNavigationParams *params)
Does the job of navigate(), except the call to onNavigateCommandReceived()
virtual bool changeSpeedsNOP()
Default: forward call to m_robot.changeSpeedsNOP().
mrpt::system::CTimeLogger m_timlog_delays
Time logger to collect delay-related stats.
TRobotPoseVel m_curPoseVel
Current robot pose (updated in CAbstractNavigator::navigationStep() )
virtual bool stop(bool isEmergencyStop)
Default: forward call to m_robot.stop().
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),...
void internal_onStartNewNavigation()
Called before starting a new navigation.
virtual void resetNavError()
Resets a NAV_ERROR state back to IDLE
virtual void onStartNewNavigation()=0
Called whenever a new navigation has been started.
double m_badNavAlarm_minDistTarget
For sending an alarm (error event) when it seems that we are not approaching toward the target in a w...
virtual bool changeSpeeds(const mrpt::kinematics::CVehicleVelCmd &vel_cmd)
Default: forward call to m_robot.changeSpeed().
std::unique_ptr< TNavigationParams > m_navigationParams
Current navigation parameters.
virtual void performNavigationStepNavigating(bool call_virtual_nav_method=true)
Factorization of the part inside navigationStep(), for the case of state being NAVIGATING.
TState getCurrentState() const
Returns the current navigator state.
TState m_lastNavigationState
Last internal state of navigator:
virtual void saveConfigFile(mrpt::config::CConfigFileBase &c) const
Saves all current options to a config file.
virtual void loadConfigFile(const mrpt::config::CConfigFileBase &c)
Loads all params from a file.
TAbstractNavigatorParams params_abstract_navigator
void updateCurrentPoseAndSpeeds()
Call to the robot getCurrentPoseAndSpeeds() and updates members m_curPoseVel accordingly.
std::weak_ptr< mrpt::poses::FrameTransformer< 2 > > getFrameTF() const
Get the current frame tf object (defaults to nullptr)
int m_counter_check_target_is_blocked
std::vector< std::function< void(void)> > m_pending_events
Events generated during navigationStep(), enqueued to be called at the end of the method execution to...
mrpt::poses::CPose2DInterpolator m_latestPoses
Latest robot poses (updated in CAbstractNavigator::navigationStep() )
TState
The different states for the navigation system.
CAbstractNavigator(CRobot2NavInterface &robot_interface_impl)
ctor
virtual void performNavigationStep()=0
To be implemented in derived classes.
std::recursive_mutex m_nav_cs
mutex for all navigation methods
double m_last_curPoseVelUpdate_robot_time
The pure virtual interface between a real or simulated robot and any CAbstractNavigator-derived class...
This class stores a time-stamped trajectory in SE(2) (mrpt::math::TPose2D poses).
Versatile class for consistent logging and management of output messages.
A versatile "profiler" that logs the time spent within each pair of calls to enter(X)-leave(X),...
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
GLenum const GLfloat * params
GLsizei const GLchar ** string
mrpt::Clock::time_point TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1,...
bool operator==(const CAbstractNavigator::TNavigationParamsBase &, const CAbstractNavigator::TNavigationParamsBase &)
2D twist: 2D velocity vector (vx,vy) + planar angular velocity (omega)
virtual void saveToConfigFile(mrpt::config::CConfigFileBase &c, const std::string &s) const override
This method saves the options to a ".ini"-like file or memory-stored string list.
TAbstractNavigatorParams()
double dist_check_target_is_blocked
(Default value=0.6) When closer than this distance, check if the target is blocked to abort navigatio...
int hysteresis_check_target_is_blocked
(Default=3) How many steps should the condition for dist_check_target_is_blocked be fulfilled to rais...
virtual void loadFromConfigFile(const mrpt::config::CConfigFileBase &c, const std::string &s) override
This method load the options from a ".ini"-like file or memory-stored string list.
double dist_to_target_for_sending_event
Default value=0, means use the "targetAllowedDistance" passed by the user in the navigation request.
double alarm_seems_not_approaching_target_timeout
navigator timeout (seconds) [Default=30 sec]
Base for all high-level navigation commands.
virtual std::string getAsText() const =0
Gets navigation params as a human-readable format.
virtual bool isEqual(const TNavigationParamsBase &o) const =0
virtual ~TNavigationParamsBase()
friend bool operator==(const TNavigationParamsBase &, const TNavigationParamsBase &)
The struct for configuring navigation requests.
virtual bool isEqual(const TNavigationParamsBase &o) const override
TargetInfo target
Navigation target.
virtual std::string getAsText() const override
Gets navigation params as a human-readable format.
virtual std::unique_ptr< TNavigationParams > clone() const
mrpt::math::TPose2D rawOdometry
raw odometry (frame does not match to "pose", but is expected to be smoother in the short term).
mrpt::system::TTimeStamp timestamp
mrpt::math::TTwist2D velLocal
std::string pose_frame_id
map frame ID for pose
mrpt::math::TTwist2D velGlobal
Individual target info in CAbstractNavigator::TNavigationParamsBase and derived classes.
std::string target_frame_id
(Default="map") Frame ID in which target is given.
mrpt::math::TPose2D target_coords
Coordinates of desired target location.
bool operator==(const TargetInfo &o) const
double targetDesiredRelSpeed
(Default=.05) Desired relative speed (wrt maximum speed), in range [0,1], of the vehicle at target.
float targetAllowedDistance
(Default=0.5 meters) Allowed distance to target in order to end the navigation.
std::string getAsText() const
Gets navigation params as a human-readable format.
bool operator!=(const TargetInfo &o) const
bool targetIsIntermediaryWaypoint
bool targetIsRelative
(Default=false) Whether the target coordinates are in global coordinates (false) or are relative to t...