Newer
Older
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
FROM ubuntu:jammy
ARG USERNAME=nx
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ENV HOME=/home/nx
RUN addgroup \
--gid $USER_GID $USERNAME && adduser \
--uid $USER_UID \
--gid $USER_GID \
--disabled-password \
--gecos "$USERNAME user" $USERNAME
ARG DBF=noninteractive
ENV DEBIAN_FRONTEND=${DBF}
ENV MAKEFLAGS=-j4
ARG PW=10
ENV ROS2_DISTRO=humble
ENV ROS2_INSTALL_PATH=$HOME/ros2_humble
RUN mkdir -p $ROS2_INSTALL_PATH/src
ENV ROS2_INSTALL=$ROS2_INSTALL_PATH/install/setup.bash
#### GENERAL LINUX/ROS DEPENDENCIES
RUN apt-get update
RUN apt-get install -y \
build-essential \
cmake \
curl \
git \
gnupg \
locales \
lsb-release \
wget
RUN locale-gen en_US en_US.UTF-8 &&\
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8
#### INSTALL ROS2 HUMBLE FROM SRC
RUN apt install software-properties-common -y
RUN add-apt-repository universe -y
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
# Install additional packages
RUN apt update && apt install -y \
python3-flake8 \
python3-flake8-blind-except \
python3-flake8-builtins \
python3-flake8-class-newline \
python3-flake8-comprehensions \
python3-flake8-deprecated \
python3-flake8-docstrings \
python3-flake8-import-order \
python3-flake8-quotes \
python3-pip \
python3-pytest \
python3-pytest-cov \
python3-pytest-repeat \
python3-pytest-rerunfailures \
python3-rosdep \
python3-setuptools \
ros-dev-tools
# Install colcon from PyPI, rather than apt packages
RUN python3 -m pip install -U colcon-common-extensions vcstool
WORKDIR $ROS2_INSTALL_PATH
# RUN vcs import --input https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos src
# RUN apt upgrade -y
# RUN rosdep init
RUN wget https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos
RUN vcs import src < ros2.repos
RUN sudo rosdep init
RUN rosdep update
RUN rosdep install --from-paths src --ignore-src -y --rosdistro humble --skip-keys "fastcdr rti-connext-dds-6.0.1 urdfdom_headers"
RUN colcon build --symlink-install --parallel-workers $PW
#### INSTALL ROS1 w/ ros-core-dev
RUN rm /etc/apt/sources.list.d/ros2.list && apt-get update -y
RUN apt remove -y \
python3-catkin-pkg \
python3-catkin-pkg-modules
RUN apt update && apt install -y \
ros-core-dev
#### INSTALL ROS2 HUMBLE DEPENDENCIES FROM SRC
ARG ROSV=ros2
# primarily conflict with catkin-pkg-modules (rqd by ros-core-dev)
# systematically discovered ros2 dependencies installed from src
RUN apt install -y \
libboost-python-dev \
libboost-iostreams-dev \
libceres-dev \
libgraphicsmagick++1-dev \
libompl-dev \
libpcl-dev \
libxtensor-dev \
libzmq3-dev \
libgazebo-dev
WORKDIR $HOME
COPY ./rosbridge_general_update_ament.sh .
RUN bash -c "./rosbridge_general_update_ament.sh"
#### COPY CUSTOM_BRIDGE
WORKDIR $HOME
COPY ./custom_bridge_ros1_ws $HOME/custom_bridge_ros1_ws/src
WORKDIR $HOME/custom_bridge_ros1_ws
RUN bash -c "catkin_make"
#### COPY NEW BRIDGE WS
COPY ./custom_bridge_ros2_ws $HOME/custom_bridge_ros2_ws
WORKDIR $HOME/custom_bridge_ros2_ws
RUN bash -c "source $HOME/ros2_humble/install/setup.bash && colcon build --symlink-install"
RUN mkdir -p $HOME/.ros/log && \
chown -R $USERNAME:$USERNAME $HOME/.ros && \
chmod -R 755 $HOME/.ros
RUN chown -R $USERNAME:$USERNAME $HOME/custom_bridge_ros1_ws && \
chmod -R 755 $HOME/custom_bridge_ros1_ws
RUN chown -R $USERNAME:$USERNAME $HOME/custom_bridge_ros2_ws && \
chmod -R 755 $HOME/custom_bridge_ros2_ws
#### INSTALL ROS1_BRIDGE
ARG ROS1_BRIDGE_ROOT_DIR=/ros1_bridge_ws
ENV ROS1_BRIDGE_ROOT_DIR=$ROS1_BRIDGE_ROOT_DIR
ARG ROS1_BRIDGE_INSTALL_DIR=$ROS1_BRIDGE_ROOT_DIR/src
ENV ROS1_BRIDGE_INSTALL_DIR=$ROS1_BRIDGE_INSTALL_DIR
WORKDIR $ROS1_BRIDGE_INSTALL_DIR
RUN git clone https://github.com/ros2/ros1_bridge
# update cmakelist of ros1_bridge to cpp17
RUN sed -i 's/# Default to C++14/# Default to C++17/' ${ROS1_BRIDGE_INSTALL_DIR}/ros1_bridge/CMakeLists.txt
RUN sed -i 's/set(CMAKE_CXX_STANDARD 14)/set(CMAKE_CXX_STANDARD 17)/' ${ROS1_BRIDGE_INSTALL_DIR}/ros1_bridge/CMakeLists.txt
WORKDIR $ROS1_BRIDGE_ROOT_DIR
#### BUILD/COMPILE ROS1_BRIDGE
# RUN bash -c "cd ${HOME}/ht_planner_ws \
# && source ./scripts/rosbridge_source.sh \
# && cd ${ROS1_BRIDGE_ROOT_DIR} \
# && colcon build --packages-select ros1_bridge --cmake-force-configure --parallel-workers $PW \
# "