targetPoses

Target positions and orientations relative to ego vehicle

Description

example

poses = targetPoses(ac) returns the poses of all targets in a driving scenario with respect to the ego vehicle actor, ac. See Ego Vehicle and Targets for more details.

Examples

collapse all

Create a driving scenario containing three vehicles. Find the target poses of two of the vehicles as viewed by the third vehicle. Target poses are returned in the ego-centric coordinate system of the third vehicle.

Create a driving scenario.

scenario = drivingScenario;

Create the target actors.

actor(scenario,'Position',[10 20 30], ...
    'Velocity',[12 113 14], ...
    'Yaw',54, ...
    'Pitch',25, ...
    'Roll',22, ...
    'AngularVelocity',[24 42 27]);

actor(scenario,'Position',[17 22 12], ...
    'Velocity',[19 13 15], ...
    'Yaw',45, ...
    'Pitch',52, ...
    'Roll',2, ...
    'AngularVelocity',[42 24 29]);

Add the ego vehicle actor.

ego = actor(scenario,'Position',[1 2 3], ...
    'Velocity',[1.2 1.3 1.4], ...
    'Yaw',4, ...
    'Pitch',5, ...
    'Roll',2, ...
    'AngularVelocity',[4 2 7]);

Use actorPoses to return the poses of all the actors. Pose properties (position, velocity, and orientation) are in scenario coordinates.

allposes = actorPoses(scenario);

Use driving.scenario.targetsToEgo to convert only the target poses to the ego-centric coordinates of the ego actor. Examine the pose of the first actor.

targetposes1 = driving.scenario.targetsToEgo(allposes(1:2),ego);
disp(targetposes1(1))
            ActorID: 1
           Position: [7.8415 18.2876 27.1675]
           Velocity: [18.6826 112.0403 9.2960]
               Roll: 16.4327
              Pitch: 23.2186
                Yaw: 47.8114
    AngularVelocity: [-3.3744 47.3021 18.2569]

Alternatively, use targetPoses to obtain all non-ego actor poses in ego vehicle coordinates. Compare these poses to the previously calculated poses.

targetposes2 = targetPoses(ego);
disp(targetposes2(1))
            ActorID: 1
            ClassID: 0
           Position: [7.8415 18.2876 27.1675]
           Velocity: [18.6826 112.0403 9.2960]
               Roll: 16.4327
              Pitch: 23.2186
                Yaw: 47.8114
    AngularVelocity: [-3.3744 47.3021 18.2569]

Input Arguments

collapse all

Actor belonging to a drivingScenario object, specified as an Actor or Vehicle object. To create these objects, use the actor and vehicle functions, respectively.

Output Arguments

collapse all

Target poses, in ego vehicle coordinates, returned as a structure or as an array of structures. The pose of the ego vehicle actor, ac, is not included.

A target pose defines the position, velocity, and orientation of a target in ego vehicle coordinates. Target poses also include the rates of change in actor position and orientation.

Each pose structure has these fields.

FieldDescription
ActorID

Scenario-defined actor identifier, specified as a positive integer.

ClassIDClassification identifier, specified as a nonnegative integer. 0 is reserved for an object of an unknown or unassigned class.
Position

Position of actor, specified as an [x y z] real-valued vector. Units are in meters.

Velocity

Velocity (v) of actor in the x-, y-, and z-directions, specified as a [vx vy vz] real-valued vector. Units are in meters per second.

Roll

Roll angle of actor, specified as a real scalar. Units are in degrees.

Pitch

Pitch angle of actor, specified as a real scalar. Units are in degrees.

Yaw

Yaw angle of actor, specified as a real scalar. Units are in degrees.

AngularVelocity

Angular velocity (ω) of actor in the x-, y-, and z-directions, specified as an [ωx ωy ωz] real-valued vector. Units are in degrees per second.

For full definitions of these structure fields, see the actor and vehicle functions.

More About

collapse all

Ego Vehicle and Targets

In a driving scenario, you can specify one actor as the observer of all other actors, similar to how the driver of a car observes all other cars. The observer actor is called the ego actor, or more specifically, the ego vehicle. From the perspective of the ego vehicle, all other actors (vehicles, pedestrians, and so on) are the observed actors, or targets. Ego vehicle coordinates are centered and oriented with reference to the ego vehicle. The coordinates of the driving scenario are world coordinates.

Introduced in R2017a