X2 Open-Source Navigation (Nav2)

An open-source navigation stack built on Nav2: global planning (SmacPlanner2D) + local obstacle avoidance (RPP controller) + recovery behavior tree, publishing /cmd_vel to the motion control through a bridge node. The source ships with the SDK under extra/pnc/ (a git submodule); localization is not included — it reuses an external map -> base_link TF (closed-source LIO or the open-source SLAM).

Note

Use this chapter when you need to inspect or modify the planning algorithms, tune navigation parameters, or do navigation-level development: replace the built-in navigation with open-source Nav2.

If you are using the robot’s built-in closed-source navigation interface (the /aima/te/pnc_task_request task request and /task_master/state status topic), see Navigation (optional). The two are independent stacks; use only one at a time.

Differences from the built-in navigation

The robot has two independent navigation stacks: the open-source Nav2 navigation in this chapter and the built-in closed-source navigation module. They are mutually exclusive through the MC input source (see “Motion-control input source takeover”). Key differences:

Aspect

This chapter (open-source Nav2 navigation)

Navigation (optional) (built-in module)

Delivery form

extra/pnc/ source submodule, compiled by the user

Built into the robot firmware, no source delivered

Planning algorithms

Nav2 (SmacPlanner2D global + RPP local + recovery behavior tree)

Closed-source PnC implementation

Localization source

Not included; reuses an external map -> base_link TF

Built-in LIO localization

Map source

Closed-source on-disk map or standard pgm/yaml (can consume open-source SLAM output)

Built-in map management

Command path

/cmd_vel → bridge → /aima/mc/locomotion/velocity

Built-in task pipeline

Intended users

Users who need to inspect/modify planning algorithms, tune parameters, or do secondary development

Users who only need navigation functionality

Component overview

extra/pnc/ is a single-package layout (src/open_pnc_bringup); one launch file starts all components:

Component

Role

Enabled when

static_map_bridge

Global static map source (disk: reads and merges the closed-source on-disk map / pcd: reads a standard pgm/yaml) → /open_pnc/static_map

use_static_map_bridge (default on)

cmd_vel_bridge

/cmd_vel → /aima/mc/locomotion/velocity (deadzone/speed limit/jerk smoothing/watchdog; can take over the MC input source)

use_cmd_vel_bridge (default on; set false to watch plans in RViz without moving the robot)

grid_map_bridge

Closed-source 2.5D obstacles /perception/grid_map → /open_pnc/grid_obstacles

Automatic by map_source: disk→on / pcd→off

Nav2 loop

controller_server (RPP) + planner_server (SmacPlanner2D) + behavior_server + bt_navigator (custom recovery behavior tree) + lifecycle_manager

Always started (delayed by nav2_start_delay seconds so the static map latches first)

rtabmap_map_bridge

Subscribes the real-time /map of the open-source SLAM stack’s RTAB-Map as the Nav2 global static map (ray clearing included; grows in real time while mapping)

Reserved: implemented but not embedded in the launch; start it manually (see “Integration with the open-source SLAM”)

map_server/amcl are not started (localization reuses the external TF); velocity_smoother is not started (jerk smoothing is done inside cmd_vel_bridge).

Prerequisites

Confirm each software and runtime requirement below before you start — any unmet item will make the launch fail or behave abnormally:

Item

Requirement

OS

Ubuntu 22.04 + ROS 2 Humble

Nav2

ros-humble-navigation2 (not included in the desktop variant; install it separately, see below)

Localization

An external map -> base_link TF stays valid (closed-source LIO or the open-source SLAM localization mode)

Closed-source PnC

Must be stopped before real-robot motion (the two planners would fight over /cmd_vel and the MC input source)

aimdk environment

Baked in by the launch automatically (aimdk_msgs paths + DDS profile); no manual sourcing needed

Building

Once the dependencies are in place, build the workspace — it produces a single bringup package:

cd extra/pnc
colcon build --packages-select open_pnc_bringup
source install/setup.bash

Quick start

Prerequisite: have the robot localized onto the map and stay in localization mode — the check is that ros2 run tf2_ros tf2_echo map base_link prints the transform continuously.

cd extra/pnc && source install/setup.bash

# 2A) Closed-source localization + closed-source on-disk map (default disk mode)
ros2 launch open_pnc_bringup open_pnc.launch.py \
    map_path:=/agibot/data/var/MapManagerModule/<map_id>

# 2B) Self-hosted localization + mapping-produced pgm/yaml (pcd mode; the map can come from the open-source SLAM output)
ros2 launch open_pnc_bringup open_pnc.launch.py map_source:=pcd \
    map_path:=<map2d-dir>/<name>.yaml

# 2C) Software-only validation without touching the robot (watch plans in RViz)
ros2 launch open_pnc_bringup open_pnc.launch.py use_cmd_vel_bridge:=false

Map source

open_pnc needs a map_server-format 2D grid (.pgm + .yaml) as the global static map; the two values of map_source correspond to two sources:

disk — read the closed-source map package (default)

map_path points to the closed-source map directory /agibot/data/var/MapManagerModule/<map_id>/. static_map_bridge reads occupancy_map.png/yaml from the disk, merges the closed-source 2.5D obstacles (grid_map_bridge enabled automatically), and publishes /open_pnc/static_map. This is mandatory when using closed-source localization, and map_path must match the map_id currently used by the closed-source localization — otherwise the costmap and the localization TF end up in mismatched frames.

