[mrpt-nav]
Overview
Autonomous navigation, path planning
Library mrpt-nav
This library is part of MRPT and can be installed in Debian-based systems with:
sudo apt install libmrpt-nav-dev
Read also how to import MRPT into your CMake scripts.
Overview
mrpt-nav provides reactive and planned navigation for mobile robots. The architecture is layered:
CAbstractNavigator ← base state machine (IDLE / NAVIGATING / SUSPENDED / NAV_ERROR) └── CWaypointsNavigator ← waypoint sequencing on top of single-goal navigation └── CAbstractPTGBasedReactive ← TP-Space reactive core ├── CReactiveNavigationSystem ← 2-D robots └── CReactiveNavigationSystem3D ← multi-level 3-D robots
Reactive navigation
Navigator state machine
mrpt::nav::CAbstractNavigator drives a state machine with four states (mrpt::nav::CAbstractNavigator::TState):
State |
Meaning |
|---|---|
|
No active navigation goal |
|
Actively navigating toward target |
|
Navigation paused (call |
|
An unrecoverable error occurred; query |
Error codes (mrpt::nav::CAbstractNavigator::TErrorCode) are stored in the TErrorReason struct returned by getErrorReason() :
Code |
Meaning |
|---|---|
|
No error |
|
Robot stopped due to safety violation |
|
Timeout: robot not approaching target |
|
Unclassified exception |
Waypoint navigation
mrpt::nav::CWaypointsNavigator extends the base navigator with a sequence of waypoints (TWaypointSequence). Each waypoint can optionally be skipped if the robot can reach a later one more directly.
Thread-safe access to the waypoint list:
// Preferred RAII form: auto guard = nav.getWaypointsAccessGuard(); guard.waypoints().waypoints[2].allow_skip = false; // mutex released automatically when guard goes out of scope
TP-Space reactive core
mrpt::nav::CAbstractPTGBasedReactive implements the TP-Space obstacle transformation method:
For each PTG (Parameterized Trajectory Generator), obstacles in workspace are projected into TP-Space via
CParameterizedTrajectoryGenerator::updateTPObstacle().The selected holonomic method (
CHolonomicVFF,CHolonomicND, orCHolonomicFullEval) picks a direction in the normalized TP-Space.The chosen TP-Space motion is mapped back to a velocity command via
CParameterizedTrajectoryGenerator::directionToMotionCommand().
Holonomic navigation methods
All holonomic methods derive from mrpt::nav::CAbstractHolonomicReactiveMethod and implement navigate(NavInput, NavOutput).
Class |
Algorithm |
|---|---|
Virtual Force Fields — repulsive forces from obstacles + attractive force toward target |
|
Nearness Diagram — gap-based obstacle avoidance (Minguez & Montano, 2004) |
|
Full-evaluation scoring across all TP-Space directions |
The navigation situation selected by CHolonomicND is recorded in CLogFileRecord_ND::situation (mrpt::nav::CHolonomicND::TSituations):
Value |
Meaning |
|---|---|
|
Straight free path to target |
|
Narrow gap selected |
|
Wide gap selected |
|
No traversable gap; robot stops |
Parameterized Trajectory Generators (PTGs)
PTGs define families of robot trajectories parameterized by a heading angle α. They transform between Workspace (WS) and TP-Space. All derive from mrpt::nav::CParameterizedTrajectoryGenerator.
Class |
Robot kinematics |
|---|---|
|
Differential drive — circular arc |
|
Differential drive — circular arc + straight |
|
Differential drive — two circular arcs (same direction) |
|
Differential drive — two arcs + straight |
|
Differential drive — trapezoidal steering |
|
Holonomic robot with velocity blending |
Collision behavior when an obstacle is detected inside the robot shape at the start of a PTG path is controlled globally via CParameterizedTrajectoryGenerator::COLLISION_BEHAVIOR() (mrpt::nav::PTGCollisionBehavior):
Value |
Effect |
|---|---|
|
(default) Allow reverse motions to escape near-collision |
|
Reject any motion when robot is already in near-collision |
Path planning
Class |
Algorithm |
|---|---|
Simple 2-D A* on an occupancy grid |
|
RRT planner in SE(2) using PTG-space expansion |
Robot interface
Users must implement mrpt::nav::CRobot2NavInterface, providing:
getCurrentPoseAndSpeeds()— current robot pose and velocitychangeSpeed()/stop()— velocity commandsEvent callbacks:
sendNavigationStartEvent(),sendNavigationEndEvent(), etc.
mrpt::nav::CRobot2NavInterfaceForSimulator offers a ready-made implementation backed by a kinematic simulator.
Library contents
// global functions void mrpt::nav::registerAllClasses_mrpt_nav();
Global Functions
void mrpt::nav::registerAllClasses_mrpt_nav()
Forces manual RTTI registration of all serializable classes in this namespace.
Should never be required to be explicitly called by users, except if building MRPT as a static library.