一、官方的安装教程
Autoware in CARLA
The carla autoware bridge is now hosted and maintained here.
This repository contains a demonstrator of an autoware agent ready to be executed with CARLA.
The carla autoware integration requires CARLA 0.9.10.1. You can download it from here
CARLA autoware agent
The autoware agent is provided as a ROS package. All the configuration can be found inside the carla-autoware-agent
folder.
The easiest way to run the agent is by building and running the provided docker image.
Requirements
- Docker (19.03+)
- Nvidia docker (https://github.com/NVIDIA/nvidia-docker)
Setup
Firstly clone the carla autoware repository, where additional autoware contents are included as a submodule:
git clone --recurse-submodules <https://github.com/carla-simulator/carla-autoware>
Afterwards, build the image with the following command:
cd carla-autoware && ./build.sh
This will generate a carla-autoware:latest
docker image.
Run the agent
- Run a CARLA server.
./CarlaUE4.sh
- Run the
carla-autoware
image:
./run.sh
This will start an interactive shell inside the container. To start the agent run the following command:
roslaunch carla_autoware_agent carla_autoware_agent.launch town:=Town01
CARLA Autoware contents
The autoware-contents repository contains additional data required to run Autoware with CARLA, including the point cloud maps, vector maps and configuration files.
安装过程踩坑记录
官方原版:
ARG AUTOWARE_VERSION=1.14.0-melodic-cuda
FROM autoware/autoware:$AUTOWARE_VERSION
WORKDIR /home/autoware
# Update simulation repo to latest master.
COPY --chown=autoware update_sim.patch ./Autoware
RUN patch ./Autoware/autoware.ai.repos ./Autoware/update_sim.patch
RUN cd ./Autoware \
&& vcs import src < autoware.ai.repos \
&& git --git-dir=./src/autoware/simulation/.git --work-tree=./src/autoware/simulation pull \
&& source /opt/ros/melodic/setup.bash \
&& AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
# CARLA PythonAPI
RUN mkdir ./PythonAPI
ADD --chown=autoware https://carla-releases.s3.eu-west-3.amazonaws.com/Backup/carla-0.9.10-py2.7-linux-x86_64.egg ./PythonAPI
RUN echo "export PYTHON2_EGG=$(ls /home/autoware/PythonAPI | grep py2.)" >> .bashrc \
&& echo "export PYTHONPATH=\$PYTHONPATH:~/PythonAPI/\$PYTHON2_EGG" >> .bashrc
# CARLA ROS Bridge
# There is some kind of mismatch between the ROS debian packages installed in the Autoware image and
# the latest ros-melodic-ackermann-msgs and ros-melodic-derived-objects-msgs packages. As a
# workaround we use a snapshot of the ROS apt repository to install an older version of the required
# packages.
RUN sudo rm -f /etc/apt/sources.list.d/ros1-latest.list
RUN sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key 4B63CF8FDE49746E98FA01DDAD19BAB3CBF125EA
RUN sudo sh -c 'echo "deb http://snapshots.ros.org/melodic/2020-08-07/ubuntu $(lsb_release -sc) main" >> /etc/apt/sources.list.d/ros-snapshots.list'
RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends \
python-pip \
python-wheel \
ros-melodic-ackermann-msgs \
ros-melodic-derived-object-msgs \
&& sudo rm -rf /var/lib/apt/lists/*
RUN pip install simple-pid pygame networkx==2.2
RUN git clone -b '0.9.10.1' --recurse-submodules https://github.com/carla-simulator/ros-bridge.git
# CARLA Autoware agent
COPY --chown=autoware . ./carla-autoware
RUN mkdir -p carla_ws/src
RUN cd carla_ws/src \
&& ln -s ../../ros-bridge \
&& ln -s ../../carla-autoware/carla-autoware-agent \
&& cd .. \
&& source /opt/ros/melodic/setup.bash \
&& catkin_make
RUN echo "export CARLA_AUTOWARE_CONTENTS=~/autoware-contents" >> .bashrc \
&& echo "source ~/carla_ws/devel/setup.bash" >> .bashrc \
&& echo "source ~/Autoware/install/setup.bash" >> .bashrc
CMD ["/bin/bash"]
修改版:
ARG AUTOWARE_VERSION=1.14.0-melodic-cuda
FROM autoware/autoware:$AUTOWARE_VERSION
WORKDIR /home/autoware
# Update simulation repo to latest master.
COPY --chown=autoware update_sim.patch ./Autoware
RUN patch ./Autoware/autoware.ai.repos ./Autoware/update_sim.patch
RUN cd ./Autoware \
&& vcs import src < autoware.ai.repos \
&& git --git-dir=./src/autoware/simulation/.git --work-tree=./src/autoware/simulation pull \
&& source /opt/ros/melodic/setup.bash \
&& AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
# CARLA PythonAPI
RUN mkdir ./PythonAPI
ADD --chown=autoware https://carla-releases.s3.eu-west-3.amazonaws.com/Backup/carla-0.9.10-py2.7-linux-x86_64.egg ./PythonAPI
RUN echo "export PYTHON2_EGG=$(ls /home/autoware/PythonAPI | grep py2.)" >> .bashrc \
&& echo "export PYTHONPATH=\$PYTHONPATH:~/PythonAPI/\$PYTHON2_EGG" >> .bashrc
# CARLA ROS Bridge
# There is some kind of mismatch between the ROS debian packages installed in the Autoware image and
# the latest ros-melodic-ackermann-msgs and ros-melodic-derived-objects-msgs packages. As a
# workaround we use a snapshot of the ROS apt repository to install an older version of the required
# packages.
RUN sudo rm -f /etc/apt/sources.list.d/ros1-latest.list
RUN sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv A4B469963BF863CC
RUN sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 4B63CF8FDE49746E98FA01DDAD19BAB3CBF125EA
RUN sudo sh -c 'echo "deb http://snapshots.ros.org/melodic/2020-08-07/ubuntu $(lsb_release -sc) main" >> /etc/apt/sources.list.d/ros-snapshots.list'
RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends \
python-pip \
python-wheel \
ros-melodic-ackermann-msgs \
ros-melodic-derived-object-msgs \
&& sudo rm -rf /var/lib/apt/lists/*
RUN pip install simple-pid pygame networkx==2.2
RUN git clone https://gitee.com/li-kj05/ros-bridge.git
# CARLA Autoware agent
COPY --chown=autoware . ./carla-autoware
RUN mkdir -p carla_ws/src
RUN cd carla_ws/src \
&& ln -s ../../ros-bridge \
&& ln -s ../../carla-autoware/carla-autoware-agent \
&& cd .. \
&& source /opt/ros/melodic/setup.bash \
&& catkin_make
RUN echo "export CARLA_AUTOWARE_CONTENTS=~/autoware-contents" >> .bashrc \
&& echo "source ~/carla_ws/devel/setup.bash" >> .bashrc \
&& echo "source ~/Autoware/install/setup.bash" >> .bashrc
CMD ["/bin/bash"]
修改的地方有:
- 添加了一个ubuntu nvidia 公钥:
RUN sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv A4B469963BF863CC
- 因为连接问题,将carla-ROS-bridge的github链接改为了gitee链接。