Main Content

findNearest

Find actor information nearest to specified timestamp in actor track list object

Since R2023a

Description

example

data = findNearest(trackdata,timestamp) finds the actor information nearest to the specified timestamp timestamp in the actorTracklist object trackdata.

data = findNearest(trackdata,timestamp,"lessThanEqual") finds the actor information nearest to and less than the specified timestamp timestamp.

data = findNearest(trackdata,timestamp,"greaterThanEqual") finds the actor information nearest to and greater than the specified timestamp 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

Load an initialized actorTracklist object into the workspace.

actorObject = load("actorTracklistObject.mat");
actorObject = actorObject.actorObject;

Specify a timestamp for which to find data in the actorTracklist object.

t = 10;

Find the data nearest to the specified timestamp in the actorTracklist object.

nd = findNearest(actorObject,t);

Display the data.

disp(nd)
    TimeStamp     ActorInfo  
    _________    ____________

     10.001      {3x1 struct}

Input Arguments

collapse all

Actor track list information, specified as an actorTracklist object.

Timestamp near which to read actor data, specified as a numeric scalar. Units are in seconds.

Data Types: single | double

Output Arguments

collapse all

Actor track list data, returned as a 1-by-2 table. Each row in the table represents track information relative to its recording time.

Each element of the first column of the table contains the timestamp at which the corresponding track information was captured, returned as a positive scalar. Units are in seconds.

Each element of the second column of the table contains the track information of non-ego actors, returned as an M-by-1 structure array. M is the number of actors with track information recorded at the corresponding timestamp. Each structure has these fields:

FieldDescription
TrackIDTrack ID of the actor, returned as a numeric scalar, a string scalar, or a character vector.
ClassID

Classification identifier of the actor, returned as one of these nonnegative integers:

  • 1 — Car

  • 2 — Truck

  • 3 — Bicycle

  • 4 — Pedestrian

  • 0 — Others

Position

Position of the actor with respect to the ego frame, returned as a three-element numeric row vector of the form [x y z]. Units are in meters.

Dimension

Dimensions of the actor, returned as a three-element numeric row vector of the form [length width height].

Units are in meters.

Yaw

Yaw angle of the actor with respect to the ego frame, returned as a numeric scalar.

Units are in degrees.

Pitch

Pitch angle of the actor with respect to the ego frame, returned as a numeric scalar.

Units are in degrees.

Roll

Roll angle of the actor with respect to the ego frame, returned as a numeric scalar.

Units are in degrees.

Speed

Speed of the actor with respect to the ego frame, returned as a numeric scalar.

Units are in meters per second.

Velocity

Velocity of the actor with respect to the ego frame, returned as a three-element numeric row vector of the form [vx vy vz].

Units are in meters per second.

Version History

Introduced in R2023a