importFromObjectTrack
Syntax
Description
importFromObjectTrack(
        imports the track list from the trackdata,objectTrackList,posIdx,velIdx,dimIdx,orientIdx)objectTrack object
          objectTrackList to the actorTracklist object
          trackdata by using the position, velocity, dimension, and orientation
        index vectors for the actor.
importFromObjectTrack(
        imports the track list by the using position, velocity, dimension, and orientation selector
        matrices for the actor.trackdata,objectTrackList,posSelector,velSelector,dimSelector,orientSelector)
importFromObjectTrack(
        imports the track list by using the specified function trackdata,objectTrackList,fhandle)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.
Examples
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
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)
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 R2023aThe trackdata input argument now supports the ActorTrackData
        object along with the previously supported actorTracklist
        object.
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.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
 - Canada (English)
 - United States (English)
 
Europa
- 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)