Running SVL Simulator#

Before running SVL Simulator make sure to go through the guide for installing and starting it for the first time. This guide assumes that SVL Simulator is installed and you are ready to run a simulation. This guide will walk you through the steps of adding assets from the Store to My Library, and creating and running following types of simulations:

  1. A random interactive simulation
  2. An API-only simulation
  3. A Python Test Case simulation
  4. A Visual scenario editor based simulation

Table of Contents

Video top#


Add Assets from the Store top#

  1. Click tabs under Store to view available maps, vehicles, and sensors that are available for you to use. You'll need to add maps and vehicles from the Store to your own library (or upload maps and vehicles of your own) before you can use them in a simulation.

    Scroll through the list of all Free maps available, or click Trending to see most commonly downloaded maps or click Shared with me to see private maps shared to you by other users.

    Locate the BorregasAve map and click "+" to add it to your library if not already added (for Random Interactive Simulation below).

    Locate the SanFrancisco map and click "+" to add it to your library if not already added (for Python Test Case Simulation below).

    public-library

  2. Click any tab under Store (if needed) to return to the Store view.

    Scroll through the list of all Free vehicles available, or click Trending to see most commonly downloaded maps or click Shared with me to see private maps shared to you by other users.

    Locate the Lincoln2017MKZ vehicle and click "+" to add it to your library if not already added (for Random Interactive Simulation or Python Test Case Simulation below).

    Locate the added vehicle in your library and click on the "Apollo 5.0" sensor configuration to confirm if there are any missing sensors in your library (for Random Interactive Simulation below).

    missing-sensors

    Locate the added vehicle in your library and click on the "Apollo 5.0 (full analysis)" sensor configuration to confirm if there are any missing sensors in your library (for Python Test Case Simulation below).

    If any sensors are missing, then locate them under "Sensors" tab under Store and add them to your library OR follow the instructions on the sensor configuration page.

    NOTE: All test scripts load map by name or UUID and vehicle's sensor configuration by UUID. So take care to add the specific vehicles, sensors and maps to your library that are needed for the scripts or test cases that you intend to run. Please use UUID instead of name in your Python Test Case scripts. You can get UUID from the url when you open the asset profile in your browser.

    map-uuid

    sensor-configuration-uuid1

    sensor-configuration-uuid2

Review Assets in your Library top#

  1. Click Library and then click Maps, Vehicles and Sensors to view the map, vehicle and sensors that you just added to your library.

    NOTE: You may notice some maps, vehicles and sensors in your library that you did not explicitly add; these were automatically added when your account was created.

    mylibrary-maps

Create and run a random interactive simulation top#

