The AD demo is an example package that provides everything needed to launch a CARLA ROS environment with an AD vehicle.

Before you begin

Install Scenario Runner and follow the Scenario Runner "Getting Started" tutorial to verify that it's working.

Set an environment variable to find the Scenario Runner installation:

export SCENARIO_RUNNER_PATH=<path_to_scenario_runner>

Run the demo

Random route

To start a demo where the ego vehicle follows a randomly generated route, run the following command after you have started a CARLA server:

# ROS 1
roslaunch carla_ad_demo carla_ad_demo.launch

# ROS 2
ros2 launch carla_ad_demo

You can also spawn additional vehicles or pedestrians by executing the following command in another terminal:

cd <CARLA_PATH>/PythonAPI/examples/


Scenario execution

To execute the demo with a predefined scenario, run the following command after you have started a CARLA server:

# ROS1
roslaunch carla_ad_demo carla_ad_demo_with_scenario.launch

# ROS2
ros2 launch carla_ad_demo

Select the example scenario "FollowLeadingVehicle" within the RVIZ Carla Plugin and press "Execute". The ego vehicle gets repositioned and the scenario is processed.

You can specify your own scenarios by publishing to /carla/available_scenarios. The launchfile shows an example of how to do this:

  <node pkg="rostopic" type="rostopic" name="publish_scenarios"
    args="pub /carla/available_scenarios carla_ros_scenario_runner_types/CarlaScenarioList '{ 'scenarios':  
          'name': 'FollowLeadingVehicle',
          'scenario_file': '$(find carla_ad_demo)/config/FollowLeadingVehicle.xosc'
    }' -l"/>