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 | Private Attributes
mrpt::nav::CAbstractPTGBasedReactive Class Referenceabstract

Detailed Description

Base class for reactive navigator systems based on TP-Space, with an arbitrary holonomic reactive method running on it and any number of PTGs for transforming the navigation space.

Both, the holonomic method and the PTGs can be customized by the apropriate user derived classes.

How to use:

For working examples, refer to the source code of the apps:

Publications:

Available "variables" or "score names" for each motion candidate (these can be used in runtime-compiled expressions in the configuration files of motion deciders):

See also
CReactiveNavigationSystem, CReactiveNavigationSystem3D

Definition at line 73 of file CAbstractPTGBasedReactive.h.

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

Inheritance diagram for mrpt::nav::CAbstractPTGBasedReactive:
Inheritance graph

Classes

struct  PTGTarget
 
struct  TAbstractPTGNavigatorParams
 
struct  TInfoPerPTG
 
struct  TNavigationParamsPTG
 The struct for configuring navigation requests to CAbstractPTGBasedReactive and derived classes. More...
 
struct  TSentVelCmd
 

Public Member Functions

 CAbstractPTGBasedReactive (CRobot2NavInterface &react_iterf_impl, bool enableConsoleOutput=true, bool enableLogFile=false, const std::string &logFileDirectory=std::string("./reactivenav.logs"))
 Constructor. More...
 
virtual ~CAbstractPTGBasedReactive ()
 
void initialize () MRPT_OVERRIDE
 Must be called for loading collision grids, or the first navigation command may last a long time to be executed. More...
 
void setHolonomicMethod (const std::string &method, const mrpt::utils::CConfigFileBase &cfgBase)
 Selects which one from the set of available holonomic methods will be used into transformed TP-Space, and sets its configuration from a configuration file. More...
 
void setHolonomicMethod (THolonomicMethod method, const mrpt::utils::CConfigFileBase &cfgBase)
 
void getLastLogRecord (CLogFileRecord &o)
 Provides a copy of the last log record with information about execution. More...
 
void enableKeepLogRecords (bool enable=true)
 Enables keeping an internal registry of navigation logs that can be queried with getLastLogRecord() More...
 
void enableLogFile (bool enable)
 Enables/disables saving log files. More...
 
void setLogFileDirectory (const std::string &sDir)
 Changes the prefix for new log files. More...
 
std::string getLogFileDirectory () const
 
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 enableTimeLog (bool enable=true)
 Enables/disables the detailed time logger (default:disabled upon construction) When enabled, a report will be dumped to std::cout upon destruction. More...
 
const mrpt::utils::CTimeLoggergetTimeLogger () const
 Gives access to a const-ref to the internal time logger. More...
 
virtual size_t getPTG_count () const =0
 Returns the number of different PTGs that have been setup. More...
 
virtual CParameterizedTrajectoryGeneratorgetPTG (size_t i)=0
 Gets the i'th PTG. More...
 
virtual const CParameterizedTrajectoryGeneratorgetPTG (size_t i) const =0
 Gets the i'th PTG. More...
 
const mrpt::kinematics::CVehicleVelCmd::TVelCmdParamsgetCurrentRobotSpeedLimits () const
 Get the current, global (honored for all PTGs) robot speed limits. More...
 
mrpt::kinematics::CVehicleVelCmd::TVelCmdParamschangeCurrentRobotSpeedLimits ()
 Changes the current, global (honored for all PTGs) robot speed limits, via returning a reference to a structure that holds those limits. More...
 
void setTargetApproachSlowDownDistance (const double dist)
 Changes this parameter in all inner holonomic navigator instances [m]. More...
 
double getTargetApproachSlowDownDistance () const
 Returns this parameter for the first inner holonomic navigator instances [m] (should be the same in all of them?) More...
 
virtual void navigationStep () MRPT_OVERRIDE
 This method must be called periodically in order to effectively run the navigation. More...
 
virtual void cancel () MRPT_OVERRIDE
 Cancel current navegation. More...
 
bool isRelativePointReachable (const mrpt::math::TPoint2D &wp_local_wrt_robot) const
 Returns true if, according to the information gathered at the last navigation step, there is a free path to the given point; false otherwise: if way is blocked or there is missing information, the point is out of range for the existing PTGs, etc. More...
 
const mrpt::utils::CTimeLoggergetDelaysTimeLogger () const
 Gives access to a const-ref to the internal time logger used to estimate delays. More...
 
Waypoint navigation control API
virtual void navigateWaypoints (const TWaypointSequence &nav_request)
 Waypoint navigation request. More...
 
