Local Automation (CI/CD) Tutorial#

Table of Contents

Overview top#

This documentation describes a tutorial for users to get started with local automation (continuous integration) for SVL Simulator with step-by-step instructions to follow.

The example simulations refered in this tutorial use the ROS 2 Navigation stack (Nav2) to navigate and control a robot autonomously. For a guide to setting up and using the simulator alongside Nav2, please see the Robot simulation with ROS 2 Navigation Stack guide.

Prerequisites top#

Example Simulations top#

Getting Started top#

  1. Launch SVL Simulator

  2. Make sure the above example simulations are configured correctly:

    1. Click on the Open Browser button to launch the simulator Web UI in a web browser

    2. In the Simulations section, locate the Local-Test: Robot Freemode (Nav2) simulation under the Available from Others tab and add it by clicking the Add button

    3. Select your cluster from the dropdown menu in the General tab

    4. Select the LGSeocho map in the Test case tab

    5. Select the LGCloi vehicle with the Navigation2 sensor configuration in the Test case tab

    6. Select the Other ROS 2 Autopilot with your bridge connection address (e.g., localhost:9090) in the Autopilot tab

    7. Click on the Publish button to finish the simulation setup in the Publish tab

    8. Repeat the above steps for the remaining simulations below:

      • Local-Test: Robot Cut-in Scenario (Nav2)
      • Local-Test: Robot Sudden Braking (Nav2)
      • Local-Test: Robot Traffic Cones (Nav2)
    9. Note down the UUID of example simulation

  3. Set up the Local Automation tool following the Local Automation mode) guide

  4. Bring up Nav2 stack locally following the Robot simulation with ROS 2 Navigation Stack guide

  5. Create a new file run.sh on the same directory where the wrapper script is downloaded

  6. Paste the below script with your ACCESS-TOKEN and a desired PATH-TO-LOGFILE:

# Note that this script has been written for Bash

export SVLSIM__ACCESS_TOKEN="<ACCESS-TOKEN>"
LOGFILE="<PATH-TO-LOGFILE>"

# UUIDs for example simulations
declare -r SIMULATIONS="
    6ac9ff51-ef76-46cf-836f-94ced3705937
    0996920f-3be3-4c19-a529-0b08ac1ab679
    5922903a-b766-4ebd-8cd3-c96a255d64a9
    015be758-8f59-480f-be31-c8d79b1becd8
"

# Initialize a CLI session
if result=$(sh svlsim.sh cli initialize 2> ${LOGFILE}); then
    : SUCCESS
else
    echo "ABORT. Failed to initialize a CLI session: ${result}"
    exit 1
fi

# Start simulations
for simulation_id in ${SIMULATIONS}; do
    if result=$(sh svlsim.sh simulation start ${simulation_id} 2>> ${LOGFILE}); then
    echo "[${simulation_id}] Starting..."
    else
    echo "[${simulation_id}] ERROR: ${result}"
    continue
    fi

    while true; do
    sleep 2
    if status=$(sh svlsim.sh simulation check ${simulation_id} 2>> ${LOGFILE}); then
        if [ ${status} != "progressing" ]; then
        echo "[${simulation_id}] Done: ${status}"
        break
        fi
    else
        echo "[${simulation_id}] Abort: ${status}"
        break
    fi
    done
done
  1. Finally, run the script in a terminal:

    $ bash run.sh

  2. On the main window of the simulator, the example simulations should now run one after the other along with Nav2 stack without the need for clicking inside a UI.