Carla & Apollo Co-simulation
View Demo
·
Report Bug
·
Request Feature
Carla Apollo Bridge aims to provide a data and control bridge for the communication between the latest version of Carla and Apollo. It was tested with Carla 0.9.13 and Apollo master branch (newer than v7.0.0)
We will run Carla and Apollo in docker. Furthermore, NVIDIA Container Toolkit is needed. You can refer to the following link to install NVIDIA Container Toolkit:
Alternatively, simply perform the following steps:
-
docker
sudo apt-get install docker.io
-
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
- Refer to this link:
https://github.com/ApolloAuto/apollo/blob/master/docs/quickstart/apollo_software_installation_guide.md
-
Clone the Apollo repo, please use guardstrike/apollo_carla_bridge branch
# Using SSH git clone --branch guardstrike/apollo_carla_bridge git@github.com:guardstrikelab/apollo.git #Using HTTPS git clone --branch guardstrike/apollo_carla_bridge https://github.com/guardstrikelab/apollo.git
-
Build Apollo
cd apollo echo "export APOLLO_ROOT_DIR=$(pwd)" >> ~/.bashrc && source ~/.bashrc
Then, run:
bash docker/scripts/dev_start.sh
to start Apollo development Docker container.
If you encountered an error, try:sudo rm -rf /apollo/.cache bash docker/scripts/dev_start.sh
After the execution is successful, there will be the following output
[ 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!
Run the command and enter the container:
bash docker/scripts/dev_into.sh
Make the GPU version:
./apollo.sh build_gpu
After successful compilation, the following will be printed:
============================================== [ OK ] Done building apollo. Enjoy! ==============================================
Run the command in the container:
./scripts/bootstrap.sh
Finnaly, open the link in your browser:
http://localhost:8888/
-
Clone apollo_carla_bridge project:
# Using SSH git clone git@github.com:guardstrikelab/apollo_carla_bridge.git #Using HTTPS git clone https://github.com/guardstrikelab/apollo_carla_bridge.git
-
Install docker-compose
sudo apt-get install docker-compose
-
Pull carla image and run
cd apollo_carla_bridge/scripts ./docker_run_carla.sh
-
Run and enter docker
cd apollo_carla_bridge/docker ./build_docker.sh ./run_docker.sh docker exec -ti carla_cyber_0.9.13 bash
-
Compile
Run the following command in the container:
./apollo.sh build_cyber opt
The following information is displayed after the compilation is successful:
[INFO] Skipping revision recording ============================ [ OK ] Build passed! [INFO] Took 61 seconds
-
Run
Run the following command in the container.
cd /apollo/cyber/carla_bridge python carla_cyber_bridge/bridge.py
Start a new terminal and run:
docker exec -ti carla_cyber_0.9.13 bash cd /apollo/cyber/carla_bridge python carla_spawn_objects/carla_spawn_objects.py
If you successfully built and ran, you should see this in Apollo client:
and this in Carla:
- Open apollo client: http://localhost:8888
- (Optional) Select "Task" in the sidebar and turn on "Camera Sensor" in "Others".
- (Optional) Select "Layer Menu" in the sidebar and turn on "Point Cloud" in "Perception".
- Select "Module Controller" in the sidebar and turn on "Routing" module.
- Select "Route Editing" in the sidebar.
- Click "Add Point of Interest" and left click at any point on the road to set the destination.
- Click "Send Routing Request".
- Select "Tasks" and click "Setup" to start co-simulation.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the Apache-2.0 License. See LICENSE.txt
for more information.
In addition, We have kept the LICENSE of project Carla Apollo Bridge in carla_apollo_bridge directory.
The co-simulation is modified on the basis of the following, thank you here.