-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
191 lines (156 loc) · 5.43 KB
/
Dockerfile
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
FROM dustynv/ros:humble-llm-r36.3.0
ENV DEBIAN_FRONTEND=noninteractive
# Common dependencies & tools
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
vim \
git \
portaudio19-dev \
python3-pip \
python3-pydantic \
wget \
curl \
xorg-dev \
xtl-dev \
gcc-arm-none-eabi \
libnewlib-arm-none-eabi \
zsh \
build-essential \
cmake \
libeigen3-dev \
libtbb-dev \
pybind11-dev \
net-tools \
ninja-build && \
rm -rf /var/lib/apt/lists/
# TODO: Needed this specific version for some reason?
# RUN pip3 install setuptools==58.2.0 && \
# pip3 install --upgrade pip
RUN pip3 install --upgrade pip setuptools
# Heavy prerequisites
# (takes like a day to compile on Jetson Orin Nano)
WORKDIR /opt/ros/${ROS_DISTRO}
# git clone https://github.com/ros-misc-utilities/ffmpeg_image_transport_msgs.git
# colcon build --packages-select-regex '.*ffmpeg.*'
# colcon build --packages-select-regex '.*depthai.*'
# cd /opt/ros/${ROS_DISTRO}/src/
# git clone https://github.com/ros-perception/imu_pipeline.git
# source /opt/ros/${ROS_DISTRO}/install/setup.sh
# colcon build --packages-select-regex '.*imu.*'
ADD install_deps.sh ./
RUN chmod +x install_deps.sh
ADD deepdrive.repos ./
RUN mkdir src && \
vcs import src < deepdrive.repos
RUN ./install_deps.sh \
foxglove_bridge foxglove_msgs \
joint_state_publisher \
nav2_bringup \
navigation2 \
rmw_cyclonedds_cpp \
rmw_fastrtps_cpp \
robot_localization \
robot_state_publisher \
ros2bag \
rosbag2_storage_default_plugins \
slam_toolbox \
twist_mux \
xacro \
ros2_control \
ros2_controllers \
control_toolbox \
realtime_tools \
control_msgs
# rtabmap_ros \
# gscam \
# ros2_control_demos
# MicroROS
ENV UROS_WS=/uros_ws
WORKDIR $UROS_WS
RUN mkdir src && \
cd src && \
git clone https://github.com/micro-ROS/micro_ros_setup.git -b $ROS_DISTRO
RUN apt-get update && \
apt-get install -y flex && \
source /opt/ros/${ROS_DISTRO}/install/setup.sh && \
colcon build && \
source $UROS_WS/install/setup.sh && \
ros2 run micro_ros_setup create_agent_ws.sh && \
ros2 run micro_ros_setup build_agent.sh && \
rm -rf /var/lib/apt/lists/
# RUN source /opt/ros/${ROS_DISTRO}/install/setup.sh && \
# colcon build --packages-skip-regex '.*rviz.*' && \
# apt-get update && \
# rosdep install --from-paths src --ignore-src -r -y \
# --skip-keys "ogre gazebo ros-${ROS_DISTRO}-rviz-imu-plugin" && \
# source $UROS_WS/install/setup.sh && \
# ros2 run micro_ros_setup create_agent_ws.sh && \
# ros2 run micro_ros_setup build_agent.sh && \
# rm -rf /var/lib/apt/lists/
# DepthAI (OAK-D LITE stereo camera)
ENV DEPTHAI_SRC=/opt/depthai-core
WORKDIR /opt/
RUN apt-get update && \
apt install libpcl-dev -y && \
rm -rf /var/lib/apt/lists/ && \
git clone --recursive https://github.com/luxonis/depthai-core.git --branch main && \
cd depthai-core && \
git submodule update --init --recursive && \
cmake -S. -Bbuild -D'BUILD_SHARED_LIBS=ON' -D'CMAKE_INSTALL_PREFIX=/usr/local' && \
cmake --build build --target install && \
rm -rf /var/lib/apt/lists/
ENV DEPTHAI_WS=/depthai_ws
WORKDIR $DEPTHAI_WS
ADD depthai.repos ./
RUN mkdir src && \
vcs import src < depthai.repos
RUN source $UROS_WS/install/setup.sh && \
colcon build
# && \
# apt-get update && \
# rosdep install --from-paths src --ignore-src -r -y && \
# colcon build && \
# rm -rf /var/lib/apt/lists/
# RUN source $UROS_WS/install/setup.sh && \
# colcon build --packages-skip-regex '.*rviz.*' && \
# apt-get update && \
# rosdep install --from-paths src --ignore-src -r -y \
# --skip-keys "ogre gazebo ros-${ROS_DISTRO}-rviz-imu-plugin" && \
# ros2 run micro_ros_setup create_agent_ws.sh && \
# ros2 run micro_ros_setup build_agent.sh && \
# rm -rf /var/lib/apt/lists/
# rm -rf /opt/ros/$ROS_DISTRO/build/pluginlib/pluginlib_enable_plugin_testing && \
# RUN source $UROS_WS/install/setup.sh && \
# rosdep install --from-paths src --ignore-src -y && \
# colcon build
# Main Code
ENV ROS2_WS=/ros_ws \
ROS_PACKAGE=deepdrive \
RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
WORKDIR $ROS2_WS
# Make sure logs and artifacts go into a volume instead of being added to the image
VOLUME ["${ROS2_WS}/install", "${ROS2_WS}/log", "${ROS2_WS}/build", "/tmp"]
# TODO: Probably just need the one setup.sh
# source /opt/ros/${ROS_DISTRO}/install/setup.sh
# source $UROS_WS/install/setup.sh
RUN cat <<EOF >> ~/.bashrc
echo SOURCING ROS /opt/ros/${ROS_DISTRO}/install/setup.sh
source /opt/ros/${ROS_DISTRO}/install/setup.sh
echo SOURCING ROS $UROS_WS/install/setup.bash
source $UROS_WS/install/setup.sh
echo SOURCING ROS $DEPTHAI_WS/install/setup.bash
source $DEPTHAI_WS/install/setup.sh
echo SOURCING ROS $ROS2_WS/install/setup.bash
source $ROS2_WS/install/setup.bash
EOF
RUN cat <<EOF >> ~/.bash_history
colcon build --symlink-install \
--packages-skip-regex '.*gazebo.*' \
--packages-skip deepdrive_simulations
source $ROS2_WS/install/setup.bash
ros2 launch deepdrive_bringup robot.launch.py
ros2 run deepdrive_teleop teleop_keyboard
ros2 launch deepdrive_nav2_bringup navigation_launch.py use_sim_time:=False params_file:=src/deepdrive_nav2_bringup/params/nav2_params.yaml
ros2 launch deepdrive_nav2_bringup slam_launch.py use_sim_time:=False params_file:=src/deepdrive_nav2_bringup/params/nav2_params.yaml
EOF