virtual void getWaypointNavStatus (TWaypointStatusSequence &out_nav_status) const
 Get a copy of the control structure which describes the progress status of the waypoint navigation. More...
 
TWaypointStatusSequence getWaypointNavStatus () const
 Get a copy of the control structure which describes the progress status of the waypoint navigation. More...
 

Public Attributes

TAbstractPTGNavigatorParams params_abstract_ptg_navigator
 
TWaypointsNavigatorParams params_waypoints_navigator
 
TAbstractNavigatorParams params_abstract_navigator
 

Protected Member Functions

virtual void performNavigationStep () MRPT_OVERRIDE
 The main method for the navigator. More...
 
virtual bool impl_waypoint_is_reachable (const mrpt::math::TPoint2D &wp_local_wrt_robot) const MRPT_OVERRIDE
 Implements the way to waypoint is free function in children classes: true must be returned if, according to the information gathered at the last navigation step, there is a free path to the given point; false otherwise: if way is blocked or there is missing information, the point is out of range, etc. More...
 
virtual void STEP1_InitPTGs ()=0
 
virtual bool implementSenseObstacles (mrpt::system::TTimeStamp &obs_timestamp)=0
 Return false on any fatal error. More...
 
bool STEP2_SenseObstacles ()
 
virtual void STEP3_WSpaceToTPSpace (const size_t ptg_idx, std::vector< double > &out_TPObstacles, mrpt::nav::ClearanceDiagram &out_clearance, const mrpt::math::TPose2D &rel_pose_PTG_origin_wrt_sense, const bool eval_clearance)=0
 Builds TP-Obstacles from Workspace obstacles for the given PTG. More...
 
virtual void loggingGetWSObstaclesAndShape (CLogFileRecord &out_log)=0
 Generates a pointcloud of obstacles, and the robot shape, to be saved in the logging record for the current timestep. More...
 
void calc_move_candidate_scores (TCandidateMovementPTG &holonomicMovement, const std::vector< double > &in_TPObstacles, const mrpt::nav::ClearanceDiagram &in_clearance, const std::vector< mrpt::math::TPose2D > &WS_Targets, const std::vector< PTGTarget > &TP_Targets, CLogFileRecord::TInfoPerPTG &log, CLogFileRecord &newLogRec, const bool this_is_PTG_continuation, const mrpt::math::TPose2D &relPoseVelCmd_NOP, const unsigned int ptg_idx4weights, const mrpt::system::TTimeStamp tim_start_iteration)
 Scores holonomicMovement. More...
 
virtual double generate_vel_cmd (const TCandidateMovementPTG &in_movement, mrpt::kinematics::CVehicleVelCmdPtr &new_vel_cmd)
 Return the [0,1] velocity scale of raw PTG cmd_vel. More...
 
void STEP8_GenerateLogRecord (CLogFileRecord &newLogRec, const std::vector< mrpt::math::TPose2D > &relTargets, int nSelectedPTG, const mrpt::kinematics::CVehicleVelCmdPtr &new_vel_cmd, int nPTGs, const bool best_is_NOP_cmdvel, const math::TPose2D &rel_cur_pose_wrt_last_vel_cmd_NOP, const math::TPose2D &rel_pose_PTG_origin_wrt_sense_NOP, const double executionTimeValue, const double tim_changeSpeed, const mrpt::system::TTimeStamp &tim_start_iteration)
 
void preDestructor ()
 To be called during children destructors to assure thread-safe destruction, and free of shared objects. More...
 
virtual void onStartNewNavigation () MRPT_OVERRIDE
 Called whenever a new navigation has been started. More...
 
void build_movement_candidate (CParameterizedTrajectoryGenerator *ptg, const size_t indexPTG, const std::vector< mrpt::math::TPose2D > &relTargets, const mrpt::math::TPose2D &rel_pose_PTG_origin_wrt_sense, TInfoPerPTG &ipf, TCandidateMovementPTG &holonomicMovement, CLogFileRecord &newLogRec, const bool this_is_PTG_continuation, mrpt::nav::CAbstractHolonomicReactiveMethod *holoMethod, const mrpt::system::TTimeStamp tim_start_iteration, const TNavigationParams &navp=TNavigationParams(), const mrpt::math::TPose2D &relPoseVelCmd_NOP=mrpt::poses::CPose2D())
 
virtual bool checkHasReachedTarget (const double targetDist) const MRPT_OVERRIDE
 Default implementation: check if target_dist is below the accepted distance. More...
 
virtual void waypoints_navigationStep ()
 The waypoints-specific part of navigationStep() More...
 
bool waypoints_isAligning () const
 
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 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< CAbstractHolonomicReactiveMethod * > m_holonomicMethod
 The holonomic navigation algorithm (one object per PTG, so internal states are maintained) More...
 
mrpt::utils::CStreamm_logFile
 
mrpt::utils::CStreamm_prev_logfile
 The current log file stream, or NULL if not being used. More...
 
bool m_enableKeepLogRecords
 See enableKeepLogRecords. More...
 
CLogFileRecord lastLogRecord
 The last log. More...
 
mrpt::kinematics::CVehicleVelCmdPtr m_last_vel_cmd
 Last velocity commands. More...
 
mrpt::synch::CCriticalSectionRecursive m_critZoneLastLog
 Critical zones. More...
 
bool m_enableConsoleOutput
 Enables / disables the console debug output. More...
 
bool m_init_done
 Whether loadConfigFile() has been called or not. More...
 
mrpt::utils::CTicTac timerForExecutionPeriod
 
mrpt::utils::CTimeLogger m_timelogger
 A complete time logger. More...
 
bool m_PTGsMustBeReInitialized
 
bool m_closing_navigator
 Signal that the destructor has been called, so no more calls are accepted from other threads. More...
 
mrpt::system::TTimeStamp m_WS_Obstacles_timestamp
 
mrpt::maps::CPointCloudFilterBasePtr m_WS_filter
 Default: none. More...
 
mrpt::nav::CMultiObjectiveMotionOptimizerBasePtr m_multiobjopt
 
std::vector< TInfoPerPTGm_infoPerPTG
 Temporary buffers for working with each PTG during a navigationStep() More...
 
mrpt::system::TTimeStamp m_infoPerPTG_timestamp
 
TSentVelCmd m_lastSentVelCmd
 
TWaypointStatusSequence m_waypoint_nav_status
 The latest waypoints navigation command and the up-to-date control status. More...
 
mrpt::synch::CCriticalSectionRecursive m_nav_waypoints_cs
 
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
 
Variables for CReactiveNavigationSystem::performNavigationStep
mrpt::utils::CTicTac totalExecutionTime
 
mrpt::utils::CTicTac executionTime
 
mrpt::utils::CTicTac tictac
 
mrpt::math::LowPassFilter_IIR1 meanExecutionTime
 
mrpt::math::LowPassFilter_IIR1 meanTotalExecutionTime
 
mrpt::math::LowPassFilter_IIR1 meanExecutionPeriod
 Runtime estimation of execution period of the method. More...
 
mrpt::math::LowPassFilter_IIR1 tim_changeSpeed_avr
 
mrpt::math::LowPassFilter_IIR1 timoff_obstacles_avr
 
mrpt::math::LowPassFilter_IIR1 timoff_curPoseAndSpeed_avr
 
mrpt::math::LowPassFilter_IIR1 timoff_sendVelCmd_avr
 

Private Member Functions

void deleteHolonomicObjects ()
 Delete m_holonomicMethod. More...
 

Private Attributes

std::string m_navlogfiles_dir
 Default: "./reactivenav.logs". More...
 
double m_expr_var_k
 
double m_expr_var_k_target
 
double m_expr_var_num_paths
 
TNavigationParamsm_copy_prev_navParams
 A copy of last-iteration navparams, used to detect changes. More...
 

Navigation control API

virtual void navigate (const TNavigationParams *params)
 Navigation request to a single target location. 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

◆ CAbstractPTGBasedReactive()

mrpt::nav::CAbstractPTGBasedReactive::CAbstractPTGBasedReactive ( CRobot2NavInterface react_iterf_impl,
bool  enableConsoleOutput = true,
bool  enableLogFile = false,
const std::string &  logFileDirectory = std::string("./reactivenav.logs") 
)

Constructor.

Parameters
[in]react_iterf_implAn instance of an object that implement all the required interfaces to read from and control a robot.
[in]enableConsoleOutputCan be set to false to reduce verbosity.
[in]enableLogFileSet to true to enable creation of navigation log files, useful for inspection and debugging.

◆ ~CAbstractPTGBasedReactive()

virtual mrpt::nav::CAbstractPTGBasedReactive::~CAbstractPTGBasedReactive ( )
virtual

Member Function Documentation

◆ build_movement_candidate()

