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

Detailed Description

"Fake navigator" for tests: it just sends out a pre-programmed sequence of commands to the robot.

For a short discussion of the API, see CNavigatorVirtualBase

Definition at line 21 of file CNavigatorManualSequence.h.

#include <mrpt/nav/reactive/CNavigatorManualSequence.h>

Inheritance diagram for mrpt::nav::CNavigatorManualSequence:
Inheritance graph

Classes

struct  TVelCmd
 

Public Member Functions

 CNavigatorManualSequence (CRobot2NavInterface &react_iterf_impl)
 
virtual ~CNavigatorManualSequence ()
 
void navigationStep () MRPT_OVERRIDE
 Overriden in this class to ignore the cancel/pause/... More...
 
const mrpt::utils::CTimeLoggergetDelaysTimeLogger () const
 Gives access to a const-ref to the internal time logger used to estimate delays. More...
 
Initialization API
virtual void loadConfigFile (const mrpt::utils::CConfigFileBase &c) MRPT_OVERRIDE
 Loads all params from a file. More...
 
virtual void saveConfigFile (mrpt::utils::CConfigFileBase &c) const MRPT_OVERRIDE
 Saves all current options to a config file. More...
 
void initialize () MRPT_OVERRIDE
 Must be called for loading collision grids, etc. before invoking any navigation command. More...
 

Public Attributes

std::map< double, TVelCmdprogrammed_orders
 map [time_in_secs_since_beginning] -> orders. More...
 
TAbstractNavigatorParams params_abstract_navigator
 

Protected Member Functions

virtual void onStartNewNavigation () MRPT_OVERRIDE
 Called whenever a new navigation has been started. More...
 
void dispatchPendingNavEvents ()
 
void updateCurrentPoseAndSpeeds ()
 Call to the robot getCurrentPoseAndSpeeds() and updates members m_curPoseVel accordingly. More...
 
virtual void performNavigationStepNavigating (bool call_virtual_nav_method=true)
 Factorization of the part inside navigationStep(), for the case of state being NAVIGATING. More...
 
void doEmergencyStop (const std::string &msg)
 Stops the robot and set navigation state to error. More...
 
virtual bool changeSpeeds (const mrpt::kinematics::CVehicleVelCmd &vel_cmd)
 Default: forward call to m_robot.changeSpeed(). Can be overriden. More...
 
virtual bool changeSpeedsNOP ()
 Default: forward call to m_robot.changeSpeedsNOP(). Can be overriden. More...
 
virtual bool stop (bool isEmergencyStop)
 Default: forward call to m_robot.stop(). Can be overriden. More...
 
virtual bool checkHasReachedTarget (const double targetDist) const
 Default implementation: check if target_dist is below the accepted distance. More...
 
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. More...
 

Protected Attributes

std::vector< TPendingEventm_pending_events
 Events generated during navigationStep(), enqueued to be called at the end of the method execution to avoid user code to change the navigator state. More...
 
TState m_navigationState
 Current internal state of navigator: More...
 
TNavigationParamsm_navigationParams
 Current navigation parameters. More...
 
CRobot2NavInterfacem_robot
 The navigator-robot interface. More...
 
mrpt::poses::FrameTransformer< 2 > * m_frame_tf
 Optional, user-provided frame transformer. More...
 
mrpt::synch::CCriticalSectionRecursive m_nav_cs
 mutex for all navigation methods More...
 
TRobotPoseVel m_curPoseVel
 Current robot pose (updated in CAbstractNavigator::navigationStep() ) More...
 
double m_last_curPoseVelUpdate_robot_time
 
std::string m_last_curPoseVelUpdate_pose_frame_id
 
mrpt::poses::CPose2DInterpolator m_latestPoses
 
mrpt::poses::CPose2DInterpolator m_latestOdomPoses
 Latest robot poses (updated in CAbstractNavigator::navigationStep() ) More...
 
mrpt::utils::CTimeLogger m_timlog_delays
 Time logger to collect delay-related stats. More...
 
double m_badNavAlarm_minDistTarget
 For sending an alarm (error event) when it seems that we are not approaching toward the target in a while... More...
 
mrpt::system::TTimeStamp m_badNavAlarm_lastMinDistTime
 

Private Member Functions

