Skip to content

Instantly share code, notes, and snippets.

@lemketron
Last active March 30, 2021 08:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lemketron/7b91b8f2c3231f10f599f9acdff76764 to your computer and use it in GitHub Desktop.
Save lemketron/7b91b8f2c3231f10f599f9acdff76764 to your computer and use it in GitHub Desktop.

LGSVL Simulator and Apollo

New Simulation Tools for Training and Testing AVs

(Updated 3/26/2021 for http://av-test-challenge.org/ and archived 2020.06 docs on svlsimulator.com)

Refer to related video or slides for additional information

Video on YouTube: https://www.youtube.com/watch?v=Ucr0aM334_k

Slides: https://drive.google.com/file/d/19YPKLaYiQy5ronsedQiJRIaPimwSAzc6/view

Intro

Presented by Steve Lemke, Principal Engineer @ LG America R&D Lab

Outline

  1. Introduction and features of the Simulator (slides 2-13)
  2. Installation of the Simulator (slides 14-16)
  3. Getting Started, User Interface, Configuration (slides 17-24 and hands-on)
  4. Installing, Building, and Running Apollo (hands-on)
  5. Automation and Python API (hands-on)
  6. Advanced Topics (tutorial videos)
  7. Additional Information (slide 25)

Key Features

  • Unity 3D engine
    • High Definition Render Pipeline
    • Physics-based modeling of multiple lighting sources
  • Out of the box integration with Apollo, Autoware.AI and Autoware.Auto (and other AD stacks)
  • ROS, ROS2, CyberRT bridges (and other bridges via customized plugin)
  • Physical Sensors: Cameras, LiDAR, Radar, GPS, IMU, etc.
  • Virtual Sensors: 2D and 3D Ground Truth, Depth and Segmentation Cameras
  • Road/map annotation editor
    • Import of HD maps from: Lanelet2, OpenDRIVE, Apollo
    • Export of HD maps to: Lanelet2, Autoware Vector, OpenDRIVE, Apollo

Goal: Understand simulator requirements and installation

  1. System Requirements

    • 4GHz Quad core CPU
    • Nvidia GTX-1080 (8GB memory)
    • Windows 10 64-bit (or Ubuntu ~18.04)
  2. GPU drivers and libraries

    • Install latest Nvidia drivers
    • Install libvulkan (on Linux)
    • Install nvidia-smi (on Linux)
  3. Downloading and installing

  4. Building from source

    • Download and install Unity Hub
    • Download and install Unity 2019.3.3f1
    • Download and install Node.js
    • Verify git-lfs installation
    • Clone simulator source from GitHub
    • More on this later in "Advanced Topics"

Goal: Understand simulator user interface for configuring maps, vehicles, and other settings

  1. Basic simulator concepts: Refer to Getting Started doc or the lecture slides

    1. Maps

    2. Vehicles

      • There are several pre-loaded reference vehicles including:
        • Jaguar2015XE
        • Lexus2016RXHybrid
          • We could just change bridge type but instead let's create a new vehicle:
      • Navigate to content site: https://content.lgsvlsimulator.com/
        • Scroll to "Vehicles" and click "View All"
        • Click on Lexus RX 2016
        • Right-click to copy Asset Bundle link location
        • Close Lexus browser window
        • Return to LGSVL Vehicles web UI
      • Click "Add New" vehicle
        • Enter Vehicle Name: Lincoln2017MKZ (Apollo master)
        • Paste copied URL
        • Click "Submit" to save new vehicle
      • Navigate to example Apollo json config
        • Scroll to "Complete JSON Configuration" field
        • Click "Copy" to copy JSON Configuration text
      • Click wrench icon to edit vehicle configuration
        • Select Bridge Type: CyberRT
        • Paste copied JSON Configuration text into "Sensors" field
        • Click "Submit" to save vehicle configuration
    3. Clusters

    4. Simulations

      • BorregasAve (with Apollo)
        • We could just select our new vehicle but let's create a new simulation:
      • Click "Add New" Simulation
        • General tab:
          • Enter Simulation Name: AVS Apollo master
          • Select Cluster: Local Machine
          • API Only: leave unchecked
          • Headless Mode: leave unchecked
        • Map & Vehicles tab:
          • Interactive Mode: check this for interactive controls
          • Select Map: BorregasAve
          • Select Vehicle: Lincoln2017MKZ (Apollo master)
          • Enter "Bridge Connection String": localhost:9090
          • We could click "+" to add additional ego vehicles/bridges
        • Traffic tab:
          • Use Predetermined Seed: leave unchecked
          • Random Traffic: check to have NPC vehicles spawn at beginning of simulation
          • Random Pedestrians: check to have pedestrians spawn at beginning of simulation
        • Weather tab:
          • Set time of day during simulation
          • Set rain, wetness, fog, and cloudiness
        • Click "Submit" to save new simulation
  2. How to start simulation

    • Click in Lincoln2017MKZ (Apollo master) to select simulation (indicated by check mark)
    • Click "Play" icon to begin simulation
  3. Controlling the simulator

    1. Start/Pause Simulation (only necessary in Interactive Mode)
      • Click "Play" button
    2. Show Menu Layer
      • Click "Menu" button (if NON-Interactive Mode)
    3. Information
      • Build information, and logged warnings and errors
    4. Controls
    5. Bridge Info
      • Bridge address, status, and topic list
    6. Environment (only in Interactive Mode)
    7. Visualize
      • Color, Depth, Semantic Cameras
      • LiDAR, RADAR
      • 2D and 3D Ground Truth

Goal: Learn how to use the simulator with Apollo autonomous driving software

  1. Setup Apollo

  2. Run Simulator alongside Apollo

  • Launch Cyber bridge

    ```bash
    ./scripts/bridge.sh
    ```
    
  • Start (resume) the LGSVL Simulator:

    • Note this is LGSVL Simulator, downloaded from LGSVLSimulator.com, version 2020.05
    • Launch the executable and click on the button to open the web UI
    • Click "Simulations" to view the available/configured simulations
    • Click in AVS Apollo master simulation to select it (indicated by check mark)
    • Click "Play" icon to begin simulation
  • Use cyber_monitor to view messages, and use cyber_visualizer to visualize them

  1. Run Apollo modules
  • Start Dreamview

    ```bash
    ./scripts/bootstrap_lgsvl.sh
    ```
    
  • Open Dreamview in a browser by navigating to: localhost:8888

  • Select correct "setup mode", "vehicle", and "map"

    • For setup mode: select Mkz Lgsvl;
    • For vehicle: select Lincoln2017MKZ LGSVL;
    • For map: select Borregas Ave
  • Open the Module Controller tap (on the left bar).

  • Enable Localization, Transform, Perception, Traffic Light, Planning, Prediction, Routing, and Control modules.

  • Navigate to the Route Editing tab.

  • Select a destination by clicking on a lane line and clicking Submit Route.

Goal: Learn how to control the simulator using the Python API

  1. Controlling environment using Python API

  2. Quickstart

    • Select pythonapi (virtual environment)

      • Check out virtualenvwrapper
      • Create virtualenv with: mkvirtualenv -p python3 pythonapi
      • Activate with: workon pythonapi
    • Download and Install Python API

       cd ~
       git clone https://github.com/lgsvl/PythonAPI.git
       cd PythonAPI
       pip3 install --user -e .

      (Leave out --user if working in a python virtual environment)

    • Launch Simulator

    • Review "API Only" Simulation settings

    • Start "API Only" mode simulation

      • "Open Browser..." changes to "API Ready!"
    • Let's try one of the quickstart scripts to confirm that everything is working:

       ./quickstart/05-ego-drive-in-circle.py
  3. Core Concepts: Simulator and Agents

    • Show doc page; intro to Python API concepts

Goal: Build the simulator from source, plus create new environments, vehicles, and sensors

  1. Running Simulator with Autoware.Auto and ROS2

  2. Building Simulator from source in Unity

  3. New environment creation

  4. New vehicle creation

  5. New sensor creation

    • Stay tuned for this (and other) new video tutorials (watch the blog)
  6. Map annotation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment