最近配置carla apollo bridge的时候踩了很多坑,写个学习记录备忘,用的是深信科创的开源bridge
https://github.com/guardstrikelab/carla_apollo_bridge
1.安装docker
sudo apt-get install docker.io
2.为了在docker中用显卡,NVIDIA Container Toolkit
curl https://get.docker.com | sh \
&& sudo systemctl --now enable docker
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
3.安装apollo8.0.0
这里要注意是8.0.0,不是8.0
#Using HTTPS
git clone -b v8.0.0 https://github.com/ApolloAuto/apollo.git
安装速度慢的话可以换成gitee的apollo8.0.0镜像。
cd apollo
echo "export APOLLO_ROOT_DIR=$(pwd)" >> ~/.bashrc && source ~/.bashrc
sudo rm -rf /apollo/.cache
bash docker/scripts/dev_start.sh
如果报错说 permission denied 不要用sudo,用sudo会导致docker创建一个名称为root的container,和我们要求不一样,要把当前用户加入docker组,参考
https://blog.csdn.net/weixin_43321041/article/details/120399194
成功的话会显示
[ OK ] Congratulations! You have successfully finished setting up Apollo Dev Environment.
[ OK ] To login into the newly created apollo_dev_lei container, please run the following command:
[ OK ] bash docker/scripts/dev_into.sh
[ OK ] Enjoy!
进入容器
bash docker/scripts/dev_into.sh
编译gpu版本的apollo
./apollo.sh build_gpu
打开dreamview
./scripts/bootstrap.sh
在浏览器中打开
http://localhost:8888/
4.运行carla
git clone https://github.com/guardstrikelab/carla_apollo_bridge.git
拉取carla镜像并运行
cd carla_apollo_bridge/carla_scripts
./docker_run_carla.sh
注意cd到carla_scripts文件夹下再运行,不然会找不到yml文件
5.运行bridge
把carla_bridge文件夹复制到apollo容器内
docker cp carla_bridge <apollo_container_name>:/apollo/modules/carla_bridge
在容器内运行
cd /apollo/modules/carla_bridge
chmod +x install.sh
./install.sh
source ~/.bashrc
python main.py
打开apollo,点击左侧moudle栏,打开routing planning predicting control模块
点击左侧route editing模块,点击Add Point of Interest,点击想要到达的目的地,再点send routing
联合仿真就开始运行了。
如果小车没有动,可以试试把上面四个模块重启一下,然后reset backend data,再选择路径,多试几次应该就行了