In this section we will create an Interactive Mode simulation which allows you to control the vehicle and interact with the environment while the simulation is running. Random Traffic Scenarios are simulations in which NPCs and pedestrians exhibit randomly generated behavior. This random behavior is deterministic, meaning that the same behavior will be repeated if the same random seed is used in the simulation set up.

  1. Click Simulations. Click Add New to create a new simulation.

    simulations-tab

  2. On the New Simulation General pane, enter a name for your new simulation (e.g. "Random Interactive"), and select the cluster you created during installation (e.g. "local-sim") from the cluster list.

    Click the switch next to Interactive mode to enable interactive mode for this simulation, if you wish to be able to play/pause the simulation and change settings after the simulation has started.

    Click the switch next to Headless mode if you do not wish the simulation to be rendered on the screen.

    Click the switch next to Create test report to enable cloud to create a test report at the end of simulation run with analytics and event data from sensors on your vehicle.

    Click the Next button to advance to the Test Case pane.

    simulation-general-random-interactive

  3. On the New Simulation Test Case pane, select Random Traffic from the Runtime Template list.

    Next select the BorregasAve map, the Lincoln2017MKZ vehicle and Apollo 5.0 sensor configuration from the dropdown lists.

    IMPORTANT: If you have not already added a Map, Vehicle or needed Sensors to your library, refer to the Store above for information on how to add them.

    (Optional) Click + Add another vehicle to add additional Ego vehicles. Note that each ego vehicle will need to be controlled by a separate AD stack and must have it's own bridge connection which would be specified in the Autopilot tab.

    You could also specify date, time, and environmental settings here but since we are creating an interactive simulation those can interactively be modified while the simulation is running.

    Click the switches next to Random Traffic and Random Pedestrians to enable these NPCs (non-player characters) in this random simulation.

    The Random Bicyclists feature is not yet supported and will be available in future releases.

    Enable Use Pre-defined Seed and manually enter a number to be used as the seed for all random behavior in the simulator. Using a pre-defined seed makes it possible to have deterministic and repeatable random simulations.

    Click the Next button to advance to the Autopilot pane.

    simulation-testcase-random-done

  4. On the New Simulation Autopilot pane, select Apollo 5.0 from the Autopilot list.

    For all ego vehicles in your simulation, enter the details of where can simulator connect to Autopilot.

    In the Bridge IP, enter "localhost:9090" or you can replace "localhost" with the IP address of your autopilot system if it is different from the machine on which SVL Simulator is running.

    Click the Next button to advance to the Publish pane.

    simulation-autopilot-done

  5. On the New Simulation Publish pane, click Publish to save (and publish) the simulation to your library. The simulation will be private and only accessible from your account.

    simulation-publish

  6. You should now see the Simulations view, with the newly created Random Interactive simulation.

    The simulation should indicate Idle as shown.

    If instead it says Offline, return to the SVL Simulator program window and click the Online button from drop-down menu on top-right corner to re-connect the simulator to the cloud. You can then switch back to the SVL Simulator browser window or click Open Browser in the Simulator (and then click Simulations to return to the Simulations view).

    To run the random interactive simulation you just created, click Run Simulation.

    mysimulations

  7. Switch back to the SVL Simulator and you may see a message indicating that any newly added maps, vehicles and sensors are downloading, after which the simulation should initialize.

    Since this is an interactive simulation, click the Play button at the bottom left corner of the screen to begin the simulation. You should see the random traffic driving and random pedestrians walking.

    Click the joystick icon at the bottom of the screen to get a list of keyboard controls. Click the settings icon to adjust the Environment settings. Click the eye icon to enable or disable individual sensor visualizations.

    simulator-random-interactive

  8. If Apollo 5.0 is available and running, then SVL Simulator should connect to the Apollo bridge, and Apollo should be able to drive the ego vehicle in it. Refer to Running Apollo 5.0 with SVL Simulator for more information.

  9. To stop the simulation, switch back to the SVL Simulator browser window, click Simulations and click Stop Simulation.

API Only Simulation top#

In this section we will create an API Only simulation which allows you to control the simulation from the command line using a Python script or Python scenario runner.

  1. Click Simulations. Click Add New to create a new simulation.

    simulations-tab

  2. On the New Simulation General pane, enter a name for your new simulation (e.g. "API Only Mode"), and select the cluster you created during installation (e.g. "local-sim") from the cluster list.

    Click the switch next to Create test report if you wish to generate a test report to review for each simulation.

    Click the Next button to advance to the Test Case pane.

    simulation-general-apionly

  3. On the New Simulation Test Case pane, select API Only from the Runtime Template list.

    In API Only mode, there are no additional parameters to specify.

    Click the Next button to advance to the Autopilot pane.

    Click the Next button to advance to the Publish pane.

    simulation-testcase-apionly

  4. On the New Simulation Publish pane, click Publish to save (and publish) the simulation to your library. The simulation will be private and only accessible from your account.

    simulation-publish-apionly

  5. You should now see the Simulations view, with the newly created API Only simulation.

    The simulation should indicate Idle as shown.

    If instead it says Offline, return to the SVL Simulator program window and click the Online button in drop-down menu on top-right corner to re-connect SVL Simulator to the cloud. You can then switch back to the SVL Simulator browser window or click Open Browser in the Simulator (and then click Simulations to return to the Simulations view).

    To run the API Only simulation you just created, click Run Simulation.

    mysimulations-apionly

  6. Switch back to the SVL Simulator and you may see a message "API ready!" indicating that simulator is ready to connect to your API script.

  7. You may now control the simulation using any Python script. Refer to Python API for information on using the Python API to control simulation.

  8. To stop the simulation, switch back to the SVL Simulator browser window, click Simulations and click Stop Simulation.

