This project integrates Unitree robots with MuJoCo 2.1.0 physics simulator in a Docker environment.
- Docker
- Docker Compose
- X11 for visualization
- Git
- At least 4GB of free disk space
- Clone the repository:
git clone https://github.com/AGiXT/robot_simulator
cd robot_simulator
- Build the Docker container:
docker-compose build
- Run the simulation:
xhost +local:docker # Allow X11 connections from Docker
docker-compose up
If you encounter library-related issues:
- Run the diagnostic script:
# Start container in debug mode
docker-compose run --rm unitree-mujoco /bin/bash
# Inside container, run diagnostics
/patches/check_libs.sh
-
Common issues and solutions:
a. Missing libraries:
# Check library paths ldconfig -p | grep mujoco ls -l /usr/local/lib/libmujoco*
b. Header file issues:
# Verify header installation ls -l /usr/local/include/mj*.h ls -l /usr/local/include/mujoco/
c. Library load errors:
# Check library dependencies ldd /usr/local/lib/libmujoco210.so
- For NVIDIA GPU support, uncomment the relevant section in docker-compose.yml:
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [graphics,compute,utility]
- For Mesa/software rendering issues:
# Inside container
export LIBGL_ALWAYS_SOFTWARE=1
- Debug build:
docker-compose build --progress=plain
# For verbose output
docker-compose build --progress=plain --no-cache
- Modifying source files:
- Source files are in
patches/unitree_mujoco/
- Build system files in
patches/
- Changes require container rebuild
- Source files are in
.
├── docker-compose.yml # Container configuration
├── Dockerfile # Build instructions
├── patches/ # Source and build files
│ ├── apply_patches.sh
│ ├── check_libs.sh
│ └── unitree_mujoco/
│ ├── CMakeLists.txt
│ ├── main.cc
│ ├── platform_ui_adapter.cc
│ ├── simulate.cc
│ └── simulate.h
└── README.md
- MuJoCo 2.1.0 specific changes:
- Uses direct header includes (no mujoco/ prefix)
- Links against libmujoco210.so
- Modified include order for proper compilation