-
Notifications
You must be signed in to change notification settings - Fork 21
/
Dockerfile
98 lines (84 loc) · 3.17 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
# Use ROS 2 Humble Desktop as the base image
FROM osrf/ros:humble-desktop-full
# Install dependencies
RUN apt-get update && apt-get install -y \
git \
cmake \
build-essential \
python3-pip \
python3-venv \
python3-colcon-common-extensions \
clang \
lldb \
ninja-build \
libgtest-dev \
libeigen3-dev \
libopencv-dev \
libyaml-dev \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-good \
gstreamer1.0-tools \
sudo \
wget \
curl \
tmux \
ruby \
tmuxinator
# Install PX4
RUN cd /root && \
git clone https://github.com/PX4/PX4-Autopilot.git --recursive && \
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh && \
cd PX4-Autopilot && \
make px4_sitl
# Setup Micro XRCE-DDS Agent & Client
RUN cd /root && \
git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git && \
cd Micro-XRCE-DDS-Agent && \
mkdir build && \
cd build && \
cmake .. && \
make && \
make install && \
ldconfig /usr/local/lib/
# Build ROS 2 Workspace ws_sensor_combined
RUN mkdir -p /root/ws_sensor_combined/src && \
cd /root/ws_sensor_combined/src && \
git clone https://github.com/PX4/px4_msgs.git && \
git clone https://github.com/PX4/px4_ros_com.git && \
/bin/bash -c "source /opt/ros/humble/setup.bash && cd /root/ws_sensor_combined && colcon build"
# Build ROS 2 Workspace ws_offboard_control
RUN mkdir -p /root/ws_offboard_control/src && \
cd /root/ws_offboard_control/src && \
git clone https://github.com/PX4/px4_msgs.git && \
git clone https://github.com/PX4/px4_ros_com.git && \
/bin/bash -c "source /opt/ros/humble/setup.bash && cd /root/ws_offboard_control && colcon build"
# Install Python requirements. If you don't have gpu, uncomment next line -torch cpu installation-
# RUN pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
RUN pip3 install \
mavsdk \
aioconsole \
pygame \
opencv-python \
ultralytics
RUN apt-get install -y ros-humble-ros-gzgarden
# Related to mismatch between numpy 2.x and numpy 1.x
RUN pip3 uninstall -y numpy
# Copy models and worlds from local repository
RUN mkdir -p /root/.gz/fuel/fuel.ignitionrobotics.org/openrobotics/models/
COPY . /root/PX4-ROS2-Gazebo-YOLOv8
COPY models/. /root/.gz/models/
COPY models_docker/. /root/.gz/fuel/fuel.ignitionrobotics.org/openrobotics/models/
COPY worlds/default_docker.sdf /root/PX4-Autopilot/Tools/simulation/gz/worlds/default.sdf
# Modify camera angle
RUN sed -i 's|<pose>.12 .03 .242 0 0 0</pose>|<pose>.15 .029 .21 0 0.7854 0</pose>|' /root/PX4-Autopilot/Tools/simulation/gz/models/x500_depth/model.sdf
# Additional Configs
RUN echo "source /root/ws_sensor_combined/install/setup.bash" >> /root/.bashrc && \
echo "source /opt/ros/humble/setup.bash" >> /root/.bashrc && \
echo "export GZ_SIM_RESOURCE_PATH=/root/.gz/models" >> /root/.bashrc
# Copy tmuxinator configuration
COPY px4_ros2_gazebo.yml /root/.config/tmuxinator/px4_ros2_gazebo.yml
# Set up tmuxinator
RUN echo "export PATH=\$PATH:/root/.local/bin" >> /root/.bashrc
# Set default command to start tmuxinator
CMD ["tmuxinator", "start", "px4_ros2_gazebo"]