This codebase includes the implementation of our hierarchical MARL framework for multi-quadruped pushing tasks in Issac Gym. The codebase is developed based on MQE.
- Create a new Python virtual env or conda environment with Python 3.8.
conda create -n mapush python=3.8
- Install PyTorch and Isaac Gym.
- Install an compatible PyTorch version from https://pytorch.org/.
- Download and install Isaac Gym Preview 4 from https://developer.nvidia.com/isaac-gym.
tar -xf IsaacGym_Preview_4_Package.tar.gz cd isaacgym/python && pip install -e .
- Check Isaac Gym is available by running
cd examples && python 1080_balls_of_solitude.py
- Install MAPush and required packages. Direct to the directory of this repository and run
pip install -e .
- Refer to Trouble Shooting if you meet issues!
-
1.1.1 Command Line
- Command:
source task/<object>/train.sh False
<object>
options:cuboid
,Tblock
, orcylinder
- Example:
source task/cuboid/train.sh False
- Command:
-
1.1.2 Running Process
task/<object>/train.sh
updatesmqe/envs/configs/go1_push_config.py
based ontask/<object>/config.py
. It then starts training by running./openrl_ws/train.py
. Training logs are temporarily stored in./log/
. Once training completes, the final output (including model checkpoints, TensorBoard data, and task settings) is saved in./results/<mm-dd-hh_object>
.- Afterward,
task/<object>/train.sh
calls./openrl_ws/test.py
with<test_mode calculator>
to compute the success rate for each checkpoint. The results are stored in./results/<mm-dd-hh_object>/success_rate.txt
.
-
1.2.1 Command Line
- Command:
source <save_dir>/task/train.sh True
<save_dir>
is the directory where the training results are saved.- Example:
source results/10-15-23_cuboid/task/train.sh True
- Command:
-
1.2.2 Running Process
- Choose a specific checkpoint and modify
$filename
, or add the--record_video
flag to record the output. <save_dir>/task/train.sh
will invoke./openrl_ws/test.py
with<test_mode viewer>
to render a visual output of the pushing behavior.
- Choose a specific checkpoint and modify
-
1.3.1 Task Setting
- The task configuration is saved in
./task/cuboid/config.py
. You can edit this file according to the detailed annotations provided.
- The task configuration is saved in
-
1.3.2 Hyperparameters
- Mid-level network hyperparameters can be modified in
./task/<object>/train.sh
. Adjust values for$num_envs
,$num_steps
,#checkpoint
, or pass additional parameters directly to./openrl_ws/train.py
.
- Mid-level network hyperparameters can be modified in
-
2.1.1 Preparation
- Ensure that a mid-level controller has been trained, and add the checkpoint path to
mqe/envs/configs/go1_push_upper_config.py
undercontrol.command_network_path
.
- Ensure that a mid-level controller has been trained, and add the checkpoint path to
-
2.1.2 Command
- Run the following command to begin training:
python ./openrl_ws/train.py --algo ppo --task go1push_upper --train_timesteps 100000000 --num_envs 500 --use_tensorboard --headless
- Run the following command to begin training:
-
2.2.1 Command
- Run the following command to test the high-level controller:
python ./openrl_ws/test.py --algo ppo --task go1push_upper --train_timesteps 100000000 --num_envs 10 --use_tensorboard --checkpoint your_checkpoint
- Use
--record_video
to record the results.
- Run the following command to test the high-level controller:
-
2.2.2 Pretrained Example
- A pretrained high-level policy to push a 1.2m x 1.2m cube, can be found in
resources/goals_net
.
- A pretrained high-level policy to push a 1.2m x 1.2m cube, can be found in
-
2.2.3 Code Location
- Upper-Level Task Configuration
- Task configuration settings for the high-level controller are in
mqe/envs/configs/go1_push_upper_config.py
.
- Task configuration settings for the high-level controller are in
- Upper-Level Task Wrapper
- The wrapper for upper-level task settings is located in
mqe/envs/wrappers/go1_push_upper_wrapper.py
.
- The wrapper for upper-level task settings is located in
- Upper-Level Task Configuration
-
If you get the following error:
ImportError: libpython3.8m.so.1.0: cannot open shared object file: No such file or directory
, it is also possible that you need to doexport LD_LIBRARY_PATH=/PATH/TO/LIBPYTHON/DIRECTORY
/export LD_LIBRARY_PATH=/PATH/TO/CONDA/envs/YOUR_ENV_NAME/lib
. You can also try:sudo apt install libpython3.8
. -
The numpy version should be no later than 1.19.5 to avoid conflict with the Isaac Gym utility files. You can also 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.
-
If you get
Segmentation fault (core dumped)
while rendering frames using A100/A800, please switch to GeFoece graphic cards. -
If you get the error
partially initialized module 'openrl.utils.callbacks.callbacks' has no attribute 'BaseCallback'
, please comment out the linefrom openrl.runners.common.base_agent import BaseAgent
inopenrl/utils/callback/callback.py
.
If you find our paper or repo helpful to your research, please consider citing the paper:
@article{mapush2024,
title={Learning Multi-Agent Loco-Manipulation for Long-Horizon Quadrupedal Pushing},
author={Feng, Yuming and Hong, Chuye and Niu, Yaru and Liu, Shiqi and Yang, Yuxiang and Yu, Wenhao and Zhang, Tingnan and Tan, Jie and Zhao, Ding},
journal={arXiv preprint arXiv:2411.07104},
year={2024}
}