void mrpt::nav::CAbstractPTGBasedReactive::build_movement_candidate ( CParameterizedTrajectoryGenerator ptg,
const size_t  indexPTG,
const std::vector< mrpt::math::TPose2D > &  relTargets,
const mrpt::math::TPose2D rel_pose_PTG_origin_wrt_sense,
TInfoPerPTG ipf,
TCandidateMovementPTG holonomicMovement,
CLogFileRecord newLogRec,
const bool  this_is_PTG_continuation,
mrpt::nav::CAbstractHolonomicReactiveMethod holoMethod,
const mrpt::system::TTimeStamp  tim_start_iteration,
const TNavigationParams navp = TNavigationParams(),
const mrpt::math::TPose2D relPoseVelCmd_NOP = mrpt::poses::CPose2D() 
)
protected

◆ calc_move_candidate_scores()

void mrpt::nav::CAbstractPTGBasedReactive::calc_move_candidate_scores ( TCandidateMovementPTG holonomicMovement,
const std::vector< double > &  in_TPObstacles,
const mrpt::nav::ClearanceDiagram in_clearance,
const std::vector< mrpt::math::TPose2D > &  WS_Targets,
const std::vector< PTGTarget > &  TP_Targets,
CLogFileRecord::TInfoPerPTG log,
CLogFileRecord newLogRec,
const bool  this_is_PTG_continuation,
const mrpt::math::TPose2D relPoseVelCmd_NOP,
const unsigned int  ptg_idx4weights,
const mrpt::system::TTimeStamp  tim_start_iteration 
)
protected

Scores holonomicMovement.

◆ cancel()

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

Cancel current navegation.

Reimplemented from mrpt::nav::CAbstractNavigator.

◆ changeCurrentRobotSpeedLimits()

mrpt::kinematics::CVehicleVelCmd::TVelCmdParams& mrpt::nav::CAbstractPTGBasedReactive::changeCurrentRobotSpeedLimits ( )
inline

Changes the current, global (honored for all PTGs) robot speed limits, via returning a reference to a structure that holds those limits.

Definition at line 202 of file CAbstractPTGBasedReactive.h.

References MRPT_OVERRIDE, and mrpt::nav::CAbstractPTGBasedReactive::TAbstractPTGNavigatorParams::robot_absolute_speed_limits.

◆ 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::CWaypointsNavigator::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 from mrpt::nav::CAbstractNavigator.

◆ deleteHolonomicObjects()

void mrpt::nav::CAbstractPTGBasedReactive::deleteHolonomicObjects ( )
private

Delete m_holonomicMethod.

◆ 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.

◆ enableKeepLogRecords()

void mrpt::nav::CAbstractPTGBasedReactive::enableKeepLogRecords ( bool  enable = true)
inline

Enables keeping an internal registry of navigation logs that can be queried with getLastLogRecord()

Definition at line 125 of file CAbstractPTGBasedReactive.h.

◆ enableLogFile()

void mrpt::nav::CAbstractPTGBasedReactive::enableLogFile ( bool  enable)

Enables/disables saving log files.

◆ enableTimeLog()

void mrpt::nav::CAbstractPTGBasedReactive::enableTimeLog ( bool  enable = true)
inline

Enables/disables the detailed time logger (default:disabled upon construction) When enabled, a report will be dumped to std::cout upon destruction.

See also
getTimeLogger

Definition at line 185 of file CAbstractPTGBasedReactive.h.

◆ generate_vel_cmd()

virtual double mrpt::nav::CAbstractPTGBasedReactive::generate_vel_cmd ( const TCandidateMovementPTG in_movement,
mrpt::kinematics::CVehicleVelCmdPtr &  new_vel_cmd 
)
protectedvirtual

Return the [0,1] velocity scale of raw PTG cmd_vel.

◆ getCurrentRobotSpeedLimits()

const mrpt::kinematics::CVehicleVelCmd::TVelCmdParams& mrpt::nav::CAbstractPTGBasedReactive::getCurrentRobotSpeedLimits ( ) const
inline

Get the current, global (honored for all PTGs) robot speed limits.

Definition at line 197 of file CAbstractPTGBasedReactive.h.

References mrpt::nav::CAbstractPTGBasedReactive::TAbstractPTGNavigatorParams::robot_absolute_speed_limits.

◆ 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.

◆ getLastLogRecord()

void mrpt::nav::CAbstractPTGBasedReactive::getLastLogRecord ( CLogFileRecord o)

Provides a copy of the last log record with information about execution.

Parameters
oAn object where the log will be stored into.
Note
Log records are not prepared unless either "enableLogFile" is enabled in the constructor or "enableLogFile()" has been called.

◆ getLogFileDirectory()

std::string mrpt::nav::CAbstractPTGBasedReactive::getLogFileDirectory ( ) const
inline

