convertToStruct
Description
converts the actorStruct
= convertToStruct(actorSim
)ActorSimulation
actor specified by
actorSim
to its equivalent MATLAB® structure.
Examples
Convert Actor to Structure
Create sim
, a
ScenarioSimulation
object.
rrApp = roadrunner("C:\Project\TestHighwayRoute"); openScenario(rrApp,"myScenario1"); sim = createSimulation(rrApp);
Start the simulation.
set(sim,"SimulationCommand","Start");
Pause the simulation.
set(sim,"SimulationCommand","Pause");
Retrieve one actor from the simulation.
actorsim = get(sim,"ActorSimulation");
actorOne = actorsim{1};
Convert the actor to a MATLAB structure.
actorStruct = convertToStruct(actorOne)
actorStruct = struct with fields: ActorID: 1 Pose: [4×4 double] Velocity: [0 0 0] AngularVelocity: [0 0 0]
Input Arguments
actorSim
— Actor
ActorSimulation
object
Actor, specified as an ActorSimulation
object.
Output Arguments
actorStruct
— MATLAB structure equivalent to actor
struct
MATLAB structure equivalent to actor, returned as a struct
.
This MATLAB structure contains the runtime attributes of the specified actor.
The returned structure contains these fields.
Field | Description |
---|---|
ActorID | Actor identifier, returned as a positive integer. |
Pose | Position and orientation of actor in the RoadRunner Scenario coordinate system, returned as a 4-by-4 array. |
Velocity | Velocity of actor in the x-, y-and z- directions, returned as a 1-by-3 vector. Units are in meters per second. |
AngularVelocity | Angular velocity of actor in the x-, y-and z- directions, returned as a 1-by-3 real-valued vector. Units are in radians per second. |
Version History
Introduced in R2022a
See Also
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 (한국어)