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
Import Track List Using Index Vectors
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"
Import Track List Using Selector Matrices
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"
Import Track List Using Function Handle
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
trackdata
— Actor track list information
actorTracklist
object
Actor track list information, specified as an actorTracklist
object.
objectTrackList
— Object track report
objectTrack
object | array of objectTrack
objects | cell array of objectTrack
objects
Object track report, specified as an objectTrack
object, an array of
objectTrack
objects, or a cell array of
objectTrack
objects.
fhandle
— Actor parameter extraction function
function handle
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.
posIdx
— Actor position indices
three-element row vector
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].
velIdx
— Actor velocity indices
three-element row vector
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].
dimIdx
— Actor dimension indices
three-element row vector
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].
orientIdx
— Actor orientation indices
three-element row vector
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].
posSelector
— Actor position selector
3-by-N logical matrix
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.
velSelector
— Actor velocity selector
3-by-N logical matrix
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.
dimSelector
— Actor dimensions selector
3-by-N logical matrix
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.
orientSelector
— Actor orientation selector
3-by-N logical matrix
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
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
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)