Skip to content

Latest commit

 

History

History
298 lines (233 loc) · 8.6 KB

README.md

File metadata and controls

298 lines (233 loc) · 8.6 KB


Carla Apollo Bridge

Carla & Apollo Co-simulation
View Demo · Report Bug · Request Feature

About Carla Apollo Bridge

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)

image

Getting Started

Prerequisites

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

Build And Run Apollo

  1. 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
  2. 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/

Run Carla

  • 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 apollo_carla_bridge

  1. Run and enter docker

    cd apollo_carla_bridge/docker
    ./build_docker.sh
    ./run_docker.sh
    docker exec -ti carla_cyber_0.9.13 bash
  2. 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
  3. 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

Result

If you successfully built and ran, you should see this in Apollo client:

image

and this in Carla:

image

Usage

  1. Open apollo client: http://localhost:8888
  2. (Optional) Select "Task" in the sidebar and turn on "Camera Sensor" in "Others".
  3. (Optional) Select "Layer Menu" in the sidebar and turn on "Point Cloud" in "Perception".
  4. Select "Module Controller" in the sidebar and turn on "Routing" module.
  5. Select "Route Editing" in the sidebar.
  6. Click "Add Point of Interest" and left click at any point on the road to set the destination.
  7. Click "Send Routing Request".
  8. Select "Tasks" and click "Setup" to start co-simulation.

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

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.

Acknowledgments

The co-simulation is modified on the basis of the following, thank you here.

(back to top)