Main Content

add

Add data to actor track data object

Since R2025a

Description

add(trackData,timestamps,trackID,position) adds the specified actor track data trackID and position, with their corresponding timestamps timestamps, to the actor track data object trackData.

example

add(___,Name=Value) specifies options using one or more name-value arguments in addition to the input arguments from the previous syntax. For example, Attributes=attributes adds the optional actor track attributes attributes to the actor track data object.

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

collapse all

Load recorded actor track data into the workspace.

load("trackedActorData.mat")

Initialize an ActorTrackData object using the information from the loaded actor track data.

idx = 100;
timestamps = trackedActorData.Timestamps;
trackID = trackedActorData.TrackID;
position = trackedActorData.Position;
trackData = scenariobuilder.ActorTrackData(timestamps(1:idx),trackID(1:idx),position(1:idx))
trackData = 
  ActorTrackData with properties:

                Name: ''

          NumSamples: 100
            Duration: 4.9491
          SampleRate: 20.2058
          SampleTime: 0.0500
          Timestamps: [100×1 double]

             TrackID: {100×1 cell}
            Category: []
            Position: {100×1 cell}
           Dimension: []
         Orientation: []
            Velocity: []
               Speed: []
                 Age: []

          Attributes: []

      UniqueTrackIDs: [6×1 string]
    UniqueCategories: []

Play the actor track data object.

play(trackData)

Add additional data samples to the actor track data object.

add(trackData,timestamps(idx+1:end),trackID(idx+1:end),position(idx+1:end))

Play the actor track data object, and observe the added actor tracks.

play(trackData)

Input Arguments

collapse all

Actor track data, specified as an ActorTrackData object.

Timestamps of actor track information, specified as an N-element numeric column vector, an N-element datetime array, or an N-element duration array. N is the number of timestamps. Each element in the timestamps argument specifies the time at which the corresponding actor track information was collected. If you specify an N-element numeric column vector, units must be in seconds.

The add function arranges the added actor track data by their timestamps, in increasing order.

Track IDs of the actors, specified as an N-by-1 cell array. N is the number of timestamps. Each cell contains the track IDs of the actors detected at the corresponding timestamp, specified as an M-by-1 string array. M is the number of actors at the timestamp.

Data Types: cell

Positions of the actors with respect to the ego frame, specified as an N-by-1 cell array. N is the number of timestamps. 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.

Data Types: cell

Name-Value Arguments

collapse all

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: add(trackData,timestamps,trackID,position,Age=age) adds track data with the ages of the actor tracks age.

Name of the recorded actor track data, specified as a string scalar or character vector.

Data Types: char | string

Category names of the actors, such as car, truck, bicycle, and pedestrian, specified as an N-by-1 cell array. N is the number of timestamps. Each cell contains the category names of the actors detected at the corresponding timestamp, specified as an M-by-1 string array. M is the number of actors at the timestamp.

Data Types: cell

Dimensions of the actors, specified as an N-by-1 cell array. N is the number of timestamps. 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 dimensions of an actor in the form [length width height]. Units are in meters.

Data Types: cell

Orientations of the actors, specified as an N-by-1 cell array. N is the number of timestamps. 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.

Data Types: cell

Speeds of the actors with respect to the ego frame, specified as an N-by-1 cell array. N is the number of timestamps. 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.

Data Types: cell

Ages of the actor tracks, specified as an N-by-1 cell array. The age of a track is the number of times it has been updated. N is the number of timestamps. Each cell contains the ages of the actor tracks at the corresponding timestamp, specified as an M-element row vector of positive integers. M is the number of actors at the timestamp.

Data Types: cell

Velocities of the actors with respect to the ego frame, specified as an N-by-1 cell array. N is the number of timestamps. 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 the timestamp. Each row specifies the velocity of an actor in the form [vx vy vz]. Units are in meters per second.

Data Types: cell

Optional actor track attributes, specified as an N-by-1 array. N is the number of timestamps. Each element in the array contains the additional actor track attributes, such as acceleration values, recorded at the corresponding timestamp.

Version History

Introduced in R2025a