virtual void navigate (const TNavigationParams *params) MRPT_OVERRIDE
 Navigation request to a single target location. More...
 
virtual void performNavigationStep () MRPT_OVERRIDE
 To be implemented in derived classes. More...
 

Navigation control API

virtual void cancel ()
 Cancel current navegation. More...
 
virtual void resume ()
 Continues with suspended navigation. More...
 
virtual void suspend ()
 Suspend current navegation. More...
 
virtual void resetNavError ()
 Resets a NAV_ERROR state back to IDLE More...
 
TState getCurrentState () const
 Returns the current navigator state. More...
 
void setFrameTF (mrpt::poses::FrameTransformer< 2 > *frame_tf)
 Sets a user-provided frame transformer object; used only if providing targets in a frame ID different than the one in which robot odometry is given (both IDs default to "map"). More...
 
const mrpt::poses::FrameTransformer< 2 > * getFrameTF () const
 Get the current frame tf object (defaults to nullptr) More...
 
enum  TState { IDLE =0, NAVIGATING, SUSPENDED, NAV_ERROR }
 The different states for the navigation system. More...
 

Member Enumeration Documentation

◆ TState

The different states for the navigation system.

Enumerator
IDLE 
NAVIGATING 
SUSPENDED 
NAV_ERROR 

Definition at line 120 of file CAbstractNavigator.h.

Constructor & Destructor Documentation

◆ CNavigatorManualSequence()

mrpt::nav::CNavigatorManualSequence::CNavigatorManualSequence ( CRobot2NavInterface react_iterf_impl)

◆ ~CNavigatorManualSequence()

virtual mrpt::nav::CNavigatorManualSequence::~CNavigatorManualSequence ( )
virtual

Member Function Documentation

◆ cancel()

virtual void mrpt::nav::CAbstractNavigator::cancel ( )
virtualinherited

Cancel current navegation.

Reimplemented in mrpt::nav::CWaypointsNavigator.

◆ changeSpeeds()

virtual bool mrpt::nav::CAbstractNavigator::changeSpeeds ( const mrpt::kinematics::CVehicleVelCmd vel_cmd)
protectedvirtualinherited

Default: forward call to m_robot.changeSpeed(). Can be overriden.

◆ changeSpeedsNOP()

virtual bool mrpt::nav::CAbstractNavigator::changeSpeedsNOP ( )
protectedvirtualinherited

Default: forward call to m_robot.changeSpeedsNOP(). Can be overriden.

◆ checkCollisionWithLatestObstacles()

virtual bool mrpt::nav::CAbstractNavigator::checkCollisionWithLatestObstacles ( const mrpt::math::TPose2D relative_robot_pose) const
protectedvirtualinherited

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.

Reimplemented in mrpt::nav::CReactiveNavigationSystem3D, and mrpt::nav::CReactiveNavigationSystem.

◆ checkHasReachedTarget()

virtual bool mrpt::nav::CAbstractNavigator::checkHasReachedTarget ( const double  targetDist) const
protectedvirtualinherited

Default implementation: check if target_dist is below the accepted distance.

If true is returned here, the end-of-navigation event will be sent out (only for non-intermediary targets).

Reimplemented in mrpt::nav::CWaypointsNavigator.

◆ dispatchPendingNavEvents()

void mrpt::nav::CAbstractNavigator::dispatchPendingNavEvents ( )
protectedinherited

◆ doEmergencyStop()

void mrpt::nav::CAbstractNavigator::doEmergencyStop ( const std::string &  msg)
protectedinherited

Stops the robot and set navigation state to error.

◆ getCurrentState()

TState mrpt::nav::CAbstractNavigator::getCurrentState ( ) const
inlineinherited

Returns the current navigator state.

Definition at line 128 of file CAbstractNavigator.h.

◆ getDelaysTimeLogger()

const mrpt::utils::CTimeLogger& mrpt::nav::CAbstractNavigator::getDelaysTimeLogger ( ) const
inlineinherited

Gives access to a const-ref to the internal time logger used to estimate delays.

See also
getTimeLogger() in derived classes

Definition at line 158 of file CAbstractNavigator.h.

◆ getFrameTF()

const mrpt::poses::FrameTransformer<2>* mrpt::nav::CAbstractNavigator::getFrameTF ( ) const
inlineinherited

Get the current frame tf object (defaults to nullptr)

