Main Content

addData

Add data to actor track list object

Since R2023a

Description

addData(trackdata,timestamps,trackID,classID,position) adds the specified track ID data trackID, class ID data classID, and position data position with the corresponding timestamps timestamps to the actorTracklist object trackdata.

example

addData(___,Name=Value) specifies additional options using name-value arguments, in addition to all input arguments from the previous syntax. For example, Velocity={[4 1 0; 2 2 1]} adds velocities of the form [vx vy vz] for two actors at one timestamp.

Note

This function requires the Scenario Builder for Automated Driving Toolbox™ support package. You can install Scenario Builder for Automated Driving Toolbox from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

Examples

collapse all

Create an empty actorTracklist object.

actorObject = actorTracklist
actorObject = 
  actorTracklist with properties:

         TimeStamp: []
          TrackIDs: []
          ClassIDs: []
          Position: []
         Dimension: []
       Orientation: []
          Velocity: []
             Speed: []
         StartTime: []
           EndTime: []
        NumSamples: 0
    UniqueTrackIDs: []

Load recorded actor track list data into the workspace.

data = load("actorTracklistData.mat");

Extract the recorded timestamps and the actor track IDs, class IDs, and position information from the data.

t = data.timestamps;            % Extract timestamps
trackids = data.actorTrackIDs;  % Extract track IDs
classids = data.actorClassIDs;  % Extract class IDs
pos = data.actorPosition;       % Extract position information

Add the first five rows of data to the empty actorTracklist object.

addData(actorObject,t(1:5),trackids(1:5),classids(1:5),pos(1:5))

Display the details of the actorTracklist object.

disp(actorObject)
  actorTracklist with properties:

         TimeStamp: [5x1 double]
          TrackIDs: {5x1 cell}
          ClassIDs: {5x1 cell}
          Position: {5x1 cell}
         Dimension: []
       Orientation: []
          Velocity: []
             Speed: []
         StartTime: 3.8300e-04
           EndTime: 0.2003
        NumSamples: 5
    UniqueTrackIDs: [3x1 string]

Input Arguments

collapse all

Actor track list information, specified as an actorTracklist object.

Recording timestamps of track information to add, specified as a scalar or an N-element column vector. N is the number of timestamps. Units are in seconds.

Data Types: single | double

Track IDs of the actors, specified as an N-by-1 string array or an N-by-1 cell array. N is the number of timestamps for which you are adding information.

For a single recorded actor across each timestamp, specify trackID as an N-by-1 string array.

For a multiple recorded actors across each timestamp, specify trackID as an N-by-1 cell array. Each cell contains the track IDs of the actors to add at the corresponding timestamp, specified as a 1-by-M string array. M is the number of actors at the timestamp.

Classification IDs of the actors, specified as an N-element column vector or an N-by-1 cell array. N is the number of timestamps for which you are adding information.

For a single recorded actor across each timestamp, specify classID as an N-by-1 vector.

For a multiple recorded actors across each timestamp, specify classID as an N-by-1 cell array. Each cell contains the class IDs of the detected actors to add at the corresponding timestamp, specified as an M-element row vector of nonnegative integers. M is the number of actors at the timestamp.

You must specify each class ID as one of these nonnegative integers:

  • 1 — Car

  • 2 — Truck

  • 3 — Bicycle

  • 4 — Pedestrian

  • 0 — Others

Positions of actors with respect to the ego frame, specified as an N-by-1 cell array. N is the number of timestamps for which you are adding information. Each cell contains the positions of the actors detected at the corresponding timestamp, specified as an M-by-3 numeric matrix. M is the number of actors at the timestamp. Each row specifies the position of an actor in the form [x y z]. Units are in meters.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: addData(trackdata,timestamps,trackID,classID,position,Velocity={[4 1 0; 2 2 1]}) adds velocities of the form [vx vy vz] for two actors at one timestamp.

Dimensions of the actors, specified as an N-by-1 cell array. N is the number of timestamps for which you are adding information. Each cell contains the dimensions of the actors detected at the corresponding timestamp, specified as an M-by-3 numeric matrix. M is the number of actors at the timestamp. Each row specifies the dimension of an actor in the form [length width height]. Units are in meters.

Orientations of the actors, specified as an N-by-1 cell array. N is the number of timestamps for which you are adding information. Each cell contains the orientations of the actors detected at the corresponding timestamp, specified as an M-by-3 numeric matrix. M is the number of actors at the timestamp. Each row specifies the orientation of an actor in the form [yaw pitch roll]. Units are in degrees.

Speeds of the actors with respect to the ego frame, specified as an N-by-1 cell array. N is the number of timestamps for which you are adding information. Each cell contains the speeds of the actors detected at the corresponding timestamp, specified as an M-element numeric row vector. M is the number of actors at the timestamp. Units are in meters per second.

Velocities of the actors with respect to the ego frame, specified as an N-by-1 cell array. N is the number of timestamps for which you are adding information. Each cell contains the velocities of the actors detected at the corresponding timestamp, specified as an M-by-3 numeric matrix. M is the number of actors at a timestamp. Each row specifies the velocity of an actor in the form [vx vy vz]. Units are in meters per second.

Version History

Introduced in R2023a