Computer MuJoCo Simulation
- Computer MuJoCo Simulation
Overview
This case describes how to run the Roban 2.2 MuJoCo simulation on an x86_64 computer using LejuLab-Deploy and Docker. Once started, the following components run at the same time:
| Component | Purpose |
|---|---|
leju-mujoco-sim | Loads the Roban model and runs the physics simulation |
run_rl_controller | Runs the robot controller |
leju-joystick | Receives joystick or keyboard-simulated input |
| CycloneDDS + iceoryx RouDi | Handles communication among the simulator, controller, and input nodes |
This document uses ROBOT_VERSION=17, which corresponds to Roban 2.2. The Docker script mounts the repository on the host into the container at /root/lejulab_ws, so use that path consistently after entering the container.
Preparation
- Ubuntu is recommended as the operating system, with Docker already installed.
- The MuJoCo graphical interface must be displayed, so the host should provide a working X11 desktop environment.
- To use GPU mode, the NVIDIA driver and NVIDIA Container Toolkit must also be installed correctly.
- Choose either normal mode or GPU mode; if no NVIDIA environment is available, use normal mode.
Procedure
1. Download the simulation repository
Run the following in a terminal on the host:
git clone https://gitcode.com/OpenLET/LejuLab-Deploy.git
cd LejuLab-Deploy
2. Create and enter a Docker container
From the repository root, start the container in one of the two modes:
# 普通模式
./docker/run.sh
# GPU 模式(二选一)
./docker/run_with_gpu.shOn the first run, the script checks for a local image; if the image does not exist, follow the terminal prompts to download and import it. The script mounts the current repository into the container at /root/lejulab_ws and starts zsh.
To open a second container terminal later, simply run the same script again from the repository root on the host. Do not alternate the same container between normal mode and GPU mode.
3. Configure the Git safe directory inside the container
When the repository is created by the host user but accessed as root inside the container, Git may report:
fatal: detected dubious ownership in repository at '/root/lejulab_ws'Run the following once inside the container:
cd /root/lejulab_ws
git config --global --add safe.directory /root/lejulab_wsThis setting only resolves Git's ownership safety check on the mounted directory and does not affect the build result. Do not recursively change the owner of the mounted directory inside the container just to eliminate the message; doing so may change file permissions on the host.
4. Load the dependency environment
Docker uses zsh by default. Inside the container, set the robot version and load the prebuilt dependencies bundled with the repository:
cd /root/lejulab_ws
export ROBOT_VERSION=17
source installed/setup.zshIf you are using bash, use this instead:
source installed/setup.bashsource installed/setup.* must be executed before catkin build. It adds dependencies such as ROS, LejuSDK, and CycloneDDS to CMAKE_PREFIX_PATH and LD_LIBRARY_PATH.
You can confirm that the CycloneDDS shared libraries have been found with the following command:
ldd src/lejusdk/lejusdk-lowlevel/lib/liblejusdk-lowlevel.so \
| grep -E 'ddsc|not found'Normally, libddscxx.so.0 and libddsc.so.0 should resolve to /root/lejulab_ws/installed/lib/, and the output should not contain not found.
5. Deploy the CycloneDDS shared-memory environment
Inside the container, run the Docker-specific deployment script:
cd /root/lejulab_ws
./src/leju_launch/scripts/setup_cyclonedds_config_for_docker.shThe script performs the following steps:
- Installs RouDi from
installed/bin/iox-roudi; - Deploys
roudi_config.tomland the CycloneDDS configuration; - Starts
iox-roudi; - Configures
CYCLONEDDS_URI.

