Main Content

importFromObjectTrack

Import track list from objectTrack object

Since R2023a

Description

importFromObjectTrack(trackdata,objectTrackList,posIdx,velIdx,dimIdx,orientIdx) imports the track list from the objectTrack object objectTrackList to the actorTracklist object trackdata by using the position, velocity, dimension, and orientation index vectors for the actor.

example

importFromObjectTrack(trackdata,objectTrackList,posSelector,velSelector,dimSelector,orientSelector) imports the track list by the using position, velocity, dimension, and orientation selector matrices for the actor.

example

importFromObjectTrack(trackdata,objectTrackList,fhandle) imports the track list by using the specified function fhandle to extract actor parameters.

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.

example

Examples

collapse all

Initialize a track state vector for specifying the position, velocity, orientation, and dimensions of an actor in the form [x; vx; y; vy; z; vz; yaw; pitch; roll; length; width; height].

x = (1:12)';

Define a state covariance matrix.

P = diag(1:12);

Create a report of a track by using the objectTrack object.

track = objectTrack(State=x,StateCovariance=P,UpdateTime=0.1);

Define the position, velocity, orientation, and dimension indices in the track state.

posIdx = [1 3 5];
velIdx = [2 4 6];
orientIdx = [7 8 9];
dimIdx = [10 11 12];

Import the track list from the objectTrack object to the actorTracklist object.

actorTrackData = actorTracklist;
importFromObjectTrack(actorTrackData,track,posIdx,velIdx,dimIdx,orientIdx)

Display the actorTracklist object actorTrackData.

disp(actorTrackData)
  actorTracklist with properties:

         TimeStamp: 0.1000
          TrackIDs: {["1"]}
          ClassIDs: {[0]}
          Position: {[1 3 5]}
         Dimension: {[10 11 12]}
       Orientation: {[7 8 9]}
          Velocity: {[2 4 6]}
             Speed: {[7.4833]}
         StartTime: 0.1000
           EndTime: 0.1000
        NumSamples: 1
    UniqueTrackIDs: "1"

Initialize a track state vector for specifying the position, velocity, orientation, and dimensions of an actor in the form [x; vx; y; vy; z; vz; yaw; pitch; roll; length; width; height].

x = (1:12)';

Define a state covariance matrix.

P = diag(1:12);

Create a report of a track by using objectTrack object.

track = objectTrack(State=x,StateCovariance=P,UpdateTime=0.1);

Define the position, velocity, orientation, and dimension selector matrices for the track state.

posSelector = [1 0 0 0 0 0 0 0 0 0 0 0
               0 0 1 0 0 0 0 0 0 0 0 0
               0 0 0 0 1 0 0 0 0 0 0 0];
velSelector = [0 1 0 0 0 0 0 0 0 0 0 0
               0 0 0 1 0 0 0 0 0 0 0 0
               0 0 0 0 0 1 0 0 0 0 0 0];
orientSelector = [0 0 0 0 0 0 1 0 0 0 0 0
                  0 0 0 0 0 0 0 1 0 0 0 0
                  0 0 0 0 0 0 0 0 1 0 0 0];
dimSelector = [0 0 0 0 0 0 0 0 0 1 0 0
               0 0 0 0 0 0 0 0 0 0 1 0
               0 0 0 0 0 0 0 0 0 0 0 1];

Import the track list from the objectTrack object to the actorTracklist object.

actorTrackData = actorTracklist;
importFromObjectTrack(actorTrackData,track,posSelector,velSelector,dimSelector,orientSelector)

Display the actorTracklist object actorTrackData.

disp(actorTrackData)
  actorTracklist with properties:

         TimeStamp: 0.1000
          TrackIDs: {["1"]}
          ClassIDs: {[0]}
          Position: {[1 3 5]}
         Dimension: {[10 11 12]}
       Orientation: {[7 8 9]}
          Velocity: {[2 4 6]}
             Speed: {[7.4833]}
         StartTime: 0.1000
           EndTime: 0.1000
        NumSamples: 1
    UniqueTrackIDs: "1"

Initialize a track state vector for specifying the position, velocity, orientation, and dimensions of an actor in the form [x; vx; y; vy; z; vz; yaw; pitch; roll; length; width; height].

x = (1:12)';

Define a state covariance matrix.

P = diag(1:12);

Create a report of a track by using the objectTrack object.