Definition at line 132 of file CAbstractPTGBasedReactive.h.

◆ getPTG() [1/2]

virtual CParameterizedTrajectoryGenerator* mrpt::nav::CAbstractPTGBasedReactive::getPTG ( size_t  i)
pure virtual

◆ getPTG() [2/2]

virtual const CParameterizedTrajectoryGenerator* mrpt::nav::CAbstractPTGBasedReactive::getPTG ( size_t  i) const
pure virtual

◆ getPTG_count()

virtual size_t mrpt::nav::CAbstractPTGBasedReactive::getPTG_count ( ) const
pure virtual

Returns the number of different PTGs that have been setup.

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

◆ getTargetApproachSlowDownDistance()

double mrpt::nav::CAbstractPTGBasedReactive::getTargetApproachSlowDownDistance ( ) const

Returns this parameter for the first inner holonomic navigator instances [m] (should be the same in all of them?)

◆ getTimeLogger()

const mrpt::utils::CTimeLogger& mrpt::nav::CAbstractPTGBasedReactive::getTimeLogger ( ) const
inline

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

See also
enableTimeLog

Definition at line 190 of file CAbstractPTGBasedReactive.h.

◆ getWaypointNavStatus() [1/2]

virtual void mrpt::nav::CWaypointsNavigator::getWaypointNavStatus ( TWaypointStatusSequence out_nav_status) const
virtualinherited

Get a copy of the control structure which describes the progress status of the waypoint navigation.

◆ getWaypointNavStatus() [2/2]

TWaypointStatusSequence mrpt::nav::CWaypointsNavigator::getWaypointNavStatus ( ) const
inlineinherited

Get a copy of the control structure which describes the progress status of the waypoint navigation.

Definition at line 69 of file CWaypointsNavigator.h.

◆ impl_waypoint_is_reachable()

virtual bool mrpt::nav::CAbstractPTGBasedReactive::impl_waypoint_is_reachable ( const mrpt::math::TPoint2D wp_local_wrt_robot) const
protectedvirtual

Implements the way to waypoint is free function in children classes: true must be returned if, according to the information gathered at the last navigation step, there is a free path to the given point; false otherwise: if way is blocked or there is missing information, the point is out of range, etc.

Implements mrpt::nav::CWaypointsNavigator.

◆ implementSenseObstacles()

virtual bool mrpt::nav::CAbstractPTGBasedReactive::implementSenseObstacles ( mrpt::system::TTimeStamp obs_timestamp)
protectedpure virtual

Return false on any fatal error.

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

◆ initialize()

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

Must be called for loading collision grids, or the first navigation command may last a long time to be executed.

Internally, it just calls STEP1_CollisionGridsBuilder().

Implements mrpt::nav::CAbstractNavigator.

◆ isRelativePointReachable()

bool mrpt::nav::CWaypointsNavigator::isRelativePointReachable ( const mrpt::math::TPoint2D wp_local_wrt_robot) const
inherited

Returns true if, according to the information gathered at the last navigation step, there is a free path to the given point; false otherwise: if way is blocked or there is missing information, the point is out of range for the existing PTGs, etc.

◆ loadConfigFile()

virtual void mrpt::nav::CAbstractPTGBasedReactive::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::CWaypointsNavigator.

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

◆ loggingGetWSObstaclesAndShape()

virtual void mrpt::nav::CAbstractPTGBasedReactive::loggingGetWSObstaclesAndShape ( CLogFileRecord out_log)
protectedpure virtual

Generates a pointcloud of obstacles, and the robot shape, to be saved in the logging record for the current timestep.

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

◆ navigate()

virtual void mrpt::nav::CAbstractNavigator::navigate ( const TNavigationParams params)
virtualinherited

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 in mrpt::nav::CNavigatorManualSequence.

◆ navigateWaypoints()

virtual void mrpt::nav::CWaypointsNavigator::navigateWaypoints ( const TWaypointSequence nav_request)
virtualinherited

Waypoint navigation request.

This immediately cancels any other previous on-going navigation.

See also
CAbstractNavigator::navigate() for single waypoint navigation requests.

◆ navigationStep()

virtual void mrpt::nav::CWaypointsNavigator::navigationStep ( )
virtualinherited

This method must be called periodically in order to effectively run the navigation.

Reimplemented from mrpt::nav::CAbstractNavigator.

◆ onStartNewNavigation()

virtual void mrpt::nav::CAbstractPTGBasedReactive::onStartNewNavigation ( )
protectedvirtual

