-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathDockerfile.ros
More file actions
142 lines (121 loc) · 4.74 KB
/
Copy pathDockerfile.ros
File metadata and controls
142 lines (121 loc) · 4.74 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
ARG ROS_DISTRO
FROM ros:$ROS_DISTRO-ros-base
WORKDIR /workspace
ENV DEBIAN_FRONTEND "noninteractive"
RUN apt-get update; \
if [ "$ROS_DISTRO" = "melodic" ]; then \
apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-rosbridge-suite \
python-setuptools \
python3-setuptools \
python-wheel \
python3-wheel \
python-pip \
python3-pip \
&& python2 -m pip install --upgrade pip \
&& python3 -m pip install --upgrade pip; \
elif [ "$ROS_DISTRO" = "noetic" ]; then \
apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-rosbridge-suite \
python-is-python3 \
python3-setuptools \
python3-wheel \
python3-pip \
&& python3 -m pip install --upgrade pip; \
elif [ "$ROS_DISTRO" = "foxy" ]; then \
apt-get install -y --no-install-recommends \
# TODO: This should be installed by rosdep
python3-opencv \
python3-setuptools \
python3-wheel \
python3-pip \
&& python3 -m pip install --upgrade pip; \
fi; \
rm -rf /var/lib/apt/lists/*
ENV CARLA_ROOT "/workspace/CARLA"
ENV SCENARIO_RUNNER_ROOT "/workspace/scenario_runner"
ENV LEADERBOARD_ROOT "/workspace/leaderboard"
ENV CARLA_ROS_BRIDGE_ROOT "/workspace/carla_ros_bridge"
ENV TEAM_CODE_ROOT "/workspace/team_code"
COPY PythonAPI ${CARLA_ROOT}/PythonAPI
COPY scenario_runner ${SCENARIO_RUNNER_ROOT}
COPY leaderboard ${LEADERBOARD_ROOT}
COPY carla_ros_bridge/carla_ros_bridge ${CARLA_ROS_BRIDGE_ROOT}/src/carla_ros_bridge
COPY carla_ros_bridge/carla_common ${CARLA_ROS_BRIDGE_ROOT}/src/carla_common
COPY carla_ros_bridge/carla_msgs ${CARLA_ROS_BRIDGE_ROOT}/src/carla_msgs
COPY carla_ros_bridge/ros_compatibility ${CARLA_ROS_BRIDGE_ROOT}/src/ros_compatibility
COPY team_code ${TEAM_CODE_ROOT}
# Install carla ros bridge
RUN /bin/bash -c 'source /opt/ros/$ROS_DISTRO/setup.bash; \
apt-get update && rosdep update; \
cd /workspace/carla_ros_bridge; \
rm -rf build devel install log; \
rosdep install --from-paths src --ignore-src -r -y; \
if [ "$ROS_VERSION" = "1" ]; then \
catkin_make install -DCMAKE_INSTALL_PREFIX=/opt/ros/$ROS_DISTRO; \
else \
colcon build; \
fi; \
rm -rf build devel log; \
rm -rf /var/lib/apt/lists/*'
#colcon build --merge-install --install-base /opt/ros/$ROS_DISTRO; \
#catkin_make install --only-pkg-with-deps carla_ros_bridge -DCMAKE_INSTALL_PREFIX=/opt/ros/melodic'
# Install agent
RUN /bin/bash -c 'source /opt/ros/$ROS_DISTRO/setup.bash; \
apt-get update && rosdep update; \
cd /workspace/team_code; \
rm -rf build devel install log; \
rosdep install --from-paths src --ignore-src -r -y; \
if [ "$ROS_VERSION" = "1" ]; then \
catkin_make install; \
else \
colcon build; \
fi; \
rm -rf build devel log; \
rm -rf /var/lib/apt/lists/*'
RUN mkdir -p /workspace/results
RUN chmod +x /workspace/leaderboard/run_leaderboard.sh
ENV PYTHONPATH "${CARLA_ROOT}/PythonAPI/carla":"${SCENARIO_RUNNER_ROOT}":"${LEADERBOARD_ROOT}":${PYTHONPATH}
RUN if [ "$ROS_DISTRO" = "melodic" ]; then \
echo "${CARLA_ROOT}/PythonAPI/carla/dist/carla-leaderboard-py2.7.egg" > /usr/local/lib/python2.7/dist-packages/carla.pth; \
echo "${CARLA_ROOT}/PythonAPI/carla/dist/carla-leaderboard-py3x.egg" > /usr/local/lib/python3.6/dist-packages/carla.pth; \
else \
echo "${CARLA_ROOT}/PythonAPI/carla/dist/carla-leaderboard-py3x.egg" > /usr/local/lib/python3.8/dist-packages/carla.pth; \
fi
RUN pip3 install \
transforms3d \
roslibpy \
pexpect \
networkx \
numpy \
py_trees==0.8.3 \
psutil \
shapely \
six \
dictor \
requests \
ephem \
tabulate \
simple-watchdog-timer
############################################################################################
#### BEGINNING OF AGENT SPECIFIC COMMANDS ####
############################################################################################
ENV TEAM_AGENT ${TEAM_CODE_ROOT}/my_ros_agent.py
ENV CHALLENGE_TRACK_CODENAME MAP
############################################################################################
#### END OF AGENT SPECIFIC COMMANDS ####
############################################################################################
ENV ROUTES ${LEADERBOARD_ROOT}/data/routes_training.xml
ENV REPETITIONS 1
ENV CHECKPOINT_ENDPOINT /workspace/results/results.json
ENV DEBUG_CHALLENGE 0
# Agent sources
RUN /bin/echo \
'source /opt/ros/$ROS_DISTRO/setup.bash; \
if [ "$ROS_VERSION" = "2" ]; then \
source $CARLA_ROS_BRIDGE_ROOT/install/setup.bash; \
fi; \
source $TEAM_CODE_ROOT/install/setup.bash;' >> ${HOME}/agent_sources.sh
COPY agent_entrypoint.sh /
ENTRYPOINT ["/agent_entrypoint.sh"]
CMD ["/bin/bash"]