track = objectTrack(State=x,StateCovariance=P,UpdateTime=0.1);

Import the track list from the objectTrack object to the actorTracklist object by using a function handle.

actorTrackData = actorTracklist;
importFromObjectTrack(actorTrackData,track,@extractTrackInfo)

Display the actorTracklist object actorTrackData.

disp(actorTrackData)
  actorTracklist with properties:

         TimeStamp: 0.1000
          TrackIDs: {["1"]}
          ClassIDs: {[0]}
          Position: {[1 3 5]}
         Dimension: {[10 11 12]}
       Orientation: {[7 8 9]}
          Velocity: {[2 4 6]}
             Speed: {[7.4833]}
         StartTime: 0.1000
           EndTime: 0.1000
        NumSamples: 1
    UniqueTrackIDs: "1"

Helper Function

extractTrackInfo — Extracts actor track list parameters from objectTrack object.

function [pos,vel,dim,orient] = extractTrackInfo(objTrack)
% State of the track is defined as [x; vx; y; vy; z; vz; yaw; pitch; roll; length; width; height];
% Define the position, velocity, orientation, and dimension indices in the track state.
posIndex = [1 3 5];
velIndex = [2 4 6];
orientIndex = [7 8 9];
dimIndex = [10 11 12];

pos = objTrack.State(posIndex)';
vel = objTrack.State(velIndex)';
dim = objTrack.State(dimIndex)';
orient = objTrack.State(orientIndex)';
end

Input Arguments

collapse all

Actor track list information, specified as an actorTracklist object, or ActorTrackData object.

Object track report, specified as an objectTrack object, an array of objectTrack objects, or a cell array of objectTrack objects.

Actor parameter extraction function, specified as a function handle. The function handle must have this syntax:

[pos,vel,dim,orient] = extractFunction(objTrk)
where objTrk is a scalar objectTrack object and the output arguments return these values:

  • pos — Actor positions, returned as an M-by-3 matrix. M is the number of tracks. Each row represents the actor position in the form [x y z]. Units are in meters.

  • vel — Actor velocities, returned as an M-by-3 matrix. M is the number of tracks. Each row represents the actor velocity in the form [vx vy vz]. Units are in meters per second.

  • dim — Actor dimensions, returned as an M-by-3 matrix. M is the number of tracks. Each row represents the actor dimensions in the form [length width height]. Units are in meters.

  • orient — Actor orientations, returned as an M-by-3 matrix. M is the number of tracks. Each row represents the actor orientation in the form [yaw pitch roll]. Units are in degrees.

Actor position indices, specified as a three-element row vector. These indices are relative to the State property of the objectTrack object objectTrackList, and represent the actor position in the form [x y z].

Actor velocity indices, specified as a three-element row vector. These indices are relative to the State property of the objectTrack object objectTrackList, and represent the actor velocity in the form [vx vy vz].

Actor dimension indices, specified as a three-element row vector. The function derives the dimensions of the actor from the values of the State property of the objectTrack object objectTrackList, and represents those dimensions in the form [length width height].

Actor orientation indices, specified as a three-element row vector. These indices are relative to the State property of the objectTrack object objectTrackList, and represent the actor orientation in the form [yaw pitch roll].

Actor position selector, specified as a 3-by-N logical matrix. N is the dimension of the state specified in the State property of the objectTrack object objectTrackList. The function extracts the actor position, of the form [x y z], by multiplying the position selector matrix with the state vector of the objectTrack object.

Actor velocity selector, specified as a 3-by-N logical matrix. N is the dimension of the state specified in the State property of the objectTrack object objectTrackList. The function extracts the actor velocity, of the form [vx vy vz], by multiplying the velocity selector matrix with the state vector of the objectTrack object.

Actor dimensions selector, specified as a 3-by-N logical matrix. N is the dimension of the state specified in the State property of the objectTrack object objectTrackList. The function extracts the actor dimensions, of the form [length width height], by multiplying the dimension selector matrix with the state vector of the objectTrack object.

Actor orientation selector, specified as a 3-by-N logical matrix. N is the dimension of the state specified in the State property of the objectTrack object objectTrackList. The function extracts the actor orientation, of the form [yaw pitch roll], by multiplying the orientation selector matrix with the state vector of the objectTrack object.

Version History

Introduced in R2023a

expand all