This document contains detailed system architecture diagrams, layout specifications, configuration procedures, parameters reference, and troubleshooting steps.
- System Architecture
- Workspace Layout
- Algorithm Deep-Dive
- SSH Setup For Robot Bringup
- Workspace & Camera Calibration
- One-Time Background Capture
- Planning & Control Parameters Reference
- Safety Behavior
- Troubleshooting Guide
- What Not To Launch
The control loop runs entirely on the operator host workstation, issuing direct /cmd_vel instructions over the local network to namespaced TurtleBots.
graph TD
subgraph Sensing & Input
Cam[Overhead Camera] -->|Raw Frames| GUI[GUI / EKF Localization Node]
Odom[Robot Odometry] -->|Yaw Deltas| GUI
Operator[Operator Clicks] -->|Initial Pose & Goals| GUI
end
subgraph Controller Dispatch
GUI -->|Robot Poses & Goals| CBS[CBS / Prioritized Planner]
end
subgraph Safety & Execution
CBS -->|Planned Paths| Follower[Path Follower & ORCA Filter]
Follower -->|Velocity Commands| SafEnv[Safety Envelope Limits]
SafEnv -->|/tb_N/cmd_vel| TB[TurtleBot3 Swarm]
end
style SafEnv fill:#e74c3c,stroke:#c0392b,stroke-width:2px,color:#fff
| Package | Purpose |
|---|---|
src/cv_localization |
Camera detection, EKF sensor fusion, Click GUI, and calibration. |
src/multi_robot_swarm_planner |
Direct controller, CBS/prioritized offline schedule planners, path follower, and local ORCA velocity filter. |
src/multi_robot_navigation_ROS2 |
SSH remote execution utility for namespaced robot bringup on the lab swarm. |
src/turtlebot3 |
TurtleBot3 driver, standard descriptions, and SDK dependencies. |
The path planning and collision avoidance methods implemented in this workspace follow the concepts from these publications:
- Conflict-Based Search (CBS): Sharon et al., "Conflict-Based Search For Optimal Multi-Agent Path Finding"
👉 Read CBS Paper - Safe Interval Path Planning (SIPP): Phillips and Likhachev, "SIPP: Safe Interval Path Planning for Dynamic Environments"
👉 Read SIPP Paper - Optimal Reciprocal Collision Avoidance (ORCA): van den Berg et al., "Reciprocal n-body Collision Avoidance"
👉 Read ORCA Project Page - RVO2/ORCA Reference Implementation
👉 RVO2 Page
-
Offline Planner: Uses a Conflict-Based Search (CBS) approach computed over temporal
$A^*$ state spaces (as opposed to a full SIPP representation). - Local Velocity Filter: An ORCA-inspired local collision avoidance filter. It adjusts commanded velocities when robots approach each other or workspace boundaries.
- Priority Yielding: The local filter supports priority-aware yielding. Robots with higher priority break symmetric deadlocks. Priority is dynamic and updates based on how long a robot has been waiting or how far behind its schedule it is.
-
Crossing Gate: An optional crossing gate token is available under
mppi.crossing_*parameters for physical bottleneck environments, though it is disabled by default.
The workspace relies on remote execution of bringup scripts on the three TurtleBot3 Burgers. Passwordless SSH keys must be set up beforehand.
On the operator host PC:
ssh-keygen -t ed25519 -f ~/.ssh/turtlebot_lab_ed25519 -C turtlebot-labssh-copy-id -i ~/.ssh/turtlebot_lab_ed25519.pub turtlebot@192.168.1.20
ssh-copy-id -i ~/.ssh/turtlebot_lab_ed25519.pub ubuntu@192.168.1.15
ssh-copy-id -i ~/.ssh/turtlebot_lab_ed25519.pub ubuntu@192.168.1.16Ensure you can log in without password prompts:
ssh -i ~/.ssh/turtlebot_lab_ed25519 turtlebot@192.168.1.20 hostname
ssh -i ~/.ssh/turtlebot_lab_ed25519 ubuntu@192.168.1.15 hostname
ssh -i ~/.ssh/turtlebot_lab_ed25519 ubuntu@192.168.1.16 hostnameNote
The remote robots expect the local workspace setup file at ~/turtlebot3_ws/install/setup.bash and will source /opt/ros/humble/setup.bash on login.
Whenever the overhead camera is physically adjusted, zoomed, or has its resolution changed, you must calibrate the camera-to-world homography.
-
Width x Height:
$3.048\text{ m} \times 3.048\text{ m}$ (10 ft$\times$ 10 ft) -
Coordinate Origin
$(0,0)$ : Centered in the workspace -
Axes:
+xpoints right in the camera view;+ypoints up. -
Outer Boundaries:
$x, y \in [-1.524, +1.524]\text{ m}$ -
Safe Target Envelope: Outer boundary minus
wall_margin_m(default:$0.20\text{ m}$ , keeping robots inside$x, y \in [-1.324, +1.324]\text{ m}$ ).
- Edit
src/cv_localization/config/config.yamlto setcamera.device(a persistent/dev/v4l/by-id/...device path is highly recommended). - Execute the calibration tool:
cd ~/turtlebot_ws source /opt/ros/humble/setup.bash source install/setup.bash python3 src/cv_localization/cv_localization/calibrate_workspace.py \ --config src/cv_localization/config/config.yaml \ --output src/cv_localization/config/calibration.yaml \ --width-m 3.048 \ --height-m 3.048
- In the window, click the four workspace corners in this exact sequence:
- Top-Left
- Top-Right
- Bottom-Right
- Bottom-Left
- Press
Enterto approve the calibration. The GUI will render a rectified birds-eye view and write the homography matrix tosrc/cv_localization/config/calibration.yaml.
The localization pipeline uses static background subtraction to track the robot blobs. A clean background reference image must be captured when the workspace is empty under stable lighting.
Save the reference image as:
src/cv_localization/config/background.jpg
You can capture this image using the helper script below:
cd ~/turtlebot_ws
python3 - <<'PY'
from pathlib import Path
import time
import cv2
import yaml
config_path = Path("src/cv_localization/config/config.yaml")
output_path = Path("src/cv_localization/config/background.jpg")
cfg = yaml.safe_load(config_path.read_text())
cam = cfg.get("camera", {})
cap = cv2.VideoCapture(cam.get("device", 0))
if not cap.isOpened():
raise SystemExit(f"Could not open camera {cam.get('device', 0)}")
fourcc = cam.get("fourcc")
if fourcc:
cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*fourcc))
cap.set(cv2.CAP_PROP_FRAME_WIDTH, cam.get("width", 1280))
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, cam.get("height", 960))
cap.set(cv2.CAP_PROP_FPS, cam.get("fps", 30))
for _ in range(30):
cap.read()
time.sleep(0.03)
ok, frame = cap.read()
cap.release()
if not ok:
raise SystemExit("Camera read failed")
output_path.parent.mkdir(parents=True, exist_ok=True)
cv2.imwrite(str(output_path), frame)
print(f"Saved {output_path}")
PYImportant
If background.jpg is not present, the launches will fail immediately.
Configuration settings are stored in:
src/cv_localization/config/config.yaml
| Parameter | Default Value | Description |
|---|---|---|
mppi.control_mode |
scheduled |
Default controller mode (scheduled or legacy mppi). |
mppi.planner_algorithm |
cbs |
Choice of planner (cbs or prioritized). |
mppi.goal_radius_m |
0.12 |
Distance threshold where a robot is considered to have reached its goal. |
mppi.max_v_mps |
0.2 |
Maximum forward linear velocity (m/s). |
mppi.allow_reverse |
true |
Allows planning and tracking reverse motions. |
mppi.max_reverse_v_mps |
0.15 |
Maximum reverse linear velocity (m/s). |
mppi.max_w_radps |
1.0 |
Maximum angular velocity (rad/s). |
mppi.wall_margin_m |
0.20 |
Minimum allowed distance from boundaries (m). |
mppi.min_live_spacing_m |
0.35 |
Spacing threshold under which all motion is halted. |
mppi.safety_distance_m |
0.25 |
Spacing limit before trigger safety overrides. |
mppi.max_dv_step |
0.05 |
Linear acceleration slew limit (change per control tick). |
mppi.max_dw_step |
0.5 |
Angular acceleration slew limit (change per control tick). |
mppi.planning_clearance_m |
0.35 |
Obstacle clearance distance used during A* path planning. |
mppi.offline_grid_resolution_m |
0.05 |
Spatial resolution of the offline grid search. |
mppi.offline_time_step_s |
0.5 |
Time discretization step size for the temporal plan. |
mppi.cbs_max_nodes |
1000 |
Search node expansion limit for CBS. |
mppi.path_heading_gain |
1.5 |
Proportional gain for path tracking yaw error. |
mppi.reverse_heading_threshold_rad |
2.2 |
Angle error threshold above which reverse velocity is triggered. |
mppi.orca_filter_enabled |
true |
Enables/Disables runtime ORCA-style avoidance. |
mppi.orca_time_horizon_s |
3.0 |
Lookahead time window for dynamic avoidance. |
mppi.orca_priority_enabled |
true |
Enables priority-based yielding inside ORCA. |
mppi.orca_priority_wait_gain |
0.1 |
Scale factor to increase priority based on waiting duration. |
mppi.orca_priority_schedule_lag_gain |
0.2 |
Scale factor to increase priority based on path deviation/delay. |
mppi.boundary_slowdown_margin_m |
0.15 |
Distance from wall where linear velocity scaling begins. |
Both Scheduled and legacy MPPI controllers pipe commands through a defensive hardware safety layer. A stop command (zero velocity) is dispatched instantly to all robots if any of these events occur:
-
Manual Stops: Keypress
Space,Esc,qin the GUI, or/fleet_mppi/stopservice call. -
Localization Stale: No camera coordinate updates received for more than
$0.5$ seconds. - Boundary Violation: Robot centers enter the hard workspace boundary envelope.
- Stale Odometry: Odometry feedback from any robot stops.
-
Proximity Violation: Distance between any two robots drops below
min_live_spacing_m. - Goal Completion: All robots arrive within the goal threshold.
- Resolution: Capture a reference background frame using the Python script in Section 4 and save it to
src/cv_localization/config/background.jpg.
- Resolution: The core controller node (
mppi_direct_controller) failed to launch or crashed. Check the console output for Python tracebacks, library conflicts, or missing dependencies.
- Resolution:
- Ensure lighting is consistent. If room lighting changes, recapture
background.jpg. - Adjust detection filters in
src/cv_localization/config/config.yaml:- Increase/decrease
detection.background_diff_thresholdto isolate robots. - Tune
detection.min_blob_areaanddetection.max_blob_area.
- Increase/decrease
- If tracking labels swap during crossings, increase
tracking.position_history_sizeor tune the Kalman tracking parameters.
- Ensure lighting is consistent. If room lighting changes, recapture
- Resolution:
- Ensure
mppi.max_w_radpsis set sufficiently high (e.g.,1.0or1.5). - Increase
mppi.path_heading_gain. - Validate that the initial clicked heading in the GUI matched the physical robot orientation closely.
- Ensure
- Resolution:
- Verify
mppi.orca_priority_enabledis set totrue. - Adjust
mppi.orca_priority_wait_gainso waiting robots gain precedence quickly. - Adjust
mppi.orca_priority_strengthfor more aggressive yielding.
- Verify
- Resolution:
- Verify network connectivity:
ping -c 3 192.168.1.20. - Verify passwordless login:
ssh -i ~/.ssh/turtlebot_lab_ed25519 ubuntu@192.168.1.15 hostname. - Ensure
ROS_DOMAIN_ID=30is set consistently on both the PC and the robots.
- Verify network connectivity:
To avoid topic conflicts, lifecycle errors, and hardware damage, do not launch any of the following nodes or scripts:
multi_nav2_launch.py(legacy Nav2 configuration)lab_three_robot_nav.launch.py(legacy localization/navigation)amcl,map_server,slam_toolbox, ornav2_lifecycle_manager