Called whenever a new navigation has been started.

Can be used to reset state variables, etc.

Reimplemented from mrpt::nav::CWaypointsNavigator.

◆ performNavigationStep()

virtual void mrpt::nav::CAbstractPTGBasedReactive::performNavigationStep ( )
protectedvirtual

The main method for the navigator.

Implements mrpt::nav::CAbstractNavigator.

◆ 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()

◆ preDestructor()

void mrpt::nav::CAbstractPTGBasedReactive::preDestructor ( )
protected

To be called during children destructors to assure thread-safe destruction, and free of shared objects.

◆ 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::CAbstractPTGBasedReactive::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::CWaypointsNavigator.

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

◆ 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]

◆ setHolonomicMethod() [1/2]

void mrpt::nav::CAbstractPTGBasedReactive::setHolonomicMethod ( const std::string &  method,
const mrpt::utils::CConfigFileBase cfgBase 
)

Selects which one from the set of available holonomic methods will be used into transformed TP-Space, and sets its configuration from a configuration file.

Available methods: class names of those derived from CAbstractHolonomicReactiveMethod

◆ setHolonomicMethod() [2/2]

void mrpt::nav::CAbstractPTGBasedReactive::setHolonomicMethod ( THolonomicMethod  method,
const mrpt::utils::CConfigFileBase cfgBase 
)

◆ setLogFileDirectory()

void mrpt::nav::CAbstractPTGBasedReactive::setLogFileDirectory ( const std::string &  sDir)
inline

Changes the prefix for new log files.

Definition at line 131 of file CAbstractPTGBasedReactive.h.

◆ setTargetApproachSlowDownDistance()

void mrpt::nav::CAbstractPTGBasedReactive::setTargetApproachSlowDownDistance ( const double  dist)

Changes this parameter in all inner holonomic navigator instances [m].

◆ STEP1_InitPTGs()

virtual void mrpt::nav::CAbstractPTGBasedReactive::STEP1_InitPTGs ( )
protectedpure virtual

◆ STEP2_SenseObstacles()

bool mrpt::nav::CAbstractPTGBasedReactive::STEP2_SenseObstacles ( )
protected

◆ STEP3_WSpaceToTPSpace()

virtual void mrpt::nav::CAbstractPTGBasedReactive::STEP3_WSpaceToTPSpace ( const size_t  ptg_idx,
std::vector< double > &  out_TPObstacles,
mrpt::nav::ClearanceDiagram out_clearance,
const mrpt::math::TPose2D rel_pose_PTG_origin_wrt_sense,
const bool  eval_clearance 
)
protectedpure virtual

Builds TP-Obstacles from Workspace obstacles for the given PTG.

"out_TPObstacles" is already initialized to the proper length and maximum collision-free distance for each "k" trajectory index. Distances are in "pseudo-meters". They will be normalized automatically to [0,1] upon return.

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

◆ STEP8_GenerateLogRecord()

void mrpt::nav::CAbstractPTGBasedReactive::STEP8_GenerateLogRecord ( CLogFileRecord newLogRec,
const std::vector< mrpt::math::TPose2D > &  relTargets,
int  nSelectedPTG,
const mrpt::kinematics::CVehicleVelCmdPtr &  new_vel_cmd,
int  nPTGs,
const bool  best_is_NOP_cmdvel,
const math::TPose2D rel_cur_pose_wrt_last_vel_cmd_NOP,
const math::TPose2D rel_pose_PTG_origin_wrt_sense_NOP,
const double  executionTimeValue,
const double  tim_changeSpeed,
const mrpt::system::TTimeStamp tim_start_iteration 
)
protected

◆ 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.

◆ waypoints_isAligning()

bool mrpt::nav::CWaypointsNavigator::waypoints_isAligning ( ) const
inlineprotectedinherited

Definition at line 113 of file CWaypointsNavigator.h.

◆ waypoints_navigationStep()

virtual void mrpt::nav::CWaypointsNavigator::waypoints_navigationStep ( )
protectedvirtualinherited

The waypoints-specific part of navigationStep()

Member Data Documentation

◆ executionTime

mrpt::utils::CTicTac mrpt::nav::CAbstractPTGBasedReactive::executionTime
protected

Definition at line 230 of file CAbstractPTGBasedReactive.h.

◆ lastLogRecord

CLogFileRecord mrpt::nav::CAbstractPTGBasedReactive::lastLogRecord
protected

The last log.

Definition at line 216 of file CAbstractPTGBasedReactive.h.

◆ 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_closing_navigator

bool mrpt::nav::CAbstractPTGBasedReactive::m_closing_navigator
protected

