How my-rice/autonomous-navigation-turtlebot4 works
Project type and purpose
• This is a ROS2-based robotics application (“Mobile Robots for Critical Missions”) comprising several ROS2 packages:
• config_pkg – holds all maps, parameters, and configuration files
• diem_gazebo – launches the Gazebo/Ignition simulator with the TurtleBot4 model and the diem_map world
• discovery_interface – defines the custom ROS Action (DiscoveryAction) used by the discovery node
• discovery_pkg – implements the QR‐code reading node (uses QReader, pyzbar, PyTorch, etc.)
• finetuning_pkg – a helper node that publishes test circles/waypoints for tuning
• planner_pkg – brings up the navigation (Nav2) stack, localization, RViz, and implements the high‐level planner
High‐level architecture and components
a. Simulation Environment
• Gazebo/Ignition (ignition.launch.py, spawn launch files) with the TurtleBot4 model
• World description (diem_map.sdf, meshes, model.config)
b. ROS2 Middleware Layer
• ROS2 master (DDS) – the communication bus
• Topics:
• /scan, /camera/image – sensor data from simulation or real robot
• /tf – transforms
• /cmd_vel – velocity commands to the robot
• Actions: DiscoveryAction (defined in discovery_interface)
c. Core ROS2 Nodes
• Server & AMCL (launched via startup_launch.py in planner_pkg)
• Nav2 Planner & Controller (from planner_pkg)
• RViz2 (visualization)
• discovery_pkg node – subscribes to camera, processes frames with QReader, sends goal or result via DiscoveryAction
• finetuning_pkg node – publishes circle waypoints for testing
• planner_pkg’s planner node – consumes goals (from discovery or finetuning), sends Nav2 goals
d. Configuration & Resources
• config_pkg – YAML parameter files (nav2_params.yaml), diem_map files (.pgm + .yaml), packaged via setup.py
• planner_pkg includes rviz config
• discovery_pkg & finetuning_pkg each have their own config.yaml
Relationships & Data Flow
• Simulation → sensor topics (/scan, /camera/image) → nodes
• discovery_pkg → after detection → calls DiscoveryAction server → planner_pkg’s planner node
• finetuning_pkg → publishes test waypoints on a dedicated topic → planner_pkg
• planner_pkg → via Nav2 action interface → Nav2 Server → robot motion → Gazebo cmd_vel
• config_pkg & package.xml → loaded at node start‐up to configure Nav2, map server, and RViz
Architectural patterns / design principles
• Component‐based modularity: each ROS package is a self‐contained component
• Publish/Subscribe and Action patterns (ROS2 DDS) for loose coupling
• Separation of concerns: simulation (diem_gazebo), configuration (config_pkg), interface definition (discovery_interface), functionality (discovery_pkg, finetuning_pkg, planner_pkg)
Final checklist for the engineer
[ ] Show simulation ↔ ROS middleware ↔ application node interactions
[ ] Highlight config_pkg as the central source of parameters/maps
[ ] Show discovery_interface defining the Action contract
[ ] Illustrate Nav2 stack within planner_pkg
[ ] Annotate external libraries and tools beneath the respective components