See also
setFrameTF

Definition at line 139 of file CAbstractNavigator.h.

◆ initialize()

void mrpt::nav::CNavigatorManualSequence::initialize ( )
virtual

Must be called for loading collision grids, etc. before invoking any navigation command.

Implements mrpt::nav::CAbstractNavigator.

◆ loadConfigFile()

virtual void mrpt::nav::CNavigatorManualSequence::loadConfigFile ( const mrpt::utils::CConfigFileBase c)
virtual

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 overriden method to ensure all params are loaded.

Reimplemented from mrpt::nav::CAbstractNavigator.

◆ navigate()

virtual void mrpt::nav::CNavigatorManualSequence::navigate ( const TNavigationParams params)
inlineprivatevirtual

Navigation request to a single target location.

It starts a new navigation.

Parameters
[in]paramsPointer to structure with navigation info (its contents will be copied, so the original can be freely destroyed upon return if it was dynamically allocated.)
Note
A pointer is used so the passed object can be polymorphic with derived types.

Reimplemented from mrpt::nav::CAbstractNavigator.

Definition at line 49 of file CNavigatorManualSequence.h.

◆ navigationStep()

void mrpt::nav::CNavigatorManualSequence::navigationStep ( )
virtual

Overriden in this class to ignore the cancel/pause/...

commands

Reimplemented from mrpt::nav::CAbstractNavigator.

◆ onStartNewNavigation()

virtual void mrpt::nav::CNavigatorManualSequence::onStartNewNavigation ( )
inlineprotectedvirtual

Called whenever a new navigation has been started.

Can be used to reset state variables, etc.

Implements mrpt::nav::CAbstractNavigator.

Definition at line 45 of file CNavigatorManualSequence.h.

◆ performNavigationStep()

virtual void mrpt::nav::CNavigatorManualSequence::performNavigationStep ( )
inlineprivatevirtual

To be implemented in derived classes.

Implements mrpt::nav::CAbstractNavigator.

Definition at line 50 of file CNavigatorManualSequence.h.

◆ performNavigationStepNavigating()

virtual void mrpt::nav::CAbstractNavigator::performNavigationStepNavigating ( bool  call_virtual_nav_method = true)
protectedvirtualinherited

Factorization of the part inside navigationStep(), for the case of state being NAVIGATING.

Performs house-hold tasks like raising events in case of starting/ending navigation, timeout reaching destination, etc. call_virtual_nav_method can be set to false to avoid calling the virtual method performNavigationStep()

◆ resetNavError()

virtual void mrpt::nav::CAbstractNavigator::resetNavError ( )
virtualinherited

Resets a NAV_ERROR state back to IDLE

◆ resume()

virtual void mrpt::nav::CAbstractNavigator::resume ( )
virtualinherited

Continues with suspended navigation.

See also
suspend

◆ saveConfigFile()

virtual void mrpt::nav::CNavigatorManualSequence::saveConfigFile ( mrpt::utils::CConfigFileBase c) const
virtual

Saves all current options to a config file.

Each derived class MUST save its own parameters, and then call ITS PARENT'S overriden method to ensure all params are saved.

Reimplemented from mrpt::nav::CAbstractNavigator.

◆ setFrameTF()

void mrpt::nav::CAbstractNavigator::setFrameTF ( mrpt::poses::FrameTransformer< 2 > *  frame_tf)
inherited

Sets a user-provided frame transformer object; used only if providing targets in a frame ID different than the one in which robot odometry is given (both IDs default to "map").

Ownership of the pointee object remains belonging to the user, which is responsible of deleting it and ensuring its a valid pointer during the lifetime of this navigator object.

Todo:
[MRPT 2.0: Make this a weak_ptr]

◆ stop()

virtual bool mrpt::nav::CAbstractNavigator::stop ( bool  isEmergencyStop)
protectedvirtualinherited

Default: forward call to m_robot.stop(). Can be overriden.

◆ suspend()

virtual void mrpt::nav::CAbstractNavigator::suspend ( )
virtualinherited

Suspend current navegation.

See also
resume

◆ updateCurrentPoseAndSpeeds()

void mrpt::nav::CAbstractNavigator::updateCurrentPoseAndSpeeds ( )
protectedinherited

