Remap road anchor in RoadRunner Scenario in MATLAB
Remap Anchors in a Scenario
Remap road anchor to a target anchor
Open a project in RoadRunner using the
roadrunner function by specifying the location in which to create a project. This example assumes that RoadRunner is installed in its default location in Windows.
Specify the path to an existing project. For example, this code shows the path to a project located on
C:\RR\MyProject. The function returns a
rrApp, that provides functions for performing basic workflow tasks such as opening, closing, and saving scenes and projects.
projectFolder = "C:\RR\MyProject"; rrApp = roadrunner(projectFolder, InstallationFolder='C:\Program Files\RoadRunner R2022b\bin\win64');
Open an existing scenario in RoadRunner Scenario by calling the
openScenario function and passing it the
rrApp object and the specific scenario
filename that you want to open. This call opens the desired scenario in the RoadRunner Scenario application through MATLAB.
filename = "TrajectoryCutIn.rrscenario"; openScenario(rrApp,filename);
Remap the source anchor to the target anchor by calling the
remapAnchor function and passing it the
rrApp object and the source anchor name, the target anchor name and the new anchor name.
remapAnchor(rrApp,"ScenarioStart",[-20 0 0],NewAnchorName="anchor3");
rrApp — RoadRunner application
RoadRunner application associated with a project, specified as a
roadrunner object. This object provides functions
for performing common workflow tasks such as opening, closing, and saving scenes and
rrApp provides functions that support importing data from
files and exporting scenes to other formats from RoadRunner.
source — Source anchor in scenario
character vector | string scalar
Source anchor in scenario, specified as a character vector or string scalar.
target — Target anchor in scenario
character vector | string scalar | three-element numeric vector
Target anchor in scenario, specified as one of these values.
A character vector or string scalar indicating the name of the target anchor. A name remap searches for a road anchor with matching name in the scenario and scene.
A three-element numeric vector indicating the position of the target anchor relative to the center of the scene. A position remap creates a new road anchor on the road closest to the provided position. The distance between this position and the closest road in the scene must be greater than 25 meters.
newName — New anchor name for position remap
"" (default) | character vector | string scalar
New anchor name for a position remap, specified as a character vector or string
scalar. If the value is not specified, the
uses the default value.
Introduced in R2022b
- RoadRunner Scenario Fundamentals (RoadRunner Scenario)
- Simulate a RoadRunner Scenario Using MATLAB Functions