Main Content

exportToRoadRunner

Export trajectory to RoadRunner

Since R2024b

Description

exportToRoadRunner(trajectory) exports the input trajectory trajectory to RoadRunner. The function opens a dialog box in which you must specify the project folder and installation folder to use when opening RoadRunner. For more details about the RoadRunner installation folder and project folders, see the InstallationFolder and ProjectFolder properties of the roadrunner object. The LocalOrigin property of the input Trajectory object sets the world origin of the RoadRunner scene.

example

exportToRoadRunner(trajectory,rrApp) exports the input trajectory trajectory to the RoadRunner instance connected to rrApp.

example

exportToRoadRunner(___,Name=Value) specifies options using one or more name-value arguments in addition to any combination of input arguments from the previous syntaxes. For example, Color="blue" exports a blue color actor to RoadRunner.

rrApp = exportToRoadRunner(___) returns a RoadRunner application as a roadrunner object rrApp using any combination of input arguments from the previous syntaxes.

Note

  • This function requires the Scenario Builder for Automated Driving Toolbox™ support package. You can install the Scenario Builder for Automated Driving Toolbox support package from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

  • To use this function you must install RoadRunner and activate your RoadRunner license interactively. For more information, see Install and Activate RoadRunner (RoadRunner).

Examples

collapse all

Load recorded GPS trajectory data into the workspace.

load("recordedGPSData.mat","X","Y","Z","timestamps")

Create a trajectory object by using the loaded timestamps and xyz-coordinates.

traj = scenariobuilder.Trajectory(timestamps,X,Y,Z);

Smooth the trajectory.

smooth(traj)

Export the trajectory to RoadRunner.

exportToRoadRunner(traj)
Connection status: 1
Connected to RoadRunner Scenario server on localhost:54322, with client id {3c820a6c-2dbb-4d44-acbf-46303fbb8d64}

The exportToRoadRunner function opens a dialog box. Specify the project folder and installation folder, and select OK.

RoadRunner Setup dialog box.

The exportToRoadRunner function exports the trajectory to RoadRunner. Visualize the trajectory exported to RoadRunner.

Trajectory exported to RoadRunner.

Load recorded GPS data into the workspace.

load("recordedGPSData.mat","X","Y","Z","timestamps")

Create a trajectory object by using the loaded timestamps and xyz-coordinates.

traj = scenariobuilder.Trajectory(timestamps,X,Y,Z);

Normalize the timestamps of the created trajectory object.

normalizeTimestamps(traj)

Smooth the trajectory.

smooth(traj)

Specify the path to your local RoadRunner installation folder. This code shows the path for the default installation location on Windows®.

rrAppPath = "C:\Program Files\RoadRunner " + matlabRelease.Release + "\bin\win64";

Specify the path to your RoadRunner project. This code shows the path to a sample project folder on Windows.

rrProjectPath = "C:\RR\MyProject";

Open RoadRunner using the specified path to your project.

rrApp = roadrunner(rrProjectPath,InstallationFolder=rrAppPath);

Export the trajectory to RoadRunner using the open RoadRunner instance rrApp.

exportToRoadRunner(traj,rrApp)
Connection status: 1
Connected to RoadRunner Scenario server on localhost:60729, with client id {3c191baf-8c50-4639-bf64-ce9b078522e3}

Visualize the trajectory exported to RoadRunner.

Trajectory exported to RoadRunner.

Input Arguments

collapse all

Trajectory with the timestamps and waypoints, specified as a Trajectory object.

RoadRunner application associated with a project, specified as a roadrunner object. This object provides functions for performing common tasks such as opening, closing, and saving scenes and projects. rrApp provides functions that support importing data from files and exporting scenes to other formats from RoadRunner.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: exportToRoadRunner(trajectory,Color="blue") exports a blue color actor to RoadRunner.

Name of the actor in RoadRunner, specified as a string scalar or character vector. RoadRunner uses the name specified by this argument for the actor it associates with your exported trajectory. By default, the function assigns the name for the actor as vehicle. For an existing actor with name Name, the function appends an incremental numeric integer at the end of the name. For example, if an actor with name vehicle already exists, the function names the actor as vehicle1 instead.

Example: Name="Actor1" specifies the name of the actor as Actor1.

Data Types: char | string

Color of the actor in driving scenario, specified as "auto", a string scalar, or character vector corresponding to an SVG 1.0 color name, such as "blue", a 3-element row vector of values in the range [0,1], where the values correspond to the intensities of the red, green, and blue components of color, respectively, or a hexadecimal color code, such as "#0072BD". Driving scenario uses the color specified by this argument for the actor it associates with your exported trajectory. By default, the function automatically assigns a color for the actor.

This table lists the valid color names with the equivalent RGB triplets and hexadecimal color codes.

Color NameShort NameRGB TripletHexadecimal Color CodeAppearance
"red""r"[1 0 0]"#FF0000"

Sample of the color red

"green""g"[0 1 0]"#00FF00"

Sample of the color green

"blue""b"[0 0 1]"#0000FF"

Sample of the color blue

"cyan" "c"[0 1 1]"#00FFFF"

Sample of the color cyan

"magenta""m"[1 0 1]"#FF00FF"

Sample of the color magenta

"yellow""y"[1 1 0]"#FFFF00"

Sample of the color yellow

"black""k"[0 0 0]"#000000"

Sample of the color black

"white""w"[1 1 1]"#FFFFFF"

Sample of the color white

Example: Color="Green" sets the color of the actor in driving scenario to green.

Actor asset path, specified as a string scalar or character vector. This value specifies the path in the RoadRunner Asset Library for the Asset Type attribute of the actor. By default, the function automatically assigns an asset path for the actor.

Example: AssetPath="Assets/Vehicles/Sedan.fbx" sets the path for the actor as a sedan vehicle asset.

Data Types: char | string

Set up RoadRunner simulation status, specified as a logical 1 (true) or 0 (false).

By default, the function creates a RoadRunner simulation and updates its start time, end time, and sample rate per the input trajectory trajectory.

Data Types: logical

Filename of the RoadRunner scene to which to export the trajectory, specified as a string scalar or character vector. This argument specifies the absolute or relative path of the RoadRunner scene binary file to which you want to write the trajectory. If you specify a relative path, then the path is relative to the Scenes folder of the current project. The value of RoadRunnerScene must end with .rrhd or .rrscene.

Example: RoadRunnerScene="MyProject/Scenes/FourWaySignal.rrscene" specifies the RoadRunner scene FourWaySignal.rrscene on the project path MyProject/Scenes.

Data Types: char | string

Version History

Introduced in R2024b