Call to the robot getCurrentPoseAndSpeeds() and updates members m_curPoseVel accordingly.

If an error is returned by the user callback, first, it calls robot.stop() ,then throws an std::runtime_error exception.

Member Data Documentation

◆ m_badNavAlarm_lastMinDistTime

mrpt::system::TTimeStamp mrpt::nav::CAbstractNavigator::m_badNavAlarm_lastMinDistTime
protectedinherited

Definition at line 255 of file CAbstractNavigator.h.

◆ m_badNavAlarm_minDistTarget

double mrpt::nav::CAbstractNavigator::m_badNavAlarm_minDistTarget
protectedinherited

For sending an alarm (error event) when it seems that we are not approaching toward the target in a while...

Definition at line 254 of file CAbstractNavigator.h.

◆ m_curPoseVel

TRobotPoseVel mrpt::nav::CAbstractNavigator::m_curPoseVel
protectedinherited

Current robot pose (updated in CAbstractNavigator::navigationStep() )

Definition at line 246 of file CAbstractNavigator.h.

◆ m_frame_tf

mrpt::poses::FrameTransformer<2>* mrpt::nav::CAbstractNavigator::m_frame_tf
protectedinherited

Optional, user-provided frame transformer.

Note: We dont have ownership of the pointee object!

Definition at line 232 of file CAbstractNavigator.h.

◆ m_last_curPoseVelUpdate_pose_frame_id

std::string mrpt::nav::CAbstractNavigator::m_last_curPoseVelUpdate_pose_frame_id
protectedinherited

Definition at line 248 of file CAbstractNavigator.h.

◆ m_last_curPoseVelUpdate_robot_time

double mrpt::nav::CAbstractNavigator::m_last_curPoseVelUpdate_robot_time
protectedinherited

Definition at line 247 of file CAbstractNavigator.h.

◆ m_latestOdomPoses

mrpt::poses::CPose2DInterpolator mrpt::nav::CAbstractNavigator::m_latestOdomPoses
protectedinherited

Latest robot poses (updated in CAbstractNavigator::navigationStep() )

Definition at line 249 of file CAbstractNavigator.h.

◆ m_latestPoses

mrpt::poses::CPose2DInterpolator mrpt::nav::CAbstractNavigator::m_latestPoses
protectedinherited

Definition at line 249 of file CAbstractNavigator.h.

◆ m_nav_cs

mrpt::synch::CCriticalSectionRecursive mrpt::nav::CAbstractNavigator::m_nav_cs
protectedinherited

mutex for all navigation methods

Definition at line 234 of file CAbstractNavigator.h.

◆ m_navigationParams

TNavigationParams* mrpt::nav::CAbstractNavigator::m_navigationParams
protectedinherited

Current navigation parameters.

Definition at line 226 of file CAbstractNavigator.h.

◆ m_navigationState

TState mrpt::nav::CAbstractNavigator::m_navigationState
protectedinherited

Current internal state of navigator:

Definition at line 225 of file CAbstractNavigator.h.

◆ m_pending_events

std::vector<TPendingEvent> mrpt::nav::CAbstractNavigator::m_pending_events
protectedinherited

Events generated during navigationStep(), enqueued to be called at the end of the method execution to avoid user code to change the navigator state.

Definition at line 188 of file CAbstractNavigator.h.

◆ m_robot

CRobot2NavInterface& mrpt::nav::CAbstractNavigator::m_robot
protectedinherited

The navigator-robot interface.

Definition at line 228 of file CAbstractNavigator.h.

◆ m_timlog_delays

mrpt::utils::CTimeLogger mrpt::nav::CAbstractNavigator::m_timlog_delays
protectedinherited

Time logger to collect delay-related stats.

Definition at line 251 of file CAbstractNavigator.h.

◆ params_abstract_navigator

TAbstractNavigatorParams mrpt::nav::CAbstractNavigator::params_abstract_navigator
inherited

Definition at line 155 of file CAbstractNavigator.h.

◆ programmed_orders

std::map<double,TVelCmd> mrpt::nav::CNavigatorManualSequence::programmed_orders

map [time_in_secs_since_beginning] -> orders.

Definition at line 42 of file CNavigatorManualSequence.h.




Page generated by Doxygen 1.8.13 for MRPT 1.5.3 at Tue Oct 31 07:27:35 UTC 2017