pcd — read a standard pgm/yaml

map_path points to a standard map_server-format .yaml (bottom-left origin convention). This is exactly what the open-source SLAM mapping flow produces (pgm/yaml under map2d/), so it plugs in without any conversion tool.

Integration with the open-source SLAM

rtabmap_map_bridge subscribes to RTAB-Map’s real-time /map (grows while mapping, with built-in ray clearing) as the Nav2 global static map, for navigate-while-mapping scenarios. The node is implemented but not embedded in the launch (reserved); start it manually outside the launch, and turn off the default static_map_bridge at the same time (both publish the same topic; only one may run):

# Terminal 1: start open_pnc in pcd mode (the static map now comes from rtabmap_map_bridge)
ros2 launch open_pnc_bringup open_pnc.launch.py map_source:=pcd \
    use_static_map_bridge:=false map_path:=<placeholder>

# Terminal 2: start rtabmap_map_bridge manually (source the open-source SLAM workspace and its install space first)
ros2 run open_pnc_bringup rtabmap_map_bridge

Attention

rtabmap_map_bridge is a reserved feature; for parameter behavior refer to the comments in the source code. Validate it in simulation before on-robot use.

cmd_vel_bridge safety mechanisms

cmd_vel_bridge converts Nav2’s /cmd_vel output into motion-control velocity commands, with built-in multi-layer safety mechanisms (all parameters overridable in the launch):

Mechanism

Default

Behavior

Watchdog

0.3 s

Zeroes the target when no new /cmd_vel arrives within the timeout (controlled emergency stop)

Deadzone

0.005

Velocity components below the deadzone are zeroed

Minimum speed

forward/lateral 0.2, angular 0.1

Speeds between the deadzone and the minimum are raised to the minimum (otherwise the robot stalls inside the deadzone)

Jerk limiting

[2.5, 2.5, 10.0]

Ruckig applies velocity-level jerk limiting on the three DOF (forward/lateral/angular) (control period 0.02 s)

Motion-control input source takeover

The core mechanism of navigation taking over motion control, with its accompanying risks, is as follows — confirm each item before real-robot motion:

Warning

At startup cmd_vel_bridge takes over the MC input source via SetMcInputSource (priority 70); during real-robot motion the navigation commands own motion control:

  • Stop the closed-source PnC before taking over, otherwise the two planners fight over /cmd_vel and the MC input source with unpredictable behavior;

  • The open-source SLAM cold-start flow (waist sweep etc.) and navigation contend for the input source in a strict order: finish the localization cold start first, then start navigation;

  • During validation, keep the robot suspended off the ground, or first watch the plans only with use_cmd_vel_bridge:=false;

  • When handing control back after navigation ends, mind the leftover-input-source issue (same as the open-source SLAM waist sweep).

Common launch parameters

The table lists common parameters; for Nav2 parameter details see the comments inside config/*.yaml, and for the recovery behavior-tree layout see behavior_trees/open_pnc_recovery.xml:

Parameter

Default

Description

map_source

disk

disk = read the closed-source on-disk map / pcd = read a standard pgm/yaml

map_path

Closed-source map (built-in example id)

disk = map directory / pcd = a .yaml file or its directory

use_cmd_vel_bridge

true

Set false to watch plans in RViz without moving the robot

register_input_source

true

Whether to take over the MC input source (only needed for real-robot motion; stop the closed-source PnC first)

use_static_map_bridge

true

Static map bridge switch (mutually exclusive with rtabmap_map_bridge)

use_grid_map_bridge

empty (automatic)

empty = automatic by map_source (disk→on / pcd→off); an explicit value overrides

params_file

empty (automatic)

empty = selected by map_source (disk→nav2_x2.yaml / pcd→nav2_x2_pcd.yaml)

nav2_start_delay

8.0

Seconds to delay the Nav2 start (lets the static map latch first, preventing the costmap from staying at the default 5×5)

Troubleshooting

Locate common problems by symptom; each entry gives what to check and how to handle it:

  • The launch reports package 'nav2_controller' not found and exits: Nav2 is missing or only libraries were installed — install ros-humble-navigation2 per “Installing Nav2” and verify all 7 nodes with the loop command.

  • The robot does not move and nothing reports an error: check whether /cmd_vel has output (ros2 topic echo /cmd_vel) — no output means a Nav2-side problem (unreachable goal / abnormal costmap); output present but no motion means a motion-control-side problem (input source takeover failed, or a higher priority holds it).

  • The costmap is only the default 5×5 patch: the static map did not latch in time — check that nav2_start_delay is large enough (raise it for slow disks or large maps), and that the static map topic has data.

  • The localization TF does not line up with the map (the robot “floats” outside the map in RViz): in disk mode map_path does not match the map_id currently used by the closed-source localization — the two must come from the same source.

  • Abnormal behavior when the closed-source PnC is running too: the two planners fight over /cmd_vel and the MC input source — per “Motion-control input source takeover”, stop the closed-source PnC before starting this stack.

Upstream and license

This stack builds on the open-source Nav2 stack (Apache-2.0, installed via apt, not distributed inside the submodule); the code in the submodule is AgiBot’s in-house bridge and configuration layer. Nav2 upstream: https://github.com/ros-navigation/navigation2.