mrpt_tps_astar_planner
ROS Path Planner with A* in TP-Space Engine
- Standard Documents
- ROS Package Dependencies
- mrpt_gui
- mrpt_maps
- mrpt_nav
- mrpt_kinematics
- mrpt_math
- mrpt_system
- mrpt_containers
- mrpt_opengl
- mrpt_viz
- mrpt_libros_bridge
- geometry_msgs
- mrpt_msgs
- mrpt_nav_interfaces
- mrpt_path_planning_core
- mrpt_path_planning_apps
- nav_msgs
- rclcpp
- rclcpp_action
- rclcpp_components
- sensor_msgs
- tf2
- tf2_geometry_msgs
- tf2_ros
- visualization_msgs
- ament_cmake_lint_cmake
- ament_cmake_xmllint
- ament_lint_auto
README
mrpt_tps_astar_planner
Overview
This package provides a ROS 2 node that uses the PTG-based A* planner from
mrpt_path_planning to compute collision-free waypoint sequences for a
non-holonomic robot, respecting its real shape, orientation, and kinematic
constraints.
Planning is performed on a SE(2) lattice using Parameterized Trajectory
Generator (PTG) families that encode the robot’s motion primitives. The result
is published as a mrpt_msgs/WaypointSequence (and a nav_msgs/Path for
visualization) and/or returned as the response of a ROS 2 service call.
The node supports concurrent service requests: each executor thread owns a lazily-initialized planner instance, so multiple clients can request plans simultaneously without blocking each other.
How to cite
Configuration
Key configuration files passed as ROS 2 parameters:
Parameter |
Description |
|---|---|
|
INI file describing PTG families (robot kinematics) |
|
YAML file with A* algorithm parameters |
|
YAML file for costmap obstacle-inflation parameters |
|
YAML file for waypoint-preference cost weights |
Demos
See the path-planner-sandbox/ subdirectory for standalone test scripts and
sample maps.
Node: mrpt_tps_astar_planner_node
Working rationale
Obstacle data are maintained from subscribed gridmaps and/or point-cloud topics (updated asynchronously, protected by a mutex).
On each planning request (topic goal or service call) the node snapshots the current obstacle data, builds cost evaluators, and runs the A* planner.
The planned path is interpolated at a fixed time step and converted to a
WaypointSequence.
At startup the PTG lookup tables are built in the background, which can take
tens of seconds. The planning services and the navigate_goal action are only
offered once they are ready, so clients see them as unavailable (and can wait
for them) instead of getting a failed plan. Topic goals received meanwhile are
rejected with a warning in the log (PTGs initialized marks when the node is
ready).
The A* implementation is an anytime algorithm: it improves the solution while
time allows, then returns the best found. An optional refinement pass
(astar_skip_refine: false) further smooths the result.
ROS 2 parameters
Parameter |
Default |
Description |
|---|---|---|
|
|
Open an MRPT 3D window showing maps and the planned path |
|
|
TF frame of the global map |
|
|
TF frame of the robot |
|
|
|
|
(empty) |
Comma-separated occupancy-grid topics for obstacles |
|
(empty) |
Comma-separated |
|
|
Subset of the above topics to subscribe with transient-local QoS |
|
|
Topic on which to publish the resulting waypoint sequence |
|
|
Prefix for costmap debug publishers |
|
(required) |
Path to PTG |
|
(required) |
Path to planner YAML file |
|
(required) |
Path to costmap YAML file |
|
(required) |
Path to waypoint-preference YAML file |
|
|
Extra margin [m] added around the planning bounding box |
|
|
If true, obstacle extents are excluded from the bounding box |
|
|
If true, skip the post-A* trajectory refinement pass |
|
|
Extra cost per second driven in reverse, so paths only back up when it pays off (0: same cost as forward) |
|
|
Extra cost per radian of heading change, so paths drive straight instead of weaving, unless turning pays off (0: no penalty; needs a |
|
|
Maximum A* computation time per plan request [s]; |
|
|
Acceptance radius [m] for intermediate waypoints |
|
|
Acceptance radius [m] for the goal waypoint |
|
|
Whether intermediate waypoints may be skipped |
|
|
Whether the final waypoint may be skipped |
|
|
Whether heading is ignored at intermediate waypoints |
|
|
Whether heading is ignored at the final waypoint |
|
|
Publish the best partial path after this time [s] if the goal is not reached yet (<=0: only full paths) |
|
|
Minimum progress toward the goal [m] of a partial path |
|
|
Partial paths are cut to this length [m], so a dead end (the node closest to the goal may be one) does not take the robot far before the search finds the way around ( |
|
|
Keep replanning while driving (see above) |
|
|
Period of the replanning cycles [s] |
|
|
The search goes on from this far ahead [s] of the robot (at max PTG speed) |
|
|
New searches from the robot (new goals, restarts) start this far ahead [s], at its current speed, on the path it is following (<=0: from the robot pose) |
|
|
A goal fails if the robot does not get closer to it for this long [s], in a straight line or along the full path it follows; meanwhile, blocked paths and failed searches are replanned ( |
|
|
The status turns to |
|
|
Publish |
|
|
Obstacle points that blocked a path of a goal are kept in its searches for this long [s], also when out of sight ( |
|
|
If |
|
|
Path follower status (goal reached or failed), used only if the next one is empty |
|
|
Path follower status with the goal id and path revision it refers to: only statuses of the latest published path are acted on. Both default names are relative, so they resolve in the planner namespace, as the follower ones. If none arrives, a warning names the topic |
Subscribed topics
Topic |
Type |
Description |
|---|---|---|
|
|
Goal pose (preempts the current goal); planned from the current TF robot pose |
|
|
Path follower status |
|
|
Occupancy grid(s) used as static obstacles |
|
|
Point cloud(s) used as dynamic obstacles |
Published topics
Topic |
Type |
Description |
|---|---|---|
|
|
Full waypoint sequence with per-waypoint tolerances and flags |
|
|
Same path as |
|
|
Goal manager paths, with goal id, revision and whether they are partial (empty: navigation canceled) |
|
|
Goal manager path, split into its committed part and the rest (latched; shown in different colors in the tutorial RViz/Foxglove layouts) |
|
|
Planner readiness and state of the current goal, with measurements and a reason code (latched; see above) |
|
|
The status as markers for 3D views (latched; see above) |
|
|
Robot footprint used for planning (latched), so other nodes can check they use the same robot description |
|
|
Inflated costmaps (one per obstacle source, latched), published after each one-shot plan and whenever the goal manager rebuilds them (converted only once subscribed; late subscribers get the latest one) |
Actions
Action |
Type |
Description |
|---|---|---|
|
|
Navigate to a goal (as the goal topic), with feedback (state, distance to goal, remaining path length, ETA, time without progress) and a result with a |
Services
Service |
Type |
Description |
|---|---|---|
|
|
Plan from the current robot TF pose to a given goal |
|
|
Plan between two explicitly given |
Goal frames: goals on <topic_goal_sub> and make_plan_to targets
(PoseStamped) are transformed with TF into frame_id_map, at their stamp if
available, else with the latest transform. So goals can be given e.g. in the
robot frame, or clicked in an RViz/Foxglove view whose fixed frame is not the
map. A goal with an empty frame_id is taken as already in frame_id_map, and
one whose frame cannot be transformed is rejected (no plan). make_plan_from_to
poses carry no frame and are always in frame_id_map.
Both requests take an optional ignore_obstacles_in list of polygons (XY, map
frame): obstacle points inside them, from every source, are ignored for that
plan only (e.g. where obstacles are known to be traversable).
Both services are registered in a reentrant callback group so multiple
clients can be served simultaneously by the MultiThreadedExecutor.
Template ROS 2 launch file
ros2 launch mrpt_tps_astar_planner tps_astar_planner.launch.py \
ptg_ini:=/path/to/ptgs.ini \
planner_parameters:=/path/to/planner-params.yaml \
global_costmap_parameters:=/path/to/costmap-obstacles.yaml \
prefer_waypoints_parameters:=/path/to/costmap-prefer-waypoints.yaml \
topic_obstacles_gridmap_sub:=/map \
topic_static_maps:=/map
All parameters have defaults in the launch file; only the config-file paths are typically required to be overridden for a real deployment.
Running as a composable node
The planner is also available as the component
mrpt_tps_astar_planner::TPS_Astar_Planner_Node. With the same launch file:
ros2 run rclcpp_components component_container_mt --ros-args -r __node:=nav_container
ros2 launch mrpt_tps_astar_planner tps_astar_planner.launch.py \
use_composable:=true container_name:=/nav_container ptg_ini:=/path/to/ptgs.ini
Use a multi-threaded container (component_container_mt) so planning service
calls can run concurrently, as in the standalone node.