How mostafasaad1/ros2_mir_nav2_pick_place works
Purpose and Top-Level Entry Points
ROS 2 Jazzy workspace for MiR 100 simulation, autonomous navigation, SLAM, and pick/place mission execution in Gazebo Harmonic. The primary end-to-end entry point is src/pick_place_orchestrator/launch/pick_place_sim.launch.py; it composes simulation, robot control, Nav2, and mission nodes. Focused alternatives are navigation simulation (src/mir_navigation/launch/navigation_sim.launch.py) and mapping (src/mir_navigation/launch/slam.launch.py).
Robot Model and Simulation Boundary
mir_description defines the robot’s Xacro/URDF model, physical geometry, and sensors: src/mir_description/urdf/mir.urdf.xacro, src/mir_description/urdf/sensors/sick_lidar.xacro, and src/mir_description/urdf/sensors/realsense_d435.xacro. Gazebo-specific startup is in src/mir_gazebo/launch/spawn_maze.launch.py, using the maze world at src/mir_gazebo/worlds/maze.world. This boundary connects simulated robot state/sensors to ROS through Gazebo/ROS bridging.
Motion Control
mir_control provides the ROS 2 control integration and controller startup. src/mir_control/launch/mir_control.launch.py launches the joint-state broadcaster and differential-drive controller; src/mir_control/mir_control/mir_controller.py is the package’s Python control implementation. Nav2 ultimately commands robot velocity through this control layer, while robot/simulator state returns as joint state, odometry, transforms, and sensor streams.
Localization, Mapping, and Navigation
mir_navigation owns Nav2, localization, mapping, and operator visualization composition. src/mir_navigation/launch/navigation.launch.py starts the core static-map Nav2 stack; src/mir_navigation/config/nav2_params.yaml provides planner, controller, recovery, and costmap configuration; src/mir_navigation/config/ekf.yaml configures state estimation. Static navigation uses src/mir_navigation/maps/my_maze_map.yaml; SLAM uses src/mir_navigation/config/mapper_params_async.yaml.
Navigation Decision and Operator Interfaces
Nav2 behavior is customized through src/mir_navigation/behavior_trees/navigate_w_replanning_and_recovery.xml, defining replanning and recovery behavior for goals. src/mir_navigation/src/nav_goal_client.cpp is a direct navigation goal client. RViz configurations, including the pick/place workflow interface, reside at src/mir_navigation/rviz/navigation_pick_place.rviz; the corresponding RViz panel implementation is src/mir_navigation/src/pick_place_panel.cpp.
Mission Contract and Orchestration
pick_place_interfaces is the package boundary for mission APIs: src/pick_place_interfaces/action/PickPlaceMission.action, src/pick_place_interfaces/srv/ExecuteMission.srv, and src/pick_place_interfaces/srv/SpawnObject.srv. The Python orchestrator consumes these contracts and coordinates task sequencing in src/pick_place_orchestrator/pick_place_orchestrator/orchestrator_node.py. It delegates Gazebo entity lifecycle/manipulation to src/pick_place_orchestrator/pick_place_orchestrator/object_manager_node.py.
End-to-End Control Flow and Runtime Dependencies
An RViz user selects/dispatches pick and place poses; the panel/API invokes the orchestrator. The orchestrator sequences Nav2 goals, waits for navigation outcomes, and requests object spawn/manipulation through the object manager. Nav2 plans against static-map AMCL or SLAM output, emits velocity commands through ros2_control, and receives simulated LiDAR, camera, IMU, TF, and odometry from Gazebo. Material runtime dependencies are ROS 2 Jazzy, Gazebo Harmonic, ros2_control/controllers, Nav2, SLAM Toolbox, RViz2, robot-state-publisher, Xacro, and ROS–Gazebo bridge packages.
Main entry points: spawn_maze.launch.py Gazebo maze spawn · nav2_params.yaml Nav2 stack · pick_place_sim.launch.py Pick/place simulation launch · orchestrator_node.py Mission orchestrator
Components 20
Simulation
- MiR Xacro/URDF model
src/mir_description/urdf/mir.urdf.xacro - SICK lidar model
src/mir_description/urdf/sensors/sick_lidar.xacro - RealSense camera model
src/mir_description/urdf/sensors/realsense_d435.xacro - Gazebo maze spawn · Spawns the simulated robot and bridge boundary.
src/mir_gazebo/launch/spawn_maze.launch.py - Maze world
src/mir_gazebo/worlds/maze.world - ros2_control startup · Starts joint-state and differential-drive controllers.
src/mir_control/launch/mir_control.launch.py - MiR controller
src/mir_control/mir_control/mir_controller.py
Navigation
- Navigation simulation launch
src/mir_navigation/launch/navigation_sim.launch.py - SLAM launch
src/mir_navigation/launch/slam.launch.py - Static-map Nav2 launch
src/mir_navigation/launch/navigation.launch.py - Nav2 stack · Plans, controls, recovers, and publishes velocity commands.
src/mir_navigation/config/nav2_params.yaml - AMCL / SLAM Toolbox · Provides pose and map data to Nav2.
src/mir_navigation/config/mapper_params_async.yaml - Maze static map
src/mir_navigation/maps/my_maze_map.yaml - Replanning behavior tree
src/mir_navigation/behavior_trees/navigate_w_replanning_and_recovery.xml - Navigation goal client
src/mir_navigation/src/nav_goal_client.cpp
Pick/Place Mission
- Pick/place simulation launch · Primary end-to-end entry point.
src/pick_place_orchestrator/launch/pick_place_sim.launch.py - Mission APIs · Pick/place, execution, and object-spawn contracts.
src/pick_place_interfaces/action/PickPlaceMission.action - Mission orchestrator · Sequences navigation and object tasks.
src/pick_place_orchestrator/pick_place_orchestrator/orchestrator_node.py - Object manager · Delegates Gazebo entity lifecycle and manipulation.
src/pick_place_orchestrator/pick_place_orchestrator/object_manager_node.py - RViz pick/place panel · Operator dispatch interface.
src/mir_navigation/src/pick_place_panel.cpp
Connections 24
- Pick/place simulation launch → Gazebo maze spawn: composes
- Pick/place simulation launch → ros2_control startup: composes
- Pick/place simulation launch → Static-map Nav2 launch: composes
- Pick/place simulation launch → Mission orchestrator: starts
- Navigation simulation launch → Gazebo maze spawn: starts simulation
- SLAM launch → AMCL / SLAM Toolbox: starts
- MiR Xacro/URDF model → SICK lidar model: includes
- MiR Xacro/URDF model → RealSense camera model: includes
- Gazebo maze spawn → MiR Xacro/URDF model: spawns
- Maze world → Gazebo maze spawn: loaded by
- Gazebo maze spawn → ros2_control startup: state and sensor streams
- ros2_control startup → MiR controller: runs
- Static-map Nav2 launch → Nav2 stack: starts
- Static-map Nav2 launch → AMCL / SLAM Toolbox: starts AMCL
- Maze static map → AMCL / SLAM Toolbox: localization map
- AMCL / SLAM Toolbox → Nav2 stack: pose and map
- Replanning behavior tree → Nav2 stack: goal behavior
- Nav2 stack → ros2_control startup: velocity commands
- RViz pick/place panel → Mission APIs: dispatches mission
- Mission APIs → Mission orchestrator: consumed by
- Mission orchestrator → Nav2 stack: sends navigation goals
- Mission orchestrator → Object manager: spawn and manipulate
- Object manager → Gazebo maze spawn: Gazebo entity operations
- Navigation goal client → Nav2 stack: sends goals