-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
168 lines (145 loc) · 5.54 KB
/
Dockerfile
File metadata and controls
168 lines (145 loc) · 5.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
FROM ros:humble
ARG DEBIAN_FRONTEND=noninteractive
ARG USER_UID=1001
ARG USER_GID=1001
ARG USERNAME=user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
# Install Eigen 3.3.9
RUN apt-get update -y && apt-get install -y --allow-unauthenticated \
curl
RUN mkdir /home/user/Libraries
RUN mkdir /home/user/source_code
RUN cd /home/user/source_code \
&& curl https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.tar.gz --output eigen.tar.gz \
&& tar -xvzf eigen.tar.gz
RUN cd /home/user/source_code/eigen-3.3.9 \
&& mkdir build \
&& cd build \
&& cmake .. \
&& make \
&& make install \
&& cd /home/user/
# Install the package dependencies
RUN apt-get update -y && apt-get install -y --allow-unauthenticated \
software-properties-common \
clang-14 \
clang-format-14 \
clang-tidy-14 \
python3-pip \
libpoco-dev \
ros-humble-control-msgs \
ros-humble-xacro \
ros-humble-ament-cmake-clang-format \
ros-humble-ament-clang-format \
ros-humble-ament-flake8 \
ros-humble-ament-cmake-clang-tidy \
ros-humble-angles \
ros-humble-ros2-control \
ros-humble-realtime-tools \
ros-humble-control-toolbox \
ros-humble-controller-manager \
ros-humble-hardware-interface \
ros-humble-hardware-interface-testing \
ros-humble-launch-testing \
ros-humble-generate-parameter-library \
ros-humble-controller-interface \
ros-humble-ros2-control-test-assets \
ros-humble-controller-manager \
ros-humble-moveit \
ros-humble-nav-msgs \
ros-humble-rqt-controller-manager \
ros-humble-sensor-msgs \
ros-humble-tf-transformations \
ros-humble-rmw-cyclonedds-cpp \
ros-humble-plotjuggler-ros \
ros-humble-rqt-reconfigure \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install -U \
argcomplete \
flake8-blind-except \
flake8-builtins \
flake8-class-newline \
flake8-comprehensions \
flake8-deprecated \
flake8-docstrings \
flake8-import-order \
flake8-quotes \
pytest-repeat \
pytest-rerunfailures \
pytest \
scipy
# Build libfranka
RUN cd /home/user/source_code && git clone https://github.com/frankaemika/libfranka.git \
&& mkdir /home/user/Libraries/libfranka \
&& cd libfranka \
&& git checkout 0.9.2 \
&& git submodule init \
&& git submodule update \
&& mkdir build && cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/home/user/Libraries/libfranka .. \
&& cmake --build . \
&& cmake --install .
# Install MuJoCo dependencies first
RUN apt-get update -y && apt-get install -y \
libglfw3 \
libglfw3-dev \
libgl1-mesa-dev \
libxinerama-dev \
libxcursor-dev \
libxrandr-dev \
libxi-dev \
ninja-build \
zlib1g-dev \
clang-12
# Install dqrobotics
RUN add-apt-repository ppa:dqrobotics-dev/release && apt-get update && apt-get install libdqrobotics
# Install MuJoCo 3.2.0 from scratch
RUN cd /home/user/source_code && git clone https://github.com/google-deepmind/mujoco.git
RUN cd /home/user/source_code/mujoco && git checkout tags/3.2.0
RUN cd /home/user/source_code \
&& mkdir /home/user/source_code/mujoco/build \
&& mkdir /home/user/Libraries/mujoco \
&& cd /home/user/source_code/mujoco/build \
&& cmake .. -DCMAKE_INSTALL_PREFIX=/home/user/Libraries/mujoco \
&& cmake --build . \
&& cmake --install .
# Now copy the contents of the repository into a new workspace
RUN mkdir -p /home/user/humble_ws/src/bimanual_architecture && cd /home/user/humble_ws
COPY . /home/user/humble_ws/src/bimanual_architecture/
# Set up the environment variables
RUN echo 'source /opt/ros/humble/setup.bash' >> /home/user/.bashrc
RUN echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/Libraries/libfranka/lib:/home/user/Libraries/mujoco/lib' >> /home/user/.bashrc
RUN echo 'export CMAKE_PREFIX_PATH=/home/user/Libraries/libfranka/lib/cmake:/home/user/Libraries/mujoco/lib/cmake' >> /home/user/.bashrc
# Clone mujoco_ros_pkgs
RUN cd /home/user/humble_ws/src && git clone https://github.com/hucebot/mujoco_ros_pkgs.git
# Checkout the specific branch for ROS 2 Humble
RUN cd /home/user/humble_ws/src/mujoco_ros_pkgs && git checkout wip_ros_control_humble
# Clone custom_msgs
RUN cd /home/user/humble_ws/src && git clone https://github.com/hucebot/franka_custom_msgs.git
# Do rosdep install and then build the packages
RUN cd /home/user/humble_ws && apt-get update \
&& . /opt/ros/humble/setup.sh && rosdep update \
&& rosdep install -i --from-path src --rosdistro humble -y
RUN chown -R user:user /home/user/
USER user
WORKDIR /home/user/
SHELL ["/bin/bash", "-c"]
# Suppress the XDG errors when running GUI apps like RVIZ
RUN mkdir /tmp/${USER_UID}
RUN chown -R user:user /tmp/${USER_UID}
ENV XDG_RUNTIME_DIR=/tmp/${USER_UID}
ENV CMAKE_PREFIX_PATH=/home/user/Libraries/libfranka/lib/cmake:/home/user/Libraries/mujoco/lib/cmake
RUN cd /home/user/humble_ws \
&& source /home/user/.bashrc \
&& . /opt/ros/humble/setup.sh \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
RUN echo 'source /home/user/humble_ws/install/setup.bash' >> /home/user/.bashrc
RUN echo 'export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp' >> /home/user/.bashrc
WORKDIR /home/user/humble_ws