Skip to content

This project aims to provide a bridge for communicating between the latest version of Apollo and Carla.

License

Notifications You must be signed in to change notification settings

liuxinxiao/apollo_carla_bridge

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Apollo Carla Bridge

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

About Carla Apollo Bridge

Carla Apollo Bridge aims to provide a bridge for communicating between the latest version of Apollo and Carla. It was tested with Carla 0.9.13 and Apollo master branch (newer than v7.0.0)

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.

    In terminal 1:

    cd /apollo/cyber/carla_bridge
    python carla_cyber_bridge/bridge.py

    In terminal 2:

    cd /apollo/cyber/carla_bridge
    python carla_spawn_objects/carla_spawn_objects.py

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)

About

This project aims to provide a bridge for communicating between the latest version of Apollo and Carla.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.6%
  • Other 0.4%