main content

track vehicles using lidar data in simulink -凯发k8网页登录

this example shows you how to track vehicles using measurements from a lidar sensor mounted on top of an ego vehicle. due to high resolution capabilities of the lidar sensor, each scan from the sensor contains a large number of points, commonly known as a point cloud. the example illustrates the workflow in simulink for processing the point cloud and tracking the objects. the lidar data used in this example is recorded from a highway driving scenario. you use the recorded data to track vehicles with a joint probabilistic data association (jpda) tracker and an interacting multiple model (imm) approach. the example closely follows the track vehicles using lidar: from point cloud to track list matlab® example.

setup

the lidar data used in this example is available at the following link:

download the data files into the current working folder. if you want to place the files in a different folder, change the directory name in the subsequent instructions.

% load the data if unavailable.
if ~exist('lidardata_1.mat','file')
    dataurl = 'https://ssd.mathworks.com/supportfiles/lidar/data/trackvehiclesusinglidarexampledata.zip';
    datasetfolder = fullfile(pwd);
    unzip(dataurl,datasetfolder);
end

overview of the model

load_system('trackvehiclessimulinkexample');
set_param('trackvehiclessimulinkexample','simulationcommand','update');
open_system('trackvehiclessimulinkexample');

lidar and image data reader

the lidar data reader and image data reader blocks are implemented using a (simulink) block. the code for the blocks is defined by helper classes, helperlidardatareader and helperimagedatareader respectively. the image and lidar data readers read the recorded data from the mat files and output the reference image and the locations of points in the point cloud respectively.

bounding box detector

as described earlier, the raw data from sensor contains a large number of points. this raw data must be preprocessed to extract objects of interest, such as cars, cyclists, and pedestrian. the preprocessing is done using the bounding box detector block. the bounding box detector is also implemented as a matlab system™ block defined by a helper class, helperboundingboxdetectorblock. it accepts the point cloud locations as an input and outputs bounding box detections corresponding to obstacles. the diagram shows the processes involved in the bounding box detector model and the computer vision toolbox™ functions used to implement each process. it also shows the parameters of the block that control each process.

the block outputs the detections and segmentation information as (simulink) objects named detectionbus and segmentationbus. these buses are created in the base workspace using helper function helpercreatedetectorbus specified in the preloadfcn callback. see (simulink) for more information about callback functions.

tracking algorithm

the tracking algorithm is implemented using the joint probabilistic data association (jpda) tracker, which uses an interacting multiple model (imm) approach to track targets. the imm filter is implemented by the helperinitimmfilter, which is specified as the "filter initialization function" parameter of the block. in this example, the imm filter is configured to use two models, a constant velocity cuboid model and a constant turn-rate cuboid model. the models define the dimensions of the cuboid as constants during state-transition and their estimates evolve in time during correction stages of the filter. the animation below shows the effect of mixing the constant velocity and constant turn-rate models with different probabilities during prediction stages of the filter.

the imm filter automatically computes the probability of each model when the filter is corrected with detections. the animation below shows the estimated trajectory and the probability of models during a lane change event.

for a detailed description of the state transition and measurement models, refer to the "target state and sensor measurement model" section of the matlab example.

the tracker block selects the check box "enable all tracks output" and "enable detectable track ids input" to output all tracks from the tracker and calculate their detection probability as a function of their state.

calculate detectability

the calculate detectability block is implemented using a (simulink) block. the block calculates the detectable trackids input for the tracker and outputs it as an array with 2 columns. the first column represents the trackids of the tracks and the second column specifies their probability of detection by the sensor and bounding box detector.

visualization

the visualization block is also implemented using the matlab system block and is defined using helperlidarexampledisplayblock. the block uses runtimeobject parameter of the blocks to display their outputs. see (simulink) for further information on how to access block outputs during simulation.

detections and tracks bus objects

as described earlier, the inputs and outputs of different blocks are defined by bus objects. you can visualize the structure of each bus using the (simulink). the following images show the structure of the bus for detections and tracks.

detections

the detectionbus outputs a nested bus object with 2 elements, numdetections and detections.

the first element, numdetections, represents the number of detections. the second element detections is a bus object of a fixed size representing all detections. the first numdetections elements of the bus object represent the current set of detections. notice that the structure of the bus is similar to the class.

tracks

the track bus is similar to the detections bus. it is a nested bus, where numtracks defines the number of tracks in the bus and tracks define a fixed size of tracks. the size of the tracks is governed by the block parameter "maximum number of tracks".

the second element tracks is a bus object defined by trackbustracks. this bus is automatically created by the tracker block by using the bus name specified as the prefix. notice that the structure of the bus is similar to the class.

results

the detector and tracker algorithm is configured exactly as the track vehicles using lidar: from point cloud to track list matlab example. after running the model, you can visualize the results on the figure. the animation below shows the results from time 0 to 4 seconds. the tracks are represented by green bounding boxes. the bounding box detections are represented by orange bounding boxes. the detections also have orange points inside them, representing the point cloud segmented as obstacles. the segmented ground is shown in purple. the cropped or discarded point cloud is shown in blue. notice that the tracked objects are able to maintain their shape and kinematic center by positioning the detections onto visible portions of the vehicles. this illustrates the offset and shrinkage effect modeled in the measurement functions.

close_system('trackvehiclessimulinkexample');

summary

this example showed how to use a jpda tracker with an imm filter to track objects using a lidar sensor. you learned how a raw point cloud can be preprocessed to generate detections for conventional trackers, which assume one detection per object per sensor scan. you also learned how to use a cuboid model to describe the extended objects being tracked by the jpda tracker.

网站地图