Running latest Apollo with LGSVL Simulator

This instruction is tested after the last commit enabling LGSVL Simulator with latest Apollo master. Commits after that are assumed to work as well, but not guaranteed.

Big changes have recently been introduced in Apollo master; camera perception may not be working yet, and LiDAR perception is recently able to build but still unstable (and uses a lot of GPU memory making it challenging for Apollo to share an 8GB GPU with the LGSVL Simulator).

For those who used our fork of Apollo 5.0 before: please note the new step to select the correct setup mode in Dreamview.

Table of Contents

Getting Started top#

The guide outlines the steps required to setup Apollo for use with the LGSVL Simulator. If you have not already set up the simulator, please do so first by following the instructions here.

Prerequisites top#

  • Ubuntu 16.04 or later (Ubuntu 18.04 is preferred)
  • Nvidia graphics card (required for Perception)
    • Nvidia proprietary driver (>=410.48) must be installed

Setup top#

Docker top#

Apollo is designed to run out of docker containers. The image will mount this repository as a volume so the image will not need to be rebuilt each time a modification is made.

Installing Docker CE top#

To install Docker CE please refer to the official documentation.

NOTE Apollo does not work if the docker is started with sudo. We suggest following through with the post installation steps.

Installing Nvidia Docker top#

Before installing nvidia-docker make sure that you have an appropriate Nvidia driver installed. To test if nvidia drivers are properly installed enter nvidia-smi in a terminal. If the drivers are installed properly an output similar to the following should appear.

    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 440.64       Driver Version: 440.64       CUDA Version: 10.2     |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |===============================+======================+======================|
    |   0  GeForce GTX 1080    Off  | 00000000:01:00.0  On |                  N/A |
    | 27%   29C    P8     7W / 180W |    579MiB /  8117MiB |      1%      Default |
    +-------------------------------+----------------------+----------------------+

    +-----------------------------------------------------------------------------+    
    | Processes:                                                       GPU Memory |
    |  GPU       PID   Type   Process name                             Usage      |
    |=============================================================================|
    |    0      1745      G   /usr/lib/xorg/Xorg                            40MiB |
    |    0      1862      G   /usr/bin/gnome-shell                          49MiB |
    |    0      4409      G   /usr/lib/xorg/Xorg                           223MiB |
    |    0      4545      G   /usr/bin/gnome-shell                         140MiB |
    |    0      4962      G   ...uest-channel-token=10798087356903621100    27MiB |
    |    0      9570      G   /proc/self/exe                                50MiB |
    |    0     17619      G   ...uest-channel-token=14399957398263092148    40MiB |
    +-----------------------------------------------------------------------------+

The installation steps for nvidia-docker are available at the official repo.

Cloning the Repository top#

Clone latest Apollo using the following command:

git clone https://github.com/ApolloAuto/apollo

Building Apollo and bridge top#

Now everything should be in place to build Apollo. Apollo must be built from the container. To launch the container navigate to the directory where the repository was cloned and enter:

./docker/scripts/dev_start.sh

This should launch the container and mount a few volumes. It could take a few minutes to pull the latest volumes on the first run.

To get into the container:

./docker/scripts/dev_into.sh

Build Apollo (optimized, not debug, with GPU support):

./apollo.sh build_opt_gpu

NOTE The Apollo build may fail on machines with less than 1GB of RAM per CPU core due to aggressive parallelization in the build, as discussed in Apollo issue 7719.

If the build fails, either re-start it until it succeeds, but if it continues to fail (especially when running the linker) then you'll need to address the low memory situation by either adding more memory to your build machine or enabling or increasing available swap space. If your Apollo build is crashing on a 16GB machine with little or no swap, try setting it to 16GB.

Launching Apollo alongside the Simulator top#

Here we only describe only a simple case of driving from point A to point B using Apollo and the simulator.

To launch apollo, first launch and enter a container as described in the previous steps.

  • To start Apollo:

    Note: you may receive errors about dreamview not being build if you do not run the script from the /apollo directory.

./scripts/bootstrap_lgsvl.sh
  • Launch bridge (inside docker container):
./scripts/bridge.sh
  • Run the LG SVL Simulator outside of docker. See instructions in the simulator repository
    • Create a Simulation the BorregasAve map and Lincoln2017MKZ (Apollo 5.0) vehicle
    • Enter localhost:9090 as the Bridge Connection String
    • (Optional) Enable Traffic and Pedestrians
    • (Optional) Set the Time of Day and weather settings
    • Submit the Simulation
    • Select the created Simulation and click "Play"

  • Open Apollo Dreamview in a browser by navigating to: localhost:8888
    • NEW for Apollo Master: Select the Mkz Lgsvl setup mode, from the menu to the left of the vehicle menu.
    • Select the Lincoln2017MKZ LGSVL vehicle and Borregas Ave map in the top right corner.
    • Open the Module Controller tap (on the left bar).
    • Enable Localization, Transform, Perception, Traffic Light, Planning, Prediction, Routing, and Control.
    • Navigate to the Route Editing tab.
    • Select a destination by clicking on a lane line and clicking Submit Route.
    • Watch the vehicle navigate to the destination.
  • To stop the docker container run the dev_start.sh stop script in apollo/docker/scripts in a new terminal (not in the docker container).

  • If you are using ufw, it is easiest to completely disable the firewall to allow connections sudo ufw disable

    • If that is not possible, add the following rules:
      • These are required even if running the simulator and Apollo on the same machine
      • sudo ufw allow 8888
      • sudo ufw allow 9090

Adding a Vehicle top#

Only calibration files for Lincoln 2017 MKZ is included in the latest Apollo at this time. More calibration files map be added later.

Adding an HD Map top#

Only HD map files for Borregas Ave is included in the the latest Apollo at this time. More HD maps may be added later.

You can also download additional maps from here, and manually add them to /apollo/modules/map/data/.

Or you can export your own map from our map annotation tool, name it base_map.bin and then generate routing_map and sim_map following these instructions.