Creating and running a Python Test Case Simulation top#

In this section we will create and run a Python Test Case simulation available under "Available from Others" view in Simulations tab.

Note that Python Test Case simulation currently requires the binary build of the latest SVL Simulator running on Linux. Contact us if you need to use this with a self-built or editor build of SVL Simulator.

  1. Click Simulations tab and then switch to Available from Others view to see simulations that are available for you to use.

    public-library-simulations

  2. Type test-case into the search field and hit enter to show available test-case simulations.

    Locate the "Cut-in Scenario" simulation and click on it to view the details.

    You could of course select any test-case or other simulation that matches the autopilot software and version that you might be using, but this test-case simulation will work fine to demonstrate how to create a test-case simulation.

    public-library-test-cases

  3. Click Customize and Add Simulation button to add it to your library.

    public-library-cut-in

    Known Issue: Currently, Customize and Add Simulation doesn't clone the settings of "Create Test Report" button and "Sensor Configuration" value under vehicle to the new simulation.

  4. On the simulation General pane, you may customize the name of the simulation, description, and tags (if desired) but it is not necessary to do so.

    Select the cluster you created during installation (e.g. "local-sim") from the cluster list.

    Click the switch next to Create test report to generate a test report to review after running this simulation.

    Click the Next button to advance to the Test Case pane.

    simulation-general-cutin

  5. On the simulation Test Case pane, you will be see the Python script that controls this test case.

    Review the Python script and take note of the map specified in the sim.load statement (e.g. SanFrancisco) as well as the ego vehicles' sensor configurations specified in ego = sim.add_agent statements (e.g. Lincoln2017MKZ vehicle with Apollo 5.0 (full analysis) sensor configuration). Make sure that these appear in the Map, Vehicle and Sensor configuration fields. If they are not present in the drop down menus, add them to your library following the instructions in Store above.

    For this cut-in scenario simulation, there are no additional parameters to specify.

    Click the Next button to advance to the Autopilot pane, select Apollo 5.0 from the Autopilot list.

    In the Bridge IP, enter "localhost:9090" or you can replace "localhost" with the IP address of your autopilot system if it is different from the machine on which SVL Simulator is running.

    Click the Next button to advance to the Publish pane.

    simulation-testcase-cutin

  6. On the simulation Publish pane, click "Publish" to save (and publish) the simulation to your library. The simulation will be private and only accessible from your account.

    simulation-publish-cutin

  7. You should now see the Simulations view, with the newly created Cut-in Scenario simulation.

    The simulation should indicate Idle as shown.

    If instead it says Offline, return to the SVL Simulator program window and click the Online button in the drop-down menu on top right corner to re-connect SVL Simulator to the cloud. You can then switch back to the SVL Simulator browser window or click Open Browser in the Simulator (and then click Simulations to return to the Simulations view).

    To run the Cut-in Scenario simulation you just created, click Run Simulation.

    mysimulations-cutin

  8. Switch back to the SVL Simulator and you may see a message indicating that any newly added maps, vehicles and sensors are downloading, after which the simulation should initialize.

  9. At this point you should configure Apollo in Dreamview for the correct map and vehicle, enable the required modules, set a destination point, and send a routing request. Refer to Python Test Cases and Apollo 5.0 or Apollo master if needed for information on executing test case scenarios like cut-in with Apollo.

  10. The simulation should stop automatically when finished (or if it times out). When the simulation is finished, switch back to the SVL Simulator browser window.

  11. Click Test Results to view results of simulation runs.

    testresults-summary

  12. Review the list of test results and click View to view test results from a specific simulation run. testresults-cutin-report

  13. Troubleshooting tips for Python runtime template based simulations

    If python script throws errors in simulation, follow guide here.

    Many examples of pythonAPI runtime scenarios can be found in PythonAPI repository on github. You can also find a quick example script here.

    For Python API simulation to work properly, it should include proper environment variables.

Creating and running a Visual Scenario Editor based Simulation top#