Signal that the destructor has been called, so no more calls are accepted from other threads.

Definition at line 284 of file CAbstractPTGBasedReactive.h.

◆ m_copy_prev_navParams

TNavigationParams* mrpt::nav::CAbstractPTGBasedReactive::m_copy_prev_navParams
private

A copy of last-iteration navparams, used to detect changes.

Definition at line 340 of file CAbstractPTGBasedReactive.h.

◆ m_critZoneLastLog

mrpt::synch::CCriticalSectionRecursive mrpt::nav::CAbstractPTGBasedReactive::m_critZoneLastLog
protected

Critical zones.

Definition at line 219 of file CAbstractPTGBasedReactive.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_enableConsoleOutput

bool mrpt::nav::CAbstractPTGBasedReactive::m_enableConsoleOutput
protected

Enables / disables the console debug output.

Definition at line 221 of file CAbstractPTGBasedReactive.h.

◆ m_enableKeepLogRecords

bool mrpt::nav::CAbstractPTGBasedReactive::m_enableKeepLogRecords
protected

See enableKeepLogRecords.

Definition at line 215 of file CAbstractPTGBasedReactive.h.

◆ m_expr_var_k

double mrpt::nav::CAbstractPTGBasedReactive::m_expr_var_k
private

Definition at line 339 of file CAbstractPTGBasedReactive.h.

◆ m_expr_var_k_target

double mrpt::nav::CAbstractPTGBasedReactive::m_expr_var_k_target
private

Definition at line 339 of file CAbstractPTGBasedReactive.h.

◆ m_expr_var_num_paths

double mrpt::nav::CAbstractPTGBasedReactive::m_expr_var_num_paths
private

Definition at line 339 of file CAbstractPTGBasedReactive.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_holonomicMethod

std::vector<CAbstractHolonomicReactiveMethod*> mrpt::nav::CAbstractPTGBasedReactive::m_holonomicMethod
protected

The holonomic navigation algorithm (one object per PTG, so internal states are maintained)

Definition at line 213 of file CAbstractPTGBasedReactive.h.

◆ m_infoPerPTG

std::vector<TInfoPerPTG> mrpt::nav::CAbstractPTGBasedReactive::m_infoPerPTG
protected

Temporary buffers for working with each PTG during a navigationStep()

Definition at line 299 of file CAbstractPTGBasedReactive.h.

◆ m_infoPerPTG_timestamp

mrpt::system::TTimeStamp mrpt::nav::CAbstractPTGBasedReactive::m_infoPerPTG_timestamp
protected

Definition at line 300 of file CAbstractPTGBasedReactive.h.

◆ m_init_done

bool mrpt::nav::CAbstractPTGBasedReactive::m_init_done
protected

Whether loadConfigFile() has been called or not.

Definition at line 222 of file CAbstractPTGBasedReactive.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_last_vel_cmd

mrpt::kinematics::CVehicleVelCmdPtr mrpt::nav::CAbstractPTGBasedReactive::m_last_vel_cmd
protected

Last velocity commands.

Definition at line 217 of file CAbstractPTGBasedReactive.h.

◆ m_lastSentVelCmd

TSentVelCmd mrpt::nav::CAbstractPTGBasedReactive::m_lastSentVelCmd
protected

Definition at line 332 of file CAbstractPTGBasedReactive.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_logFile

mrpt::utils::CStream* mrpt::nav::CAbstractPTGBasedReactive::m_logFile
protected

Definition at line 214 of file CAbstractPTGBasedReactive.h.

◆ m_multiobjopt

mrpt::nav::CMultiObjectiveMotionOptimizerBasePtr mrpt::nav::CAbstractPTGBasedReactive::m_multiobjopt
protected

Definition at line 289 of file CAbstractPTGBasedReactive.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_nav_waypoints_cs

mrpt::synch::CCriticalSectionRecursive mrpt::nav::CWaypointsNavigator::m_nav_waypoints_cs
protectedinherited

Definition at line 101 of file CWaypointsNavigator.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_navlogfiles_dir

std::string mrpt::nav::CAbstractPTGBasedReactive::m_navlogfiles_dir
private

Default: "./reactivenav.logs".

Definition at line 337 of file CAbstractPTGBasedReactive.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_prev_logfile

mrpt::utils::CStream * mrpt::nav::CAbstractPTGBasedReactive::m_prev_logfile
protected

The current log file stream, or NULL if not being used.

Definition at line 214 of file CAbstractPTGBasedReactive.h.

◆ m_PTGsMustBeReInitialized

