Skip to content

Unitree Go2

GitHub code build GitHub last commit

DockerHub image Docker image arch Docker image version Docker image size

Please note that this workspace is only tested in simulation.

Run the container

# Run the container
cd /home/ros2-essentials/go2_ws/docker
docker compose up -d --build
docker exec -it ros2-go2-ws bash

Testing

Isaac Lab Examples

Training environments (Isaac-Velocity-Flat-Unitree-Go2-v0, Isaac-Velocity-Rough-Unitree-Go2-v0):

cd ~/IsaacLab
./isaaclab.sh -p scripts/reinforcement_learning/rsl_rl/train.py --task Isaac-Velocity-Rough-Unitree-Go2-v0 --headless
# or
./isaaclab.sh -p scripts/reinforcement_learning/skrl/train.py --task Isaac-Velocity-Rough-Unitree-Go2-v0 --headless

Run pre-trained model inference:

cd ~/IsaacLab
./isaaclab.sh -p scripts/reinforcement_learning/rsl_rl/play.py --task Isaac-Velocity-Rough-Unitree-Go2-v0 --num_envs 32 --use_pretrained_checkpoint

Custom Isaac Sim Environment

Run ~/isaacsim/isaac-sim.sh and open /home/ros2-essentials/go2_ws/isaacsim/assets/go2_og.usda in Omniverse, and then press Play.

In another terminal, exec into the container:

docker exec -it ros2-go2-ws bash

Inspect the joint states and clock:

ros2 topic echo /joint_states
ros2 topic echo /clock

Inspect TF and Odom by launching rviz2 and set Fixed Frame to world and Add > TF. Then, Add > Odometry and set Topic to /odom.

Send a joint command:

ros2 topic pub --once /joint_command sensor_msgs/msg/JointState "{
  name: [
    'FL_hip_joint', 'FR_hip_joint', 'RL_hip_joint', 'RR_hip_joint',
    'FL_thigh_joint', 'FR_thigh_joint', 'RL_thigh_joint', 'RR_thigh_joint',
    'FL_calf_joint', 'FR_calf_joint', 'RL_calf_joint', 'RR_calf_joint'
  ],
  position: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0],
  velocity: [],
  effort: []
}"

The Go2 should move forward a little bit, which can be seen in both Isaac Sim and RViz2.