毫米波雷达使用仿真学习
示例场景
一辆移动的主车和道路150m处静止的车,主车初始速度50km/h,检测到静止车后制动减速度为3m每平方秒,在距离静止车前1m停止
m文件matlab代码如下
clear;clc;
%% 创建驾驶场景
addpath(fullfile(matlabroot,'toolbox','shared','tracking','fusionlib'));
rng default;
initialDist=150;
initialSpeed=50;
brakeAccel=3;
finalDist=1;
[scenario,egoCar]=helperCreateSensorDemoScenario('FCW',initialDist,initialSpeed,brakeAccel,finalDist);
%% 构建雷达
radarSensor=radarDetectionGenerator(...
'SensorIndex',1,...
'UpdateInterval',0.1,...
'SensorLocation',[egoCar.Wheelbase+egoCar.FrontOverhang 0],...
'Height',0.2,...
'FieldOfView',[20 5],...
'MaxRange',150,...
'AzimuthResolution',4,...
'RangeResolution',2.5,...
'ActorProfiles',actorProfiles(scenario));
%% 构建显示FCW驾驶场景
[bep,figScene]=helperCreateSensorDemoDisplay(scenario,egoCar,radarSensor);
metrics=struct;
while advance(scenario) %此结构可以使场景仿真
gTruth=targetPoses(egoCar);
time=scenario.SimulationTime;
[dets,~,isValidTime]=radarSensor(gTruth,time);
if isValidTime
helperUpdateSensorDemoDisplay(bep,egoCar,radarSensor,dets);
metrics=helperCollectScenarioMetrics(metrics,gTruth,dets);
end
helperPublishSnapshot(figScene,time>=9.1);
end
注:
(1)仅用于自学使用
(2)参考书目《智能网联汽车自动驾驶仿真技术》–作者:崔胜民
(3)运行环境matlab2019a版本