How lihanchen2004/pb_rm_simulation works
Project type and purpose
• This is a ROS2-based robotics simulation and navigation stack. It uses Gazebo Classic to simulate an omnidirectional robot equipped with a Livox Mid360 LiDAR and an IMU. It supports both simulation and Sim2Real operation, offering multiple localization (FAST_LIO, Point_LIO, slam_toolbox, AMCL, ICP) and navigation (Nav2 + TEB) options.
File-structure overview
• Top level: devcontainer, docs, build scripts, Dockerfile, README.
• src/: a ROS2 workspace containing packages in five domains:
• rm_driver: Livox ROS driver
• rm_localization: LIO (FAST_LIO, Point_LIO) and ICP registration
• rm_nav_bringup: bring-up launch files, maps, configs, URDFs for both sim & real
• rm_navigation: core Nav2 stack extensions (costmap_converter, fake_vel_transform, teb_local_planner)
• rm_perception: helper nodes (IMU complementary filter, ground segmentation, pointcloud↔laserscan)
• rm_simulation: Gazebo plugins for LiDAR, world and robot meshes, URDFs, simulation launch
Key architecture insights from README
• Four main pipelines: Sensor simulation (Gazebo plugins) → Perception & LIO → Localization → Nav2 planning & control → Robot actuation
• Topic interfaces (/livox/lidar, /livox/imu, /cmd_vel, /odom, etc.)
• Configurable parameters for sim vs. real (“world”, “mode”, “lio”, “localization”, viz flags)
A. Simulation/Hardware layer (leftmost, boxed in blue)
1. Gazebo Classic
• World model (RMUC/RMUL .world)
• pb_rm_simulation meshes & obstacles plugin
2. Robot model (URDF/XACRO)
• livox_laser_simulation plugin → publishes /livox/lidar (CustomMsg)
• Gazebo IMU plugin → publishes /livox/imu (sensor_msgs/Imu)
• Gazebo drive plugin subscribes to /cmd_vel
B. ROS2 middleware (central, gray background)
1. rm_driver/livox_ros_driver2 (only for real-world)
2. Topics:
• /livox/lidar/pointcloud (PointCloud2)
• /livox/imu
• /odom
• /cmd_vel
C. Perception & Odometry layer (green)
1. rm_perception
• imu_complementary_filter → refines IMU data
• linefit_ground_segmentation → ground removal
• pointcloud_to_laserscan → publishes fake /scan for Nav2
2. rm_localization
• FAST_LIO / Point_LIO → subscribes to /livox/lidar, /livox/imu → publishes /odom
• icp_registration (optional initial pose)
(Use branching to show choice FAST_LIO vs. Point_LIO vs. ICP)
D. Localization layer (orange)
• slam_toolbox / AMCL / ICP_localization
• Inputs: /odom, map server topics (/map, /initialpose)
• Outputs: /tf, refined pose for Nav2
E. Navigation & Planning layer (red)
1. rm_navigation
• costmap_converter → 3D→2D costmap
• fake_vel_transform → corrects LiDAR/twist frames
• teb_local_planner → local trajectory optimization
2. Nav2 core nodes (map_server, planner_server, controller_server, bt_navigator)
• Configs in rm_nav_bringup/config
3. rviz (visualization)
F. Actuation layer (purple)
• /cmd_vel → robot base controller (sim plugin or real driver)
Architectural patterns & design principles
• ROS2 node-based modularity: each function lives in its own package.
• Launch‐time composition: use ROS2 launch to swap LIO/localization modules and sim vs. real.
• Layered pipeline: sensing → perception → motion estimation → localization → planning → control.
• Plugin‐based Gazebo integration: robot sensors and world elements.