In this section we will create and run a Visual Scenario Editor based simulation.

Note that Visual Scenario Editor based simulation currently requires the binary build of the latest SVL Simulator running on Linux. Contact us if you need to use this with a self-built or editor build of SVL Simulator.

  1. Launch SVL Simulator binary and create a scenario using Visual Scenario Editor and save the scenario as "sample-vse-test-case.json".

  2. Now on the web UI, click Simulations tab in the left panel. Click Add New to create a new simulation.

    simulations-tab

  3. On the New Simulation General pane, enter a name for your new simulation (e.g. "VSE Simulation"), and select the cluster you created during installation (e.g. "local-sim") from the cluster list.

    Click the switch next to Interactive mode to disable interactive mode for this simulation as we want the runner to control the simulation execution automatically.

    Click the switch next to Create test report to enable cloud to create a test report at the end of simulation run with analytics and event data from sensors on your vehicle.

    Click the Next button to advance to the Test Case pane.

    simulation-general-vse.png

  4. On the New Simulation Test Case pane, select Visual scenario editor from the Runtime Template list.

    Next select the cloud shaped upload button for "Scenario" field and upload the Visual scenario editor created json file "sample-vse-test-case.json"

    Next make sure that map is automatically set properly to what you used when creating the scenario in Visual scenario editor tool. eg: BorregasAve

    Next make sure that vehicle is automatically set to what you used when creating the scenario in Visual scenario editor tool. eg: Lincoln2017MKZ vehicle and Apollo 5.0 sensor configuration

    IMPORTANT: If you have not already added a Map, Vehicle or needed Sensors to your library, refer to the Store above for information on how to add them.

    You could also specify date, time, and environmental settings here.

    Click the Next button to advance to the Autopilot pane.

    simulation-testcase-vse-done

  5. On the New Simulation Autopilot pane, select Apollo 5.0 from the Autopilot list.

    In the Bridge IP, enter "localhost:9090" or you can replace "localhost" with the IP address of your autopilot system if it is different from the machine on which SVL Simulator is running.

    Click the Next button to advance to the Publish pane.

    simulation-autopilot-done

  6. On the New Simulation Publish pane, click Publish to save (and publish) the simulation to your library. The simulation will be private and only accessible from your account.

    simulation-publish

  7. You should now see the Simulations view, with the newly created Visual scenario editor based simulation.

    The simulation should indicate Idle as shown.

    If instead it says Offline, return to the SVL Simulator program window and click the Online button from drop-down menu on top-right corner to re-connect the simulator to the cloud. You can then switch back to the SVL Simulator browser window or click Open Browser in the Simulator (and then click Simulations to return to the Simulations view).

    To run the Visual scenario editor based simulation you just created, click Run Simulation.

    vse-simulation-ready

  8. Switch back to the SVL Simulator and you may see a message indicating that any newly added maps, vehicles and sensors are downloading, after which the simulation should initialize.

    Since this is Visual scenario editor based simulation, "TestCaseRunner" in background will take care of configuring, enabling & disabling the Autopilot automatically.

  9. If Apollo 5.0 is available and running, then SVL Simulator should connect to the Apollo bridge, and Apollo should be able to drive the ego vehicle in it. Refer to Running Apollo 5.0 with SVL Simulator for more information.

  10. The simulation should stop automatically when finished (or if it times out or errors). When the simulation is finished, switch back to the SVL Simulator browser window.

  11. Click Test Results to view results of simulation runs.

    vse-testresults-summary

  12. Review the list of test results and click View to view test results from a specific simulation run. testresults-vse-report

  13. Known issues with Visual scenario editor based simulations

    • The TestCaseRunner for VSE won't turn off apollo modules when the scenario finishes. You need to disable the modules once you finish the testing.
    • If your VSE based simulation is not working correctly, please make sure apollo has corresponding HD maps (HD map folder name should match the map name) and vehicle calibration files, and bridge is running.
    • Visual scenario editor template simulations with Autopilot only work on Linux at the moment. We are working on adding the Windows support.
    • VSE based simulations only support Apollo 5.0 and above at the moment as it is based on dreamview-python-api.