6. Build the project
After confirming that the installed environment is loaded, run:
cd /root/lejulab_ws
export ROBOT_VERSION=17
source installed/setup.zsh
catkin build
When the build finishes, all required packages should have been built successfully. To regenerate the CMake configuration, run:
catkin build --force-cmake7. Launch the MuJoCo simulation
Open a new container terminal, then run:
cd /root/lejulab_ws
export ROBOT_VERSION=17
source installed/setup.zsh
source devel/setup.zsh
roslaunch leju_launch load_mujoco_sim.launchIf you are using bash, change both .zsh occurrences to .bash.
8. Run the robot
After startup, the MuJoCo window and the joystick input window are displayed:
- Wait for the controller terminal to display
Lifecycle => 机器人就绪; - Press the
startbutton on the joystick to move the controller from the waiting state to the running state; - Click
Runin the MuJoCo window to start the physics simulation; - If no physical joystick is available, follow the prompts in the joystick input window to simulate input with the keyboard or mouse;
- If the robot falls down initially, click
Pause,Reset, thenRunin that order and try again.
To stop the simulation, press Ctrl+C in the terminal where roslaunch was started.
Launching Without Shared Memory
For initial verification, or when RouDi is temporarily unavailable, you can disable iceoryx shared memory and use plain CycloneDDS instead:
cd /root/lejulab_ws
export ROBOT_VERSION=17
source installed/setup.zsh
source devel/setup.zsh
roslaunch leju_launch load_mujoco_sim.launch enable_iceoryx_shm:=falseThis method does not require RouDi and is suitable for quickly verifying the build output and the MuJoCo graphical environment.
Expected Result
After a normal startup, the MuJoCo window loads the Roban 2.2 model, the controller terminal displays Lifecycle => 机器人就绪, and the joystick window shows button and stick input. After pressing start and clicking Run, the robot enters the standing and motion-control state.

Common Issues
Git reports dubious ownership
The cause is a UID/ownership mismatch between the host user and the user inside the container. Run:
git config --global --add safe.directory /root/lejulab_wsThe build produces many CycloneDDS undefined reference errors
Typical errors are as follows:
warning: libddscxx.so.0 ... not found
warning: libddsc.so.0 ... not found
undefined reference to `org::eclipse::cyclonedds::...`This is caused by not loading the installed environment before building. Run the following again:
cd /root/lejulab_ws
export ROBOT_VERSION=17
source installed/setup.zsh
catkin build --force-cmakeThen use the following command to confirm that there are no missing dependencies:
ldd src/lejusdk/lejusdk-lowlevel/lib/liblejusdk-lowlevel.so | grep 'not found'If the command produces no output, the shared library dependencies are complete.
start_roudi.sh reports that iox-roudi was not found
Some versions of start_roudi.sh still search the old directory installed/iceoryx/bin, but the actual program is located at installed/bin/iox-roudi. Inside the container, prefer:
./src/leju_launch/scripts/setup_cyclonedds_config_for_docker.shTo start it manually in the foreground, run:
installed/bin/iox-roudi \
-c src/leju_launch/config/roudi_config.tomlBuild log characters are interleaved and hard to read
This is caused by multiple link jobs writing output in parallel; it is not encoding corruption. You can temporarily rebuild the failed packages single-threaded:
catkin build -j1 -p1The MuJoCo window does not appear
-
Confirm that you are running in the host's graphical desktop rather than a headless environment;
-
Exit the container and re-enter it via
./docker/run.shor./docker/run_with_gpu.sh; -
Check
DISPLAYinside the container:echo "$DISPLAY" -
In GPU mode, check the NVIDIA driver and NVIDIA Container Toolkit; if GPU is not configured, switch to normal mode.
Simulation nodes start but exchange no data
Confirm that all terminals use the same robot version and DDS configuration:
echo "$ROBOT_VERSION"
echo "$CYCLONEDDS_URI"
pgrep -a iox-roudiIn shared-memory mode, ROBOT_VERSION=17 should be set, CYCLONEDDS_URI should point to cyclonedds_shm.xml, and an iox-roudi process should exist. If communication still fails, first use enable_iceoryx_shm:=false to verify the plain DDS path.