remapAnchor
Description
remapAnchor(
also sets additional options using one or more name-value arguments, such as the name or
type of the target anchor, when the target is specified as a position.rrApp
,source
,target
,Name=Value
)
Examples
Remap Anchors in a Scenario
Remap source 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 roadrunner
object, 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");
Input Arguments
rrApp
— RoadRunner application
roadrunner
object
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
projects. 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 an 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 anchor on the road closest to the provided position. The distance between this position and the closest road in the scene must be less than 25 meters.
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: remapAnchor(rrApp,"anchor2",[-20 0
0],NewAnchorName="anchor3",AnchorType="Scenario")
NewAnchorName
— 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 remapAnchor
function
uses the default value.
AnchorType
— Type of anchor to be created
"AppPreference"
(default) | "Unspecified"
|
"Scenario"
|
"Scene"
Type of anchor to be created for position remap, specified as
"Unspecified"
, "AppPreference"
,
"Scenario"
, or "Scene"
. The default type,
"AppPreference"
, is the type set in the scenario application
preferences. "Scenario"
specifies the anchor as a scenario anchor,
and "Scene"
specifies the anchor as a scene anchor. If you set
AnchorType
to "Unspecified"
, RoadRunner Scenario uses the default AnchorType
value,
"AppPreference"
.
Version History
Introduced in R2022bR2024a: New Property: AnchorType
As of R2024a, you can use the AnchorType
property to specify the type
of anchor to create when remapping to a position.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)