Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|http://us.archive.ubuntu.com/ubu

# Install build dependencies + X11 support for GUI rendering
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc-12 g++-12 cmake build-essential unzip git-lfs wget \
gcc-12 g++-12 cmake build-essential curl unzip git-lfs wget \
libglu1-mesa-dev vulkan-tools libvulkan1 \
libx11-6 libxext6 libxrender1 libxi6 libxrandr2 libxcursor1 libxinerama1 \
libgl1-mesa-glx libglib2.0-0 libsm6 libxt6 libxkbcommon-x11-0 \
Expand Down Expand Up @@ -100,12 +100,29 @@ RUN git clone https://github.com/unitreerobotics/unitree_rl_lab.git /home/code/u
./source/unitree_rl_lab/unitree_rl_lab/assets/robots/unitree.py && \
./unitree_rl_lab.sh -i


# Clone H12 Lab Docs
RUN git clone https://github.com/correlllab/h12-lab-docs.git /home/code/h12-lab-docs

# Clone H12 Stand
RUN git clone https://github.com/correlllab/h12_stand.git /home/code/h12_stand

#Setup sources
RUN set -eux; \
ROS_VERSION=$(curl -s https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | grep -F "tag_name" | awk -F\" '{print $4}'); \
curl -L -o /tmp/ros2.deb "https://github.com/ros-infrastructure/ros-apt-source/releases/download/${ROS_VERSION}/ros2-apt-source_${ROS_VERSION}.$(. /etc/os-release && echo $VERSION_CODENAME)_all.deb"; \
dpkg -i /tmp/ros2.deb; \
rm /tmp/ros2.deb

#Install ros humble desktop and rmw cyclonedds cpp implementation
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-humble-desktop \
ros-humble-rmw-cyclonedds-cpp \
&& rm -rf /var/lib/apt/lists/*

#Set environment variables
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ENV ROS_DISTRO=humble
# ==============================
# Stage 2: Runtime
# ==============================
Expand Down Expand Up @@ -134,19 +151,23 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY --from=builder /home/code /home/code
COPY --from=builder /cyclonedds /cyclonedds
COPY --from=builder /opt/conda /opt/conda
COPY --from=builder /opt/ros/humble /opt/ros/humble

COPY conda_overlay_ros2.sh /home/code/conda_overlay_ros2.sh

# Initialize bashrc (removed OMNI_KIT_DISABLE_STARTUP)
RUN echo 'source /opt/conda/etc/profile.d/conda.sh' >> ~/.bashrc && \
echo 'conda activate humanoid_sim_env' >> ~/.bashrc && \
echo 'chmod +x /home/code/conda_overlay_ros2.sh && . /home/code/conda_overlay_ros2.sh' >> ~/.bashrc && \
echo 'source /opt/ros/humble/setup.sh' >> ~/.bashrc && \
echo 'export OMNI_KIT_ALLOW_ROOT=1' >> ~/.bashrc && \
echo 'export OMNI_KIT_ACCEPT_EULA=yes' >> ~/.bashrc && \
echo 'export UNITREE_MODEL_DIR=/home/code/unitree_model' >> ~/.bashrc && \
echo 'export UNITREE_ROS_DIR=/home/code/unitree_ros' >> ~/.bashrc && \
echo 'export CYCLONEDDS_HOME=/cyclonedds/install' >> ~/.bashrc

echo 'export CYCLONEDDS_HOME=/cyclonedds/install' >> ~/.bashrc && \
echo 'export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp' >> ~/.bashrc

WORKDIR /home/code

# Default to Conda environment bash
CMD ["conda", "run", "-n", "humanoid_sim_env", "/bin/bash"]
CMD ["conda", "run", "-n", "humanoid_sim_env", "/bin/bash"]
26 changes: 26 additions & 0 deletions conda_overlay_ros2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

#source conda rq
source /opt/conda/etc/profile.d/conda.sh

#update and install required python packages
echo 'installing: python3.10; libpython3.10-dev; libspdlog-dev; pip'
apt update && apt install python3.10 libpython3.10-dev libspdlog-dev pip -y

#symlink target /usr/bin/python3.10 to link /usr/bin/python
ln -s /usr/bin/python3.10 /usr/bin/python

#setting up python3.10 executable along with conda's executable
update-alternatives --install /usr/bin/python python /usr/bin/python3.10 2

#momentarily deactivate conda and set the python executable in /usr/bin to take precendence
conda deactivate
export PATH=/usr/bin:$PATH

#install required pip packages
echo 'pip installing: packaging; numpy; netifaces; pyyaml'
python -m pip install packaging numpy netifaces pyyaml

#reactivate conda env
conda activate humanoid_sim_env

2 changes: 1 addition & 1 deletion docker_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ docker run --gpus all -it --rm \
--publish 8211:8211 \
--publish 8899:8899 \
humanoid-sim:latest \
/bin/bash
/bin/bash