This class is a multi-threaded mobile robot navigator, implementing an (anytime) PTG-based Rapidly-exploring Random Tree (PRRT) search algorithm.
Usage:
Note that all the public methods are thread-safe.
About the algorithm:
Changes history
Definition at line 52 of file CPRRTNavigator.h.
#include <mrpt/reactivenav/CPRRTNavigator.h>
Classes | |
| class | TOptions |
| struct | TPathData |
| Each data point in m_planned_path. More... | |
Public Member Functions | |
| CPRRTNavigator () | |
| Constructor. More... | |
| virtual | ~CPRRTNavigator () |
| Destructor. More... | |
Navigation control methods | |
| bool | initialize () |
| Initialize the navigator using the parameters in "params"; read the usage instructions in CPRRTNavigator. More... | |
| void | navigate (const mrpt::math::TPose2D &target_pose) |
| Starts a navigation to a 2D pose (including a desired heading at the target). More... | |
| void | navigate (const mrpt::math::TPoint2D &target_point) |
| Starts a navigation to a given 2D point (any heading at the target). More... | |
| void | cancel () |
| Cancel current navegacion. More... | |
| void | resume () |
| Continues with suspended navigation. More... | |
| void | suspend () |
| Suspend current navegation. More... | |
Debug and logging | |
| void | setPathToFollow (const TPlannedPath &path) |
| Manually sets the short-time path to be followed by the robot (use 'navigate' instead, this method is for debugging mainly) More... | |
| void | getCurrentPlannedPath (TPlannedPath &path) const |
| Returns the current planned path the robot is following. More... | |
Sensory data methods: call them to update the navigator knowledge on the outside world. | |
| void | processNewLocalization (const TPose2D &new_robot_pose, const CMatrixDouble33 &new_robot_cov, TTimeStamp timestamp) |
| Updates the navigator with a low or high-rate estimate from a localization (or SLAM) algorithm running somewhere else. More... | |
| void | processNewOdometryInfo (const TPose2D &newOdoPose, TTimeStamp timestamp, bool hasVelocities=false, float v=0, float w=0) |
| Updates the navigator with high-rate odometry from the mobile base. More... | |
| void | processNewObstaclesData (const mrpt::slam::CPointsMap *obstacles, TTimeStamp timestamp) |
| Must be called in a timely fashion to let the navigator know about the obstacles in the environment. More... | |
Virtual methods to be implemented by the user. | |
| virtual bool | onMotionCommand (float v, float w)=0 |
| This is the most important method the user must provide: to send an instantaneous velocity command to the robot. More... | |
| virtual void | onNavigationStart () |
| Re-implement this method if you want to know when a new navigation has started. More... | |
| virtual void | onNavigationEnd (bool targetReachedOK) |
| Re-implement this method if you want to know when and why a navigation has ended. More... | |
| virtual void | onApproachingTarget () |
| Re-implement this method if you want to know when the robot is approaching the target: this event is raised before onNavigationEnd, when the robot is closer than a certain distance to the target. More... | |
Public Attributes | |
| mrpt::poses::CRobot2DPoseEstimator | m_robotStateFilter |
| Object maintained by the robot-tracking thread (All methods are thread-safe). More... | |
Static Public Attributes | |
| static const double | INVALID_HEADING |
| Used to refer to undefined or "never mind" headings values. More... | |
Private Member Functions | |
| void | thread_planner () |
| Thread function. More... | |
| void | thread_test_collision () |
| Thread function. More... | |
| void | thread_path_tracking () |
| Thread function. More... | |
Private Attributes | |
| mrpt::system::TThreadHandle | m_thr_planner |
| Thread handle. More... | |
| mrpt::system::TThreadHandle | m_thr_testcol |
| Thread handle. More... | |
| mrpt::system::TThreadHandle | m_thr_pathtrack |
| Thread handle. More... | |
| bool | m_initialized |
| The object is ready to navigate. Users must call "initialize" first. More... | |
| bool | m_closingThreads |
| set to true at destructor. More... | |
| TPose2D | m_target_pose |
| Heading may be INVALID_HEADING to indicate "don't mind". More... | |
| TTimeStamp | m_target_pose_time |
| CCriticalSection | m_target_pose_cs |
| std::vector< float > | m_last_obstacles_x |
| std::vector< float > | m_last_obstacles_y |
| TTimeStamp | m_last_obstacles_time |
| CCriticalSection | m_last_obstacles_cs |
| CCriticalSection | m_planned_path_cs |
| TTimeStamp | m_planned_path_time |
| The last modification time. INVALID_TIMESTAMP means there is no path. More... | |
| TPlannedPath | m_planned_path |
| TListPTGs | m_PTGs |
| The list of PTGs used by the anytime planner to explore the free-space. More... | |
| CCriticalSection | m_PTGs_cs |
Navigator data structures | |
| typedef std::list< TPathData > | TPlannedPath |
| An ordered list of path poses. More... | |
| TOptions | params |
| Change here all the parameters of the navigator. More... | |
| typedef std::list<TPathData> mrpt::reactivenav::CPRRTNavigator::TPlannedPath |
An ordered list of path poses.
Definition at line 114 of file CPRRTNavigator.h.
| mrpt::reactivenav::CPRRTNavigator::CPRRTNavigator | ( | ) |
Constructor.
|
virtual |
Destructor.
| void mrpt::reactivenav::CPRRTNavigator::cancel | ( | ) |
Cancel current navegacion.
| void mrpt::reactivenav::CPRRTNavigator::getCurrentPlannedPath | ( | TPlannedPath & | path | ) | const |
Returns the current planned path the robot is following.
| bool mrpt::reactivenav::CPRRTNavigator::initialize | ( | ) |
Initialize the navigator using the parameters in "params"; read the usage instructions in CPRRTNavigator.
This method should be called only once at the beginning of the robot operation.
| void mrpt::reactivenav::CPRRTNavigator::navigate | ( | const mrpt::math::TPose2D & | target_pose | ) |
Starts a navigation to a 2D pose (including a desired heading at the target).
| void mrpt::reactivenav::CPRRTNavigator::navigate | ( | const mrpt::math::TPoint2D & | target_point | ) |
Starts a navigation to a given 2D point (any heading at the target).
|
inlinevirtual |
Re-implement this method if you want to know when the robot is approaching the target: this event is raised before onNavigationEnd, when the robot is closer than a certain distance to the target.
Definition at line 228 of file CPRRTNavigator.h.
|
pure virtual |
This is the most important method the user must provide: to send an instantaneous velocity command to the robot.
| v | Desired linear speed, in meters/second. |
| w | Desired angular speed, in rads/second. |
|
inlinevirtual |
Re-implement this method if you want to know when and why a navigation has ended.
| targetReachedOK | Will be false if the navigation failed. |
Definition at line 221 of file CPRRTNavigator.h.
References MRPT_UNUSED_PARAM.
|
inlinevirtual |
Re-implement this method if you want to know when a new navigation has started.
Definition at line 216 of file CPRRTNavigator.h.
| void mrpt::reactivenav::CPRRTNavigator::processNewLocalization | ( | const TPose2D & | new_robot_pose, |
| const CMatrixDouble33 & | new_robot_cov, | ||
| TTimeStamp | timestamp | ||
| ) |
Updates the navigator with a low or high-rate estimate from a localization (or SLAM) algorithm running somewhere else.
| new_robot_pose | The (global) coordinates of the mean robot pose as estimated by some external module. |
| new_robot_cov | The 3x3 covariance matrix of that estimate. |
| timestamp | The associated timestamp of the data. |
| void mrpt::reactivenav::CPRRTNavigator::processNewObstaclesData | ( | const mrpt::slam::CPointsMap * | obstacles, |
| TTimeStamp | timestamp | ||
| ) |
Must be called in a timely fashion to let the navigator know about the obstacles in the environment.
| obstacles | |
| timestamp | The associated timestamp of the sensed points. |
| void mrpt::reactivenav::CPRRTNavigator::processNewOdometryInfo | ( | const TPose2D & | newOdoPose, |
| TTimeStamp | timestamp, | ||
| bool | hasVelocities = false, |
||
| float | v = 0, |
||
| float | w = 0 |
||
| ) |
Updates the navigator with high-rate odometry from the mobile base.
The odometry poses are dealed internally as increments only, so there is no problem is arbitrary mismatches between localization (from a particle filter or SLAM) and the odometry.
| newOdoPose | The global, cummulative odometry as computed by the robot. |
| timestamp | The associated timestamp of the measurement. |
| hasVelocities | If false, the next arguments are ignored. |
| v | Measured linear speed, in m/s. |
| w | Measured angular speed, in rad/s. |
| void mrpt::reactivenav::CPRRTNavigator::resume | ( | ) |
Continues with suspended navigation.
| void mrpt::reactivenav::CPRRTNavigator::setPathToFollow | ( | const TPlannedPath & | path | ) |
Manually sets the short-time path to be followed by the robot (use 'navigate' instead, this method is for debugging mainly)
| void mrpt::reactivenav::CPRRTNavigator::suspend | ( | ) |
|
private |
Thread function.
|
private |
Thread function.
|
private |
Thread function.
|
static |
Used to refer to undefined or "never mind" headings values.
Definition at line 232 of file CPRRTNavigator.h.
|
private |
set to true at destructor.
Definition at line 249 of file CPRRTNavigator.h.
|
private |
The object is ready to navigate. Users must call "initialize" first.
Definition at line 248 of file CPRRTNavigator.h.
|
private |
Definition at line 261 of file CPRRTNavigator.h.
|
private |
Definition at line 260 of file CPRRTNavigator.h.
|
private |
Definition at line 259 of file CPRRTNavigator.h.
|
private |
Definition at line 259 of file CPRRTNavigator.h.
|
private |
Definition at line 266 of file CPRRTNavigator.h.
|
private |
Definition at line 264 of file CPRRTNavigator.h.
|
private |
The last modification time. INVALID_TIMESTAMP means there is no path.
Definition at line 265 of file CPRRTNavigator.h.
|
private |
The list of PTGs used by the anytime planner to explore the free-space.
Definition at line 269 of file CPRRTNavigator.h.
|
private |
Definition at line 270 of file CPRRTNavigator.h.
| mrpt::poses::CRobot2DPoseEstimator mrpt::reactivenav::CPRRTNavigator::m_robotStateFilter |
Object maintained by the robot-tracking thread (All methods are thread-safe).
Definition at line 274 of file CPRRTNavigator.h.
|
private |
Heading may be INVALID_HEADING to indicate "don't mind".
Definition at line 251 of file CPRRTNavigator.h.
|
private |
Definition at line 253 of file CPRRTNavigator.h.
|
private |
Definition at line 252 of file CPRRTNavigator.h.
|
private |
Thread handle.
Definition at line 239 of file CPRRTNavigator.h.
|
private |
Thread handle.
Definition at line 237 of file CPRRTNavigator.h.
|
private |
Thread handle.
Definition at line 238 of file CPRRTNavigator.h.
| TOptions mrpt::reactivenav::CPRRTNavigator::params |
Change here all the parameters of the navigator.
Definition at line 160 of file CPRRTNavigator.h.
| Page generated by Doxygen 1.8.8 for MRPT 1.2.2 SVN:Unversioned directory at Tue Oct 14 02:14:08 UTC 2014 |