Wenhao Yu, Tingnan Zhang, Jie Tan, Byron Boots, Ding Zhao
- Overview
- Installation
- Running in Simulation
- Hardware Setup
- Running in Real World
- Notes for Future Development
This repository provides the open-source files for LocoMan.
Key features:
- Hardware: Files available in
.sldprt
and.sldasm
formats for development, and.stl
format for fabrication. - System: Unified codebase for both simulation and real robot deployment, toggled via the
--use_real_robot
argument. It also contains a Python-based whole-body impulse controller.
- Create a conda environment with python3.8:
conda create -n locoman python=3.8
- Install the dependencies:
Note that the
conda activate locoman pip install -e . conda install pinocchio -c conda-forge
numpy
version should be no later than1.19.5
to avoid conflict with the Isaac Gym utility files. But we can modify 'np.float' into 'np.float32' in the function 'get_axis_params' of the python file in 'isaacgym/python/isaacgym/torch_utils.py' to resolve the issue. So don't worry about the version limitation. - Install ROS Neotic (we only test the code on Ubuntu 20.04).
- Download IsaacGym Preview 4.
- Install IsaacGym:
conda activate locoman cd isaacgym/python && pip install -e .
- Try running an example
cd examples && python 1080_balls_of_solitude.py
. The code is set to run on CPU so don't worry if you see an error about GPU not being utilized.
- Download the SDK:
cd locoman git clone https://github.com/unitreerobotics/unitree_legged_sdk.git
- Make sure the required packages are installed, following Unitree's guide. Most notably, please make sure to install
Boost
andLCM
:sudo apt install libboost-all-dev liblcm-dev pip install empy catkin_pkg
- Then, go to the
unitree_legged_sdk
directory and build the libraries:cd unitree_legged_sdk mkdir build && cd build cmake -DPYTHON_BUILD=TRUE .. make
- Start ROS:
roscore
- Run the Joystick (for a better understanding of the teleoperation process, it's recommended to review the comments in joystick.py):
python teleoperation/joystick.py
- Run LocoMan in Simulation:
- By default, the robot is equiped with two manipualtors. To run:
python script/play_fsm.py
- For playing a pure Go1 robot without manipulators, run:
python script/play_fsm.py --use_gripper=False
- By default, the robot is equiped with two manipualtors. To run:
If you have a Unitree GO1 robot but do not plan to build the loco-manipulators, you can skip the hardware setup and still use this repository for locomotion and foot-based manipulation. However, to access the full functionality of LocoMan on a real robot, you will need to build a pair of loco-manipulators.
To begin, gather the following materials. For easier servo configuration, consider purchasing the DYNAMIXEL Starter Set instead of just the DYNAMIXEL U2D2 (ID 9 in the BOM).
ID | Part | Description | Price (per unit) | Quantity |
---|---|---|---|---|
0 | Unitree Go1 Robot | Edu version | 1 | |
1-8 | DYNAMIXEL XC330-T288-T | Servos for the manipulators | $89.90 | 8 |
9 | DYNAMIXEL U2D2 | Convert control signals from PC to servos | $32.10 | 1 |
10 | 3P JST Expansion Board | Combine control signal and power to the manipulators | $5.90 | 1 |
11 | 100cm 3 Pin JST Cable (5pcs) | Connect manipulators to the expansion board | $10.19 | 1 |
12 | 24V to 12V 10A Converter | Convert 24V power from Go1 to 12V for the manipulators | $9.75 | 1 |
13 | 30cm XT30 Connector (2pcs) | Connect Go1 power supply to the converter | $8.59 | 1 |
14 | 20ft Ethernet Cable | Connect PC to Go1 | $18.99 | 1 |
15 | 20ft USB Extension Cable | Connect PC to U2D2 | $18.99 | 1 |
16 | Bearings 5x8x2.5mm (10pcs) | Bearings for the rotational gripper | $8.19 | 1 |
17 | M2 Screws: 22x4cm, 24x6cm, 48x10cm; Nuts: 8xM2 | Used for assembly | $8.29 | 1 |
18 | M2.5 Screws: 2x10cm, 2x6cm | Used for assembly | $11.99 | 1 |
19 | Spring Washer: 24xM2, 2xM2.5 | Used for assembly | $9.99 | 1 |
20 | Joystick (optional) | Refer to joystick.py | 1 | |
21 | Printed parts | 3D print them | 1 |
Use Dynamixel Wizard to adjust the ID, baud rate, and latency (reference to the guide). Make the following changes:
- Relabel the motor IDs: [1, 2, 3, 4] for the right manipulator and [5, 6, 7, 8] for the left manipulator.
- Set the baud rate to 1000000.
- Set the return delay time to 0.
- Refer to the image of the IDs of the servos to select the correct servos for the corresponding manipulators
- Check out loco-manipulator_left_fabrication.SLDASM to see how to assemble the manipulators using servos, screws, nuts, and spring washers. It's important that the left manipulator appears as shown below when all servos are in their zero positions.
- Note that the zero positions of the servos differ between the simulation and the real manipulators. Specifically, in simulation (URDF), the first servo of each manipulator points forward, as seen in loco-manipulator_left_urdf.SLDASM. Therefore, during the assembly process, you should refer to loco-manipulator_left_fabrication.SLDASM.
We use the following setup to perform the demos in the paper. A desktop sends control signals to the robot via an Ethernet cable (ID-14) and to the manipulators via a USB cable (ID-15). Before running the code, make sure to turn on the Go1 robot, which will also power the servos.
Once the hardware is ready, connect the USB to your computer and power on the robot. Then, check the USB ID and enable the USB device for communication (modify the USB ID based on the output of the first command):
lsusb
sudo chmod 777 /dev/ttyUSB0
Additionally, update the installed SDK by setting LATENCY_TIMER = 1 in the file /dynamixel_sdk/port_handler.py.
-
Similar to running in simulaiton, start ROS and the Joystick in separate terminals:
roscore
python teleoperation/joystick.py
-
Deploy on the Real Robot:
- Without manipulators: Run the following command:
python script/play_fsm.py --use_real_robot=True --use_gripper=False
- With manipulators: Before running LocoMan, the manipulators need to be initialized.
- First, start the manipulators:
python manipulator/run_manipulators.py
- Then, run the FSM:
python script/play_fsm.py --use_real_robot=True
- First, start the manipulators:
- Without manipulators: Run the following command:
- Locomotion. The locomotion planners and state estimator are adapted from Yuxiang's previous projects Fast and Efficient Locomotion and CAJun. Since the demos were conducted indoors, the locomotion planners were simplified to handle flat terrain only. If you plan to use the locomotion feature on uneven terrain, you’ll need to enhance it using the mentioned repos.
- Loco-Manipulation. This mode is designed to maintain a target orientation for the gripper during locomotion. Tracking a full 6D pose of the gripper while using only the rest three legs for locomotion presents a much greater challenge, which was not explored in this project.
- Single-Arm Manipulation. The transition from stance to single-gripper manipulation involves two steps: (a) adjusting the torso, and (b) moving the foot and manipulator. Achieving smoother and more efficient transitions remains an open challenge. Additionally, issues like singularity and collision still need to be addressed.
- Bimanul-Manipulation. The transition trajectories were recorded by executing Unitree's high-level controller to perform the action of making a traditional Chinese salute. For details, refer to the trajectory extraction code. Note that you may need to collect new trajectories if you change the robot’s hardware configuration or use a different robot. In addition, we have locked this mode for real robots. You can unlock it by setting
lock_real_robot_bimanual = False
in config.py.
- Simulate before Deployment. Although the paper presents results from real robot deployment, we also developed a simulation of LocoMan using the Isaac Gym simulator. This simulation helps a lot for debugging and safeguarding the real robot during system development. To support future work, we also open souce the code of the LocoMan simulation.
- Parallel Simulation. The simulation environment was originally designed to be GPU-parallel, as we initially planned to leverage RL to train a controller for LocoMan. However, due to poor tracking performance, we moved away from learning-based methods. Therefore, the current simulation environment is only partially parallel, where each robot instance has its own instance of the WBC class
- Collision Model. In this project, we did not test the manipulator’s grasping functionality, so the gripper is modeled as a rigid body in simulation. To simulate manipulation tasks, you’ll need to create a new URDF using the open-source CAD models. In addition, we modified the collision model for the thigh motors. Please ensure the torso doesn't interact with the environment if you use the provided urdf in your project.
- The function
_update_human_command_callback
in each commander comes from the original development in the paper. However, it does not work in this codebase because other parts have been refined. If you plan to teleoperate LocoMan using human motion, please note that these functions are provided as examples and will need to be overwritten with your own implementations.
This repository is developed with inspiration from these repositories: CAJun, LEAP Hand, and Cheetah-Software. We thank the authors for making the repos open source.