-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4a45d71
Showing
1,470 changed files
with
1,375,667 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# IDEs | ||
.idea | ||
|
||
# builds | ||
*.egg-info | ||
|
||
# cache | ||
__pycache__ | ||
.pytest_cache | ||
|
||
# vs code | ||
.vscode | ||
|
||
# model | ||
legged_gym/logs/ | ||
|
||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0) | ||
|
||
Copyright (c) 2023 Xuxin Cheng, Kexin Shi, Deepak Pathak | ||
|
||
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. | ||
To view a full legal copy of this license, visit: https://creativecommons.org/licenses/by-nc/4.0/ | ||
or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. | ||
|
||
You are free to share, i.e., copy and redistribute the material in any medium or format under the following terms: | ||
|
||
- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. | ||
|
||
- NonCommercial — You may not use the material for commercial purposes. | ||
|
||
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. | ||
|
||
This is a human-readable summary of (and not a substitute for) the license. For the full legal text of the license, please refer to the Creative Commons Attribution-NonCommercial 4.0 International License at the provided URL on the link above below. | ||
|
||
|
||
------------------ | ||
|
||
This code builds upon following open-source code-bases. Please visit the URLs to see the respective LICENSES: | ||
|
||
1) https://github.com/leggedrobotics/legged_gym | ||
2) https://github.com/leggedrobotics/rsl_rl | ||
3) https://github.com/Toni-SM/skrl | ||
|
||
------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Locomotion Baseline # | ||
|
||
### Installation ### | ||
```bash | ||
conda create -n (your env name) python=3.8 | ||
conda activate (your env name) | ||
cd | ||
pip3 install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio==0.10.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html | ||
git clone git@github.com:inFpZero/Locomotion_Baseline.git | ||
cd Locomotion_Baseline | ||
# Download the Isaac Gym binaries from https://developer.nvidia.com/isaac-gym | ||
# Originally trained with Preview3, but haven't seen bugs using Preview4. | ||
cd isaacgym/python && pip install -e . | ||
cd ~/extreme-parkour/rsl_rl && pip install -e . | ||
cd ~/extreme-parkour/legged_gym && pip install -e . | ||
pip install "numpy<1.24" pydelatin swanlab tqdm opencv-python ipdb pyfqmr flask | ||
``` | ||
|
||
### Usage ### | ||
`cd legged_gym/scripts` | ||
1. Train base policy: | ||
```bash | ||
python train.py --exptid xxx-xx-WHATEVER --device cuda:0 | ||
``` | ||
Train 10-15k iterations (8-10 hours on 3090) (at least 15k recommended). | ||
|
||
<!-- 2. Train distillation policy: | ||
```bash | ||
python train.py --exptid yyy-yy-WHATEVER --device cuda:0 --resume --resumeid xxx-xx --delay --use_camera | ||
``` | ||
Train 5-10k iterations (5-10 hours on 3090) (at least 5k recommended). | ||
>You can run either base or distillation policy at arbitary gpu # as long as you set `--device cuda:#`, no need to set `CUDA_VISIBLE_DEVICES`. --> | ||
|
||
2. Play base policy: | ||
```bash | ||
python play.py --exptid xxx-xx | ||
``` | ||
No need to write the full exptid. The parser will auto match runs with first 6 strings (xxx-xx). So better make sure you don't reuse xxx-xx. | ||
|
||
<!-- 4. Play distillation policy: | ||
```bash | ||
python play.py --exptid yyy-yy --delay --use_camera | ||
``` --> | ||
|
||
<!-- 5. Save models for deployment: | ||
```bash | ||
python save_jit.py --exptid xxx-xx | ||
``` | ||
This will save the models in `legged_gym/logs/parkour_new/xxx-xx/traced/`. --> | ||
|
||
### Viewer Usage | ||
Can be used in both IsaacGym and web viewer. | ||
- `ALT + Mouse Left + Drag Mouse`: move view. | ||
- `[ ]`: switch to next/prev robot. | ||
- `Space`: pause/unpause. | ||
- `F`: switch between free camera and following camera. | ||
|
||
### Arguments | ||
- --exptid: string, can be `xxx-xx-WHATEVER`, `xxx-xx` is typically numbers only. `WHATEVER` is the description of the run. | ||
- --device: can be `cuda:0`, `cpu`, etc. | ||
- --delay: whether add delay or not. | ||
- --checkpoint: the specific checkpoint you want to load. If not specified load the latest one. | ||
- --resume: resume from another checkpoint, used together with `--resumeid`. | ||
- --seed: random seed. | ||
- --no_swanlab: no swanlab logging. | ||
- --use_camera: use camera or scandots. | ||
- --web: used for playing on headless machines. It will forward a port with vscode and you can visualize seemlessly in vscode with your idle gpu or cpu. [Live Preview](https://marketplace.visualstudio.com/items?itemName=ms-vscode.live-server) vscode extension required, otherwise you can view it in any browser. | ||
|
||
### todo | ||
|
||
[ ] config to deploy | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
conda create -n parkour python=3.8 | ||
conda activate parkour | ||
cd | ||
pip3 install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio==0.10.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html | ||
git clone git@github.com:chengxuxin/extreme-parkour.git | ||
cd extreme-parkour | ||
# Download the Isaac Gym binaries from https://developer.nvidia.com/isaac-gym | ||
cd isaacgym/python && pip install -e . | ||
cd ~/extreme-parkour/rsl_rl && pip install -e . | ||
cd ~/extreme-parkour/legged_gym && pip install -e . | ||
pip install "numpy<1.24" pydelatin swanlab tqdm opencv-python ipdb pyfqmr flask |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
sudo docker stop foxy_controller || true | ||
sudo docker rm foxy_controller || true | ||
cd ~/go1_gym/go1_gym_deploy/docker/ | ||
sudo make autostart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
sudo docker stop foxy_controller || true | ||
sudo docker rm foxy_controller || true | ||
sudo kill $(ps aux |grep lcm_position | awk '{print $2}') | ||
cd ~/go1_gym/go1_gym_deploy/unitree_legged_sdk_bin/ | ||
yes "" | sudo ./lcm_position & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
# syntax=docker/dockerfile:experimental | ||
|
||
FROM nvcr.io/nvidia/l4t-pytorch:r32.6.1-pth1.9-py3 | ||
|
||
#ENV NVIDIA_VISIBLE_DEVICES ${NVIDIA_VISIBLE_DEVICES:-all} | ||
#ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics | ||
|
||
# add new sudo user | ||
ENV USERNAME improbable | ||
ENV HOME /home/$USERNAME | ||
RUN useradd -m $USERNAME && \ | ||
echo "$USERNAME:$USERNAME" | chpasswd && \ | ||
usermod --shell /bin/bash $USERNAME && \ | ||
usermod -aG sudo $USERNAME && \ | ||
mkdir /etc/sudoers.d && \ | ||
echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME && \ | ||
chmod 0440 /etc/sudoers.d/$USERNAME && \ | ||
# Replace 1000 with your user/group id | ||
usermod --uid 1000 $USERNAME && \ | ||
groupmod --gid 1000 $USERNAME | ||
|
||
|
||
# install package | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
curl \ | ||
sudo \ | ||
less \ | ||
emacs \ | ||
apt-utils \ | ||
tzdata \ | ||
git \ | ||
tmux \ | ||
bash-completion \ | ||
command-not-found \ | ||
libglib2.0-0 \ | ||
gstreamer1.0-plugins-* \ | ||
libgstreamer1.0-* \ | ||
libgstreamer-plugins-*1.0-* \ | ||
&& \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections | ||
|
||
#COPY config/nvidia_icd.json /usr/share/vulkan/icd.d/ | ||
|
||
|
||
USER root | ||
|
||
|
||
#RUN apt-get update && apt-get install -y python3-pip && pip3 install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html | ||
|
||
|
||
# ================================================================== | ||
# Useful Libraries for Development | ||
# ------------------------------------------------------------------ | ||
#RUN apt update && apt install -y apt-transport-https ca-certificates curl software-properties-common | ||
#RUN curl -fsSL https://download.sublimetext.com/sublimehq-pub.gpg | apt-key add - && add-apt-repository "deb https://download.sublimetext.com/ apt/stable/" && apt update && apt install sublime-text | ||
|
||
|
||
# ================================================================== | ||
# Python dependencies defined in requirements.txt | ||
# ------------------------------------------------------------------ | ||
#RUN pip3 install --upgrade pip | ||
# copy local requirements file for pip install python deps | ||
#COPY ./requirements.txt /home/$USERNAME | ||
#WORKDIR /home/$USERNAME | ||
#RUN pip3 install -r requirements.txt | ||
|
||
# LCM | ||
RUN apt-get -y update && apt-get install -y make gcc-8 g++-8 | ||
RUN cd /home/$USERNAME && git clone https://github.com/lcm-proj/lcm.git && cd lcm && mkdir build && cd build && cmake .. && make -j && make install | ||
RUN cd /home/$USERNAME/lcm/lcm-python && pip3 install -e . | ||
|
||
|
||
RUN apt-get install -y vim | ||
#RUN pip3 install pandas | ||
|
||
# ROS | ||
# ENV ROS_DISTRO melodic | ||
|
||
RUN apt-get install -y gnupg | ||
|
||
# COPY install_scripts/install_ros.sh /tmp/install_ros.sh | ||
# RUN chmod +x /tmp/install_ros.sh | ||
# RUN /tmp/install_ros.sh | ||
|
||
# # bootstrap rosdep | ||
# RUN rosdep init \ | ||
# && rosdep update | ||
|
||
# # create catkin workspace | ||
# ENV CATKIN_WS=/root/catkin_ws | ||
# RUN bash /opt/ros/melodic/setup.bash | ||
# RUN mkdir -p $CATKIN_WS/src | ||
# WORKDIR ${CATKIN_WS} | ||
# RUN catkin init | ||
# RUN catkin config --extend /opt/ros/$ROS_DISTRO \ | ||
# --cmake-args -DCMAKE_BUILD_TYPE=Release -DCATKIN_ENABLE_TESTING=False | ||
# WORKDIR $CATKIN_WS/src | ||
|
||
|
||
RUN apt-get update && apt-get install -y freeglut3-dev libudev-dev | ||
#COPY ./install_scripts/install_vision_opencv.sh /tmp/install_vision_opencv.sh | ||
#RUN chmod +x /tmp/install_vision_opencv.sh | ||
#RUN /tmp/install_vision_opencv.sh | ||
|
||
|
||
RUN apt-get install -y libgl1-mesa-dev libudev1 libudev-dev | ||
|
||
|
||
#RUN apt-get install unzip | ||
# | ||
#RUN cd ~ && \ | ||
# wget -O opencv.zip https://github.com/opencv/opencv/archive/4.5.1.zip && \ | ||
# wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.5.1.zip && \ | ||
# unzip opencv.zip && \ | ||
# unzip opencv_contrib.zip && \ | ||
# mv opencv-4.5.1 opencv && \ | ||
# mv opencv_contrib-4.5.1 opencv_contrib && \ | ||
# rm opencv.zip && \ | ||
# rm opencv_contrib.zip | ||
# | ||
#RUN cd ~/opencv && \ | ||
# mkdir build && \ | ||
# cd build && \ | ||
# cmake -D CMAKE_BUILD_TYPE=RELEASE \ | ||
# -D CMAKE_INSTALL_PREFIX=/usr \ | ||
# -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ | ||
# -D EIGEN_INCLUDE_PATH=/usr/include/eigen3 \ | ||
# -D WITH_OPENCL=OFF \ | ||
# -D WITH_CUDA=OFF \ | ||
# -D CUDA_ARCH_BIN=5.3 \ | ||
# -D CUDA_ARCH_PTX="" \ | ||
# -D WITH_CUDNN=OFF \ | ||
# -D WITH_CUBLAS=OFF \ | ||
# -D ENABLE_FAST_MATH=ON \ | ||
# -D CUDA_FAST_MATH=OFF \ | ||
# -D OPENCV_DNN_CUDA=OFF \ | ||
# -D ENABLE_NEON=ON \ | ||
# -D WITH_QT=OFF \ | ||
# -D WITH_OPENMP=ON \ | ||
# -D WITH_OPENGL=ON \ | ||
# -D BUILD_TIFF=ON \ | ||
# -D WITH_FFMPEG=ON \ | ||
# -D WITH_GSTREAMER=ON \ | ||
# -D WITH_TBB=ON \ | ||
# -D BUILD_TBB=ON \ | ||
# -D BUILD_TESTS=OFF \ | ||
# -D WITH_EIGEN=ON \ | ||
# -D WITH_V4L=ON \ | ||
# -D WITH_LIBV4L=ON \ | ||
# -D OPENCV_ENABLE_NONFREE=ON \ | ||
# -D INSTALL_C_EXAMPLES=OFF \ | ||
# -D INSTALL_PYTHON_EXAMPLES=OFF \ | ||
# -D BUILD_NEW_PYTHON_SUPPORT=ON \ | ||
# -D BUILD_opencv_python3=TRUE \ | ||
# -D OPENCV_GENERATE_PKGCONFIG=ON \ | ||
# -D BUILD_EXAMPLES=OFF .. && \ | ||
# make -j4 && cd ~ && \ | ||
# # sudo rm -r /usr/include/opencv4/opencv2 && \ | ||
# cd ~/opencv/build && \ | ||
# sudo make install && \ | ||
# sudo ldconfig && \ | ||
# make clean && \ | ||
# sudo apt-get update | ||
|
||
RUN apt-get install -y libgtk2.0-dev pkg-config | ||
RUN pip3 install opencv-python opencv-contrib-python | ||
|
||
#################################################################################### | ||
###### START HERE -- Install whatever dependencies you need specific to this project! | ||
#################################################################################### | ||
|
||
|
||
#COPY ./rsc/IsaacGym_Preview_2_Package.tar.gz /home/$USERNAME/ | ||
#RUN cd /home/$USERNAME && tar -xvzf IsaacGym_Preview_2_Package.tar.gz | ||
#COPY ./rsc/learning_to_walk_in_minutes.zip /home/$USERNAME/ | ||
#RUN apt-get install unzip && cd /home/$USERNAME/ && unzip learning_to_walk_in_minutes.zip && cd ./code/rl-pytorch && pip3 install -e . | ||
#RUN cd /home/$USERNAME/isaacgym/python && pip3 install -e . | ||
#RUN cd /home/$USERNAME/code/isaacgym_anymal && pip3 install -e . | ||
#COPY ./src/isaacgym_anymal/ /home/$USERNAME/code/isaacgym_anymal/ | ||
|
||
# setup entrypoint | ||
COPY entrypoint.sh / | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
default: build | ||
build: | ||
docker build -t jetson-model-deployment . | ||
clean-build: | ||
docker build -t jetson-model-deployment . --no-cache=true | ||
run: | ||
docker stop foxy_controller || true | ||
docker rm foxy_controller || true | ||
docker run -it \ | ||
--env="DISPLAY" \ | ||
--env="QT_X11_NO_MITSHM=1" \ | ||
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ | ||
--env="XAUTHORITY=${XAUTH}" \ | ||
--volume="${XAUTH}:${XAUTH}" \ | ||
--volume="/home/unitree/go1_gym:/home/isaac/go1_gym" \ | ||
--privileged \ | ||
--runtime=nvidia \ | ||
--net=host \ | ||
--workdir="/home/isaac/go1_gym" \ | ||
--name="foxy_controller" \ | ||
jetson-model-deployment bash | ||
autostart: | ||
docker stop foxy_controller || true | ||
docker rm foxy_controller || true | ||
docker run -d\ | ||
--env="DISPLAY" \ | ||
--env="QT_X11_NO_MITSHM=1" \ | ||
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ | ||
--env="XAUTHORITY=${XAUTH}" \ | ||
--volume="${XAUTH}:${XAUTH}" \ | ||
--volume="/home/unitree/go1_gym:/home/isaac/go1_gym" \ | ||
--privileged \ | ||
--runtime=nvidia \ | ||
--net=host \ | ||
--workdir="/home/isaac/go1_gym" \ | ||
--name="foxy_controller" \ | ||
jetson-model-deployment tail -f /dev/null | ||
docker start foxy_controller | ||
docker exec foxy_controller bash -c 'cd /home/isaac/go1_gym/ && python3 setup.py install && cd go1_gym_deploy/scripts && ls' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
docker load -i deployment_image.tar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
docker save -o deployment_image.tar jetson-model-deployment:latest |
Empty file.
Oops, something went wrong.