Skip to content

feat: Dockerized dev environment, Gazebo-MuJoCo co-simulation fixes, Nav2 stack repair, and rl_sar_zoo as submodule#1

Open
hugodidi wants to merge 19 commits intouleroboticsgroup:mainfrom
hugodidi:main
Open

feat: Dockerized dev environment, Gazebo-MuJoCo co-simulation fixes, Nav2 stack repair, and rl_sar_zoo as submodule#1
hugodidi wants to merge 19 commits intouleroboticsgroup:mainfrom
hugodidi:main

Conversation

@hugodidi
Copy link
Copy Markdown
Collaborator

Summary

This PR adds a complete containerized development setup, fixes simulation stability and visual fidelity,
and restructures rl_sar_zoo as a proper git submodule. All changes target the Unitree G1 29-DoF humanoid
navigating via Nav2 in a Gazebo + MuJoCo co-simulation.

Key changes

Docker environment (docker/)

  • Add Dockerfile + docker-compose.yml for ROS 2 Humble with MuJoCo, Gazebo Classic, and Nav2
  • Install Eclipse CycloneDDS for reliable inter-process communication
  • Container layout matches README instructions for reproducibility
  • Add Docker section to README with build/enter instructions

Gazebo ↔ MuJoCo segment-to-segment synchronization (gazebo_mujoco_pose_sync)

  • Refactor plugin to use gazebo_ros::Node (was raw Gazebo plugin), fixing multithreading segfaults that crashed gzserver
  • Implement segment-to-segment (link-by-link) pose synchronization of the G1 from MuJoCo to Gazebo
  • Gazebo no longer participates in physics simulation — the robot is kinematically driven by MuJoCo poses, so it passes through obstacles in Gazebo. This eliminates collision solver errors that caused gzserver crashes. A future system is planned to relay obstacle information from Gazebo/sensors back to MuJoCo for physics-aware collision handling
  • Fix collision configuration during pose transfer

Texture and visual fixes

  • Fix texture upload paths in turtlebot3_house model (model.sdf)
  • Inline sun and ground_plane models into turtlebot3_house.world (required because GAZEBO_MODEL_DATABASE_URI="" in spawn_g1.launch.py blocks online model downloads)

rl_sar modifications (src/rl_sar/)

  • Fix joint state publishing: publish /mujoco/joint_states as sensor_msgs/JointState
  • Fix joint mapping in fsm_g1.hpp: use hardware mapping (not policy mapping) during locomotion
  • Add missing #include in 8 unitree_sdk2/log/*.hpp headers
  • Scope .gitignore rules (was ignoring files outside rl_sar)
  • Fix build.sh script path references

G1 description & Gazebo launch (g1_description, g1_gazebo)

  • Set g1_29dof as default simulation model (remove g1_23dof.urdf)
  • Adjust Gazebo plugin z_offset to -0.82 for correct ground alignment
  • Restore LiDAR to original config: 1440 samples, 20 Hz, horizontal orientation

Nav2 stack (g1_nav2, humanoid_nav_bridge)

  • Repair nav_amcl.launch.py configuration for AMCL + costmaps
  • Add pre-built map files (g1_map.pgm, g1_map.yaml)
  • Add mujoco_to_gazebo_node.py bridge node

rl_sar_zoo as git submodule

  • Register src/rl_sar/src/rl_sar_zoo as submodule → fan-ziqi/rl_sar_zoo (was downloaded at build time by build.sh)
  • Remove rl_sar_zoo from src/rl_sar/.gitignore (now tracked as submodule)
  • Update README: add COLCON_IGNORE touch and package.xml symlink steps after clone

How to test

# Clone
git clone --recurse-submodules https://github.com/uleroboticsgroup/rl_hnav.git
cd rl_hnav
touch src/rl_sar/src/rl_sar_zoo/COLCON_IGNORE
for d in src/rl_sar/src/robot_msgs src/rl_sar/src/robot_joint_controller src/rl_sar/src/rl_sar; do
  ln -sf package.ros2.xml "$d/package.xml"
done

# Build (inside container)
xhost +local:docker
docker compose -f docker/docker-compose.yml up -d --build
docker exec -it rl_hnav_container bash
source /opt/ros/humble/setup.bash
cd ~/rl_hnav && colcon build --cmake-args -DUSE_MUJOCO=ON -DENABLE_REAL_ROBOT=ON
source install/setup.bash

# Launch Nav2
ros2 launch g1_nav2 nav_amcl.launch.py
# In another terminal: launch MuJoCo locomotion
ros2 run rl_sar rl_mujoco g1 scene_29dof --ros-args -p navigation_mode:=true

Architecture note:

Gazebo acts as a sensor server (LiDAR, camera) and visualizer only. MuJoCo owns all physics.
Obstacle information currently flows one-way (Gazebo sensors → Nav2 → MuJoCo via /cmd_vel).
Direct obstacle-to-MuJoCo relay for contact-aware locomotion is planned as future work.

2026-03-25.23-59-50.mp4

hugodidi added 19 commits March 6, 2026 00:14
The generic 'log' rule in both .gitignore files was preventing
unitree_sdk2/include/unitree/common/log/*.hpp from being tracked.
These headers are required by the SDK DDS layer and their absence
caused a fatal build error (unitree/common/log/log.hpp not found).

Missing headers were downloaded from the official unitree_sdk2
repository (v2.0.0) to restore the complete SDK and unblock the
build process.

Changes:
- .gitignore: log/ -> /log/ (root-only)
- src/rl_sar/.gitignore: log -> /log (root-only)
- Add 9 missing unitree_sdk2 log headers from upstream v2.0.0
- Update Dockerfile with remaining ROS2 build dependencies
…hreading segfaults, and add sensor_msgs dependency
…oint_mapping over policy mapping during locomotion
- Add .gitmodules for src/rl_sar/src/rl_sar_zoo (fan-ziqi/rl_sar_zoo)
- Remove rl_sar_zoo from src/rl_sar/.gitignore (now tracked as submodule)
- Update README: add COLCON_IGNORE touch and package.xml symlinks to clone steps
- Restore g1_29dof.urdf LiDAR to original (1440 samples, 20Hz, horizontal)
- Inline sun and ground_plane into turtlebot3_house.world (GAZEBO_MODEL_DATABASE_URI='' blocks downloads)
@hugodidi hugodidi self-assigned this Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant