Import Driving Data in Tracking Data Importer App
This example shows how to import estimated ground truth data in the Tracking Data Importer to visualize track data information and export it for tracking purposes.
The track data includes information such as timestamped track IDs, positions, and orientations, which are essential for interpreting vehicle positions and trajectories within a scenario. In these scenarios, actors represent objects in motion, including cars, pedestrians, and cyclists. The ego vehicle, as the primary actor, traverses the scenario while observing other non-ego actors in the environment. By utilizing the Tracking Data Importer, you can import this data to visualize key tracking information such as target positions, orientations, trajectories, size of detections in a globe view. Additionally, it supports exporting data in formats that can further be used for tracking purposes.
In this example, you learn how to:
Import estimated ground truth data into the Tracking Data Importer App.
Visualize track information such as track position, orientation, bounding box, velocity.
Export data from the app to the MATLAB workspace in multiple formats. These formats help you play the tracking scenario recording, evaluate tracking metrics, and tune tracking filters.
Load Recorded Data
This example uses a MAT file containing a subset of sensor data and estimated ground truth for non-ego tracks from the PandaSet data set. It includes GPS data from an ego vehicle navigating an urban environment and non-ego actor trajectories estimated by an offline tracking algorithm.
The non-ego actor trajectories is derived from the tracklist data of the actorTracklist
(Automated Driving Toolbox) object. These trajectories are further smoothed to estimate the actor ground truth. For more information, see the Generate Scenario from Actor Track Data and GPS Data (Automated Driving Toolbox) example.
Load the scenario data into the workspace. The MAT file contains the following information:
gpsData
— This data represents the geographic coordinates recorded by the GPS device mounted on the ego vehicle.nonEgoActorInfo
— The actor information contains the estimated ground truth of the non-ego actor properties in the local reference frame.
load("actorTracklist.mat",'gpsData','nonEgoActorInfo');
gpsData
is a table with these columns:
timeStamp
— Time, in seconds, at which the GPS data was collected.Latitude
— Latitude coordinate value of the ego vehicle. Units are in degrees.Longitude
— Longitude coordinate value of the ego vehicle. Units are in degrees.Altitude
— Altitude coordinate value of the ego vehicle. Units are in meters.
Display the first few rows of GPS data.
head(gpsData);
timeStamp latitude longitude altitude __________ ________ _________ ________ 1.5576e+09 37.374 -122.06 42.858 1.5576e+09 37.374 -122.06 42.858 1.5576e+09 37.374 -122.06 42.854 1.5576e+09 37.374 -122.06 42.849 1.5576e+09 37.374 -122.06 42.848 1.5576e+09 37.374 -122.06 42.851 1.5576e+09 37.374 -122.06 42.856 1.5576e+09 37.374 -122.06 42.856
nonEgoActorInfo
is a table containing actor properties, including:
Time
— Time at which the non-ego actor information was collected. Units are in seconds.TrackID
— Platform ID of the actor within the scenario.Waypoints
— Positions of actor trajectory in the ENU reference frame, using the first geodetic coordinates of the ego as the origin. Positions contain the x, y, z locations per timestep for each track. Units are in meters.Dimensions
— Dimensions of the bounding box of the tracked actor. Dimensions are 3D points representing length, width, and height. Units are in meters.Yaw
— Yaw angle of the bounding box of the tracked actor with respect to the local reference frame. Units are in degrees.
Display the first few rows of actor information.
head(nonEgoActorInfo);
Age TrackID ClassID EntryTime ExitTime Dimension Mesh Time Waypoints Speed Roll Pitch Yaw IsStationary ___ _______ _______ __________ __________ _______________________ ______________________ ______________ ______________ ______________ ______________ ______________ ______________ ____________ 10 "2" 1 1.5576e+09 1.5576e+09 2.037 5.273 1.825 1×1 extendedObjectMesh { 10×1 double} { 10×3 double} { 10×1 double} { 10×1 double} { 10×1 double} { 10×1 double} true 400 "3" 1 1.5576e+09 1.5576e+09 1.911 4.672 1.527 1×1 extendedObjectMesh {400×1 double} {400×3 double} {400×1 double} {400×1 double} {400×1 double} {400×1 double} false 10 "4" 1 1.5576e+09 1.5576e+09 2.043 4.537 1.87 1×1 extendedObjectMesh { 10×1 double} { 10×3 double} { 10×1 double} { 10×1 double} { 10×1 double} { 10×1 double} false 139 "5" 1 1.5576e+09 1.5576e+09 2.199 4.827 1.968 1×1 extendedObjectMesh {139×1 double} {139×3 double} {139×1 double} {139×1 double} {139×1 double} {139×1 double} false 400 "6" 1 1.5576e+09 1.5576e+09 1.981 4.974 1.58 1×1 extendedObjectMesh {400×1 double} {400×3 double} {400×1 double} {400×1 double} {400×1 double} {400×1 double} false 27 "7" 1 1.5576e+09 1.5576e+09 2.022 4.487 1.758 1×1 extendedObjectMesh { 27×1 double} { 27×3 double} { 27×1 double} { 27×1 double} { 27×1 double} { 27×1 double} false 35 "8" 1 1.5576e+09 1.5576e+09 1.885 5.072 1.518 1×1 extendedObjectMesh { 35×1 double} { 35×3 double} { 35×1 double} { 35×1 double} { 35×1 double} { 35×1 double} true 35 "9" 1 1.5576e+09 1.5576e+09 1.986 4.844 1.531 1×1 extendedObjectMesh { 35×1 double} { 35×3 double} { 35×1 double} { 35×1 double} { 35×1 double} { 35×1 double} true
Extract Trajectories from Sensor Data
In this section, you convert the actor information into a format suitable for import into the Tracking Data Importer App. The app allows you to import data in several formats, such as TXT, CSV, and XLS. You can also import data from the MATLAB workspace in a table
or timetable
format. nonEgoActorInfo
contains the estimated ground truth actor information in a table format; however, it is not organized by timestamp. You need to restructure this data to ensure each entry is associated with a specific timestamp.
Convert the nonEgoActorInfo
actor information into the required timetable
format using the helperActorInfoToTimetable
function.
actorInfo = helperActorInfoToTimetable(nonEgoActorInfo);
Display the first few rows of actorInfo
.
head(actorInfo);
TrackID Time WaypointsEast WaypointsNorth WaypointsUp Length Width Height Roll Pitch Yaw Speed _______ __________ _____________ ______________ ___________ ______ _____ ______ ____ _____ ______ ______ 2 1.5576e+09 16.006 3.7649 0.65008 2.037 5.273 1.825 0 0 342.11 30.284 3 1.5576e+09 23.477 -3.5659 0.46529 1.911 4.672 1.527 0 0 342.85 17.256 4 1.5576e+09 56.454 -13.67 0.55349 2.043 4.537 1.87 0 0 342.62 18.978 5 1.5576e+09 32.427 -13.868 0.45713 2.199 4.827 1.968 0 0 343.3 18.156 6 1.5576e+09 32.768 -10.242 0.44176 1.981 4.974 1.58 0 0 343.46 17.309 7 1.5576e+09 6.8142 -6.6176 0.55891 2.022 4.487 1.758 0 0 342.85 19.292 2 1.5576e+09 16.006 3.7649 0.65008 2.037 5.273 1.825 0 0 342.11 30.343 3 1.5576e+09 25.039 -4.1159 0.46914 1.911 4.672 1.527 0 0 342.75 17.231
Visualize Non-Ego Actor Information in Tracking Data Importer App
In this section, you import the estimated ground truth of the non-ego actors into the Tracking Data Importer App to visualize it on a globe. The workflow involves the following steps:
Import Data — You can import data in various formats (txt,csv,xls), or directly from the MATLAB workspace as a
table
ortimetable
.Choose Converter — Select an appropriate converter with predefined data elements for visualization based on your data.
Map Variables — Map the imported variables to the predefined data elements in the converter.
Visualize — Visualize the scenario actor trajectories on the globe.
Export Data — Export the data in your preferred format.
To get started, open the Tracking Data Importer App using the command-line interface.
>> trackingDataImporter
Import Data
To bring in the timetable containing actor trajectories from the MATLAB workspace, use the Import dropdown and choose Import from Workspace. In the pop-up window, select the actorInfo
timetable variable and proceed with the import.
Choose Converter
A converter includes predefined data elements such as positions in X, Y, Z or latitude, longitude, altitude, as well as size, orientation, acceleration, and also other data elements to represent physical quantities related to tracking. Each converter offers a unique set of predefined data elements, allowing you to select one based on the physical quantities present in your imported data. When a converter is selected, the list of predefined fields is visible in the converter window under the Data Elements Preview pane. Refer to these data elements to choose the converter that best fits your data. The required data elements are highlighted with red asterisks.
For driving applications, consider the following options:
GPS Log — Accepts data in geodetic coordinates. Additional data elements include 3D velocity, speed, and course.
Driving Log — Accepts data in the ego reference frame using Cartesian coordinates. Additional data elements include linear and angular velocity, acceleration, size, and orientation in quaternions or Euler angles.
Custom — Supports data in geodetic or Cartesian coordinates, with options for ECEF, Fixed ENU, Fixed NEU, or Non-Earth Referenced frames. Additional data elements include a mix of GPS Log and Driving Log features based on the coordinates you choose.
Note: The Driving Log converter does not support visualization in the application, because it does not define a geographic reference location for the globe. Use Custom converter instead.
The imported data includes positions of actors in a fixed ENU reference frame using Cartesian coordinates. Hence, you choose the Custom converter for this data. The actors can be defined as point objects or with bounding boxes. In this example, choose to define target platforms as box objects since you know the dimensions of the actors. In the Custom converter settings, configure the data elements as follows:
Coordinate Type —
Cartesian
Frame Type —
Fixed ENU
Target Extent —
Box
Specify the origin of the fixed ENU reference frame in geodetic coordinates. This should be the first GPS measurement recorded from the scenario.
lla0 = gpsData(1,:);
fprintf(" Latitude: %4.8f \n Longitude: %4.8f \n Altitude: %4.8f \n",lla0.latitude,lla0.longitude,lla0.altitude);
Latitude: 37.37376428 Longitude: -122.05626428 Altitude: 42.85770370
Use the values from lla0
for Latitude and Longitude data elements in the App. Since the recorded driving data is for a flat road, you can choose to leave the Altitude field to 0
. Enter the complete geodetic floating values displayed to ensure accuracy in visualization.
Confirm the settings to proceed to the mapping stage of the workflow.
Map Variables
In the Mapping window, locate the Date Time Data Element pane and choose the timestamp column name from the imported timetable, which in this case is Time
.
Then, navigate to the Other Data Elements pane to map the imported variables to the predefined data elements in the converter as follows:
Platform ID —
TrackID
Position: x —
WaypointsEast
Position: y —
WaypointsNorth
Finally, convert the data using the Convert button in the Truth Conversion pane to proceed to visualization of actor information.
Visualize
To visualize the trajectories, click the Visualize button in the Visualize tool strip. This plots the actor trajectories on a globe-based view. You can interact with the map by dragging to pan and zooming in for detailed examination. For a more detailed geographical context, you can switch between base maps using the map picker in the top right corner of the Visualization window.
Right-click on any of the entries in the converted table to highlight platforms or adjust the time display precision in the Date
Time
field. You can double-click on the row number in the converted table to highlight a single platform at a specific timestep.
Note: The satellite map is based on images captured at the time of satellite imaging. Any cars visible on the map are part of the original satellite imagery and are not related to the visualization of your data.
Similarly, you can further visualize Dimension
and Orientation
of the object at a certain timestep. To add more data, navigate to the Mapping window and map data for the Size
and Orientation
data elements as follows:
Size: L —
Length
Size: W —
Width
Size: H —
Height
Orientation: Yaw —
Yaw
For actor orientation information, you can disregard the Pitch
and Roll
quantities since the scenario involves actors on a flat road.
Proceed to convert the data and visualize the new information by highlighting the platform poses in the converted table. Initially, you may observe incorrectly displayed bounding boxes around platforms, indicating that the input data had the Length
and Width
interchanged. Such anomalies can be detected during visualization using this app. To correct this, swap the Width
and Length
field names, then convert and visualize the bounding boxes again. Upon doing so, you should observe that the bounding box orientations align with the road lanes, providing a correct visual representation. This alignment allows you to verify that the dimensions and orientation of the platforms are accurate in the imported data.
Export Tracking Data
In this section, you export the converted data from the app into the MATLAB workspace for further processing. Once exported, you can engage in various workflows: play the recording of the tracking scenario for animation, use output data for metric evaluation, tune tracking filters, or directly manipulate the converted table. The modified converted table can then also be re-imported into the app for further visualization and analysis or used for other tracking purposes.
Export as trackingScenarioRecording
trackingScenarioRecording
is an object used to store the recording of a tracking scenario. You can call an object function to play the tracking scenario recording in a player. Use the Export dropdown to export the data as a trackingScenarioRecording
object.
Configure the export settings as follows:
Variable Name —
recording
Coordinate Type —
Cartesian
Frame Type —
Fixed ENU
Latitude —
lla0.latitude
Longitude —
lla0.longitude
Altitude —
lla0.altitude
The variable named recording
is then exported to the MATLAB workspace. Play the tracking scenario recording by calling the play
object function on the object as follows:
>> recording.play
The exported tracking scenario plays in the Tracking Scenario Player. You can use the app to run, pause, step forward, step back, go to start, or jump to a specific time stamp. Please note that the player can only play the trackingScenarioRecording
in Cartesian coordinates.
Export as Truth Log
To evaluate tracking performance with ground truth data, Export the data as a Truth Log to assess performance metrics between tracks and the ground truth. A structure variable named truthLog
is exported to the MATLAB workspace, containing data elements like Time
, PlatformID
, Position
, Velocity
, and Orientation
. Its size corresponds to the number of timesteps in the converted data. Use it to evaluate metrics such as assignment, error, OSPA, GOSPA, and CLEAR to analyze and compare multi-object system performance. For more details, refer to the documentation for trackAssignmentMetrics
, trackErrorMetrics
, trackOSPAMetric
, and trackGOSPAMetric
.
Export as Tuning Data
Trackers rely on a tracking filter with several tunable properties, which need to be optimized according to the specific application or data to prevent performance degradation and reduce estimate errors, thereby enhancing tracking performance. The trackingFilterTuner
object facilitates this process by adjusting the properties of filters like the trackingEKF
object. To begin tuning, export the converted table as Tuning Data, which is a timetable
containing timestep data for each track, including data elements like Position
, Velocity
, Acceleration
, and Orientation
. Additionally, use the detection data, which provides object detections for the same period, to assist in the tuning process. For more information, refer to the trackingFilterTuner
object documentation.
Summary
In this example, you learned how to transform the estimated ground truth of non-ego actors into a timestamped timetable format suitable for the Tracking Data Importer App. You also converted and mapped the relevant data necessary for visualizing actor trajectories and bounding boxes. Visualization is crucial for identifying anomalous data and ensuring data accuracy. Additionally, you explored workflows for exporting data to play the recorded tracking scenario and using it for metric evaluation with truth logs or filter tuning.
Supporting Functions
helperActorInfoToTimetable
converts non-ego actor information to a timestamped timetable
.
function sortedActorInfo = helperActorInfoToTimetable(actorInfo) %helperActorInfoToTimetable Transform non-ego actor information to a % timestamped timetable containing track information for each timestep. % Initialize cell arrays to hold data actorTrackIDs = []; actorTimes = []; actorWaypoints = []; actorDimensions = []; actorOrientations = []; actorSpeed = []; % Iterate over each row in actorInfo for i = 1:height(actorInfo) % Extract current row data trackID = actorInfo.TrackID{i}; % track Id time = actorInfo.Time{i}; % time (s) waypoints = actorInfo.Waypoints{i}; % posx, posy, posz (m) dimensions = actorInfo.Dimension(i,:); % length, width, height (m) orientations = [actorInfo.Roll{i},actorInfo.Pitch{i},actorInfo.Yaw{i}]; % roll, pitch, yaw (deg) speed = actorInfo.Speed{i}; % speed (m/s) % Get data numEntries = length(time); trackId = str2double(trackID); time = time(1:numEntries); waypoints = waypoints(1:numEntries,:); orientations = orientations(1:numEntries,:); speed = speed(1:numEntries); % Append data actorTrackIDs = [actorTrackIDs;repmat(trackId,numEntries,1)]; %#ok<AGROW> actorTimes = [actorTimes;time]; actorWaypoints = [actorWaypoints;waypoints]; actorDimensions = [actorDimensions;repmat(dimensions,numEntries,1)]; actorOrientations = [actorOrientations;orientations]; actorSpeed = [actorSpeed;speed]; end % Create a new table with expanded data expandedActorInfo = table(actorTrackIDs, actorTimes, ... actorWaypoints(:,1),actorWaypoints(:,2),actorWaypoints(:,3), ... actorDimensions(:,1),actorDimensions(:,2),actorDimensions(:,3), ... actorOrientations(:,1),actorOrientations(:,2),actorOrientations(:,3), ... actorSpeed, ... 'VariableNames', {'TrackID','Time', ... 'WaypointsEast','WaypointsNorth','WaypointsUp', ... 'Length','Width','Height', ... 'Roll', 'Pitch', 'Yaw', ... 'Speed'}); % Sort the table by time and then by track ID sortedActorInfo = sortrows(expandedActorInfo,{'Time','TrackID'}); end