bool mrpt::nav::CAbstractPTGBasedReactive::m_PTGsMustBeReInitialized
protected

Definition at line 226 of file CAbstractPTGBasedReactive.h.

◆ m_robot

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

The navigator-robot interface.

Definition at line 228 of file CAbstractNavigator.h.

◆ m_timelogger

mrpt::utils::CTimeLogger mrpt::nav::CAbstractPTGBasedReactive::m_timelogger
protected

A complete time logger.

See also
enableTimeLog()

Definition at line 225 of file CAbstractPTGBasedReactive.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.

◆ m_waypoint_nav_status

TWaypointStatusSequence mrpt::nav::CWaypointsNavigator::m_waypoint_nav_status
protectedinherited

The latest waypoints navigation command and the up-to-date control status.

Definition at line 100 of file CWaypointsNavigator.h.

◆ m_WS_filter

mrpt::maps::CPointCloudFilterBasePtr mrpt::nav::CAbstractPTGBasedReactive::m_WS_filter
protected

Default: none.

Definition at line 287 of file CAbstractPTGBasedReactive.h.

◆ m_WS_Obstacles_timestamp

mrpt::system::TTimeStamp mrpt::nav::CAbstractPTGBasedReactive::m_WS_Obstacles_timestamp
protected

Definition at line 286 of file CAbstractPTGBasedReactive.h.

◆ meanExecutionPeriod

mrpt::math::LowPassFilter_IIR1 mrpt::nav::CAbstractPTGBasedReactive::meanExecutionPeriod
protected

Runtime estimation of execution period of the method.

Definition at line 233 of file CAbstractPTGBasedReactive.h.

◆ meanExecutionTime

mrpt::math::LowPassFilter_IIR1 mrpt::nav::CAbstractPTGBasedReactive::meanExecutionTime
protected

Definition at line 231 of file CAbstractPTGBasedReactive.h.

◆ meanTotalExecutionTime

mrpt::math::LowPassFilter_IIR1 mrpt::nav::CAbstractPTGBasedReactive::meanTotalExecutionTime
protected

Definition at line 232 of file CAbstractPTGBasedReactive.h.

◆ params_abstract_navigator

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

Definition at line 155 of file CAbstractNavigator.h.

◆ params_abstract_ptg_navigator

TAbstractPTGNavigatorParams mrpt::nav::CAbstractPTGBasedReactive::params_abstract_ptg_navigator

Definition at line 175 of file CAbstractPTGBasedReactive.h.

◆ params_waypoints_navigator

TWaypointsNavigatorParams mrpt::nav::CWaypointsNavigator::params_waypoints_navigator
inherited

Definition at line 94 of file CWaypointsNavigator.h.

◆ tictac

mrpt::utils::CTicTac mrpt::nav::CAbstractPTGBasedReactive::tictac
protected

Definition at line 230 of file CAbstractPTGBasedReactive.h.

◆ tim_changeSpeed_avr

mrpt::math::LowPassFilter_IIR1 mrpt::nav::CAbstractPTGBasedReactive::tim_changeSpeed_avr
protected

Definition at line 234 of file CAbstractPTGBasedReactive.h.

◆ timerForExecutionPeriod

mrpt::utils::CTicTac mrpt::nav::CAbstractPTGBasedReactive::timerForExecutionPeriod
protected

Definition at line 223 of file CAbstractPTGBasedReactive.h.

◆ timoff_curPoseAndSpeed_avr

mrpt::math::LowPassFilter_IIR1 mrpt::nav::CAbstractPTGBasedReactive::timoff_curPoseAndSpeed_avr
protected

Definition at line 234 of file CAbstractPTGBasedReactive.h.

◆ timoff_obstacles_avr

mrpt::math::LowPassFilter_IIR1 mrpt::nav::CAbstractPTGBasedReactive::timoff_obstacles_avr
protected

Definition at line 234 of file CAbstractPTGBasedReactive.h.

◆ timoff_sendVelCmd_avr

mrpt::math::LowPassFilter_IIR1 mrpt::nav::CAbstractPTGBasedReactive::timoff_sendVelCmd_avr
protected

Definition at line 234 of file CAbstractPTGBasedReactive.h.

◆ totalExecutionTime

mrpt::utils::CTicTac mrpt::nav::CAbstractPTGBasedReactive::totalExecutionTime
protected

Definition at line 230 of file CAbstractPTGBasedReactive.h.




Page generated by Doxygen 1.8.13 for MRPT 1.5.3 at Tue Aug 22 01:03:35 UTC 2017