主要内容

drivingScenario

Create driving scenario

描述

drivingScenario物体代表一个3D竞技场,其中包含道路,停车场,车辆,行人,障碍和驾驶场景的其他方面。使用此对象对现实的流量情景进行建模,并生成用于测试控制器或传感器融合算法的合成检测。

  • 要添加道路,请使用功能。要在道路上指定车道,请创建一个lanespec目的。您也可以使用公路网功能。

  • 要添加停车场,请使用停车场功能。

  • To add actors (cars, pedestrians, bicycles, and so on), use theactor功能。要添加专门为车辆设计的特性的演员,请使用车辆功能。To add barriers, use the障碍功能。所有演员,包括车辆和障碍物,均以长方形(框形状)为模型。

  • 要模拟场景,请致电advance在循环中函数,该循环一次仿真一次。

您还可以通过使用驾驶场景设计师应用程序。此外,您可以导出drivingScenario该应用程序中的对象生成方案变化,以用于应用程序或在simulink中万博1manbetx®。有关更多详细信息,请参阅以编程方式创建驾驶场景变化

创建

描述

example

设想= DrivingsCenario创建一个空的驾驶场景。

example

设想= drivingscenario(名称,价值)设置SampleTime,StopTime, 和地理使用名称值对的属性。例如,DrivingsCenario('Georeference',[42.3 -71.0 0])将场景的地理起源设置为(42.3,–71.0)的纬度尺度坐标和0。

特性

展开全部

方案模拟步骤之间的时间间隔, specified as a positive real scalar. Units are in seconds.

例子:1.5

模拟的结束时间,指定为正实量表。单位在几秒钟内。默认值StopTimeinf当第一演员到达其轨迹的末端时,会导致模拟结束。

例子:60.0

此属性仅阅读。

模拟的当前时间,指定为非负实量表。要将时间重置为零,请致电重新开始功能。单位在几秒钟内。

此属性仅阅读。

模拟状态,指定为真的或者false。如果模拟正在运行,IsRunning真的

此属性仅阅读。

演员和车辆s contained in the scenario, specified as a heterogeneous array of演员Vehicle对象。要将演员和车辆添加到驾驶场景中,请使用actor车辆功能。

此属性仅阅读。

障碍contained in the scenario, specified as a heterogeneous array ofBarrier对象。要在驾驶场景中增加障碍,请使用障碍功能。

此属性仅阅读。

场景中包含的停车场,指定为异质阵列ParkingLot对象。要在驾驶场景中添加停车场,请使用停车场功能。

此属性仅阅读。

道路网络起源的地理坐标,被指定为表格的三元素数字行矢量[拉特,,alt], 在哪里:

  • 拉特是坐标的纬度。

  • 是坐标的经度。

  • alt是以米为单位的坐标的高度。

这se values are with respect to the WGS84 reference ellipsoid, which is a standard ellipsoid used by GPS data.

您可以设置地理当您创建驾驶场景时。这公路网function also sets this property when you import roads into an empty driving scenario.

  • 如果您通过指定坐标导入道路,则公路网功能集地理到第一个(或仅)指定的坐标。

  • 如果您通过指定区域或地图文件导入道路,则公路网sets地理to the center point of the region or map.

公路网功能覆盖任何先前设置的地理价值。

在里面驾驶场景设计师应用程序,当您导入地图数据并导出一个drivingScenario对象,地理property of that object is set to the geographic reference of the app scenario.

通过将这些坐标指定为原始latlon2local功能,您可以将驱动路线的地理坐标转换为驾驶场景的本地坐标。然后,您可以在情况下将此转换后的路线指定为车辆轨迹。

如果您的驾驶场景不使用地理坐标,则地理是一个空数组,[]

Object Functions

展开全部

advance 提前驾驶场景模拟一个时间步骤
plot 情节驾驶场景
record 运行驾驶场景和记录演员状态
重新开始 Restart driving scenario simulation from beginning
updatePlots 更新驾驶场景图
export Export driving scenario toAsam Opendrive或者ASAM OpenSCENARIO文件
actor 将演员添加到驾驶场景中
演员 在驾驶场景中,演员的位置,速度和方向
ActorProfiles Physical and radar characteristics of actors in driving scenario
车辆 将车辆添加到驾驶场景
障碍 在驾驶场景中添加障碍
chaseplot 以自我为中心的投射观点
trajectory 在驾驶场景中创建演员或车辆轨迹
光滑的标题 Create smooth, jerk-limited actor trajectory in driving scenario
targetPoses 目标位置和方向相对于自我车辆
targetOutlines 演员观看的目标大纲
驾驶。Scenario.targetstoego 将目标姿势从方案转换为自我坐标
driving.scenario.targetsToScenario 将目标姿势从自我转换为场景坐标
将道路添加到驾驶场景或道路组
公路网 将道路网络添加到驾驶场景
路边 Get road boundaries
驾驶 Convert road boundaries to ego vehicle coordinates
lanespec 创建道路车道规格
laneMarking 创建道路车道标记物体
LANEMARKINGVERTICES 车道标记顶点和面孔在驾驶场景中
currentLane Get current lane of actor
车道 获取演员巷的车道边界
clothoidLaneBoundary Clothoid-shaped lane boundary model
ComputeBoundaryModel 计算车道边界点从插座车道边界模型
laneType Create road lane type object
停车场 在驾驶场景中添加停车场
parkingSpace Define parking space for parking lot
insertParkingSpaces Insert parking spaces into parking lot
ParkingLaneMarkingVertices 在驾驶场景中标记顶点和面孔的停车道

例子

全部收缩

Create a driving scenario containing a curved road, two straight roads, and two actors: a car and a bicycle. Both actors move along the road for 60 seconds.

Create the driving scenario object.

方案= drivingscenario('采样时间',0.1','StopTime',60);

Create the curved road using road center points following the arc of a circle with an 800-meter radius. The arc starts at 0°, ends at 90°, and is sampled at 5° increments.

angs = [0:5:90]'; R = 800; roadcenters = R*[cosd(angs) sind(angs) zeros(size(angs))]; roadwidth = 10; road(scenario,roadcenters,roadwidth);

使用两端的道路中心点添加两条默认宽度的直线道路。

Roadcenters = [700 0 0;100 0 0];路(场景,公路中心)
ans = Road with properties: Name: "" RoadID: 2 RoadCenters: [2x3 double] RoadWidth: 6 BankAngle: [2x1 double] Heading: [2x1 double]
Roadcenters = [400 400 0;0 0 0];路(场景,公路中心)
ans = Road with properties: Name: "" RoadID: 3 RoadCenters: [2x3 double] RoadWidth: 6 BankAngle: [2x1 double] Heading: [2x1 double]

获得道路界限。

rbdry = Roadbouldaries(方案);

在场景中添加汽车和自行车。将汽车定位在第一条直路的开头。

车=车辆(场景中,'ClassID',1,'位置',[700 0 0],...'长度',3,'宽度',2,'高度',1.6);

Position the bicycle farther down the road.

bicycle = actor(scenario,'ClassID',3,'位置',[706 376 0]',,...'长度',2,'宽度',0.45,'高度',1.5);

Plot the scenario.

情节(场景,“中心线”,'on',“公路中心”,'on');标题('设想');

图包含一个轴对象。带有标题方案的轴对象包含1219个类型补丁的对象。

显示演员的姿势和个人资料。

姿势= actorposes(场景)
姿势=带有字段的2×1结构数组:演员ID Position Velocity Roll Pitch Yaw AngularVelocity
profiles = actorProfiles(scenario)
配置文件=带有字段的2×1结构数组:ActorId classid长度宽度高度原始网格网格网格rcspattern rcsazimuthangles rcselevationangles

创建驾驶场景,并显示目标概述如何随着模拟的进展而发生变化。

创建一个由两条相交的直路组成的驾驶场景。第一个路段长45米。第二条道路长32米,沿着它的边缘沿着泽西岛的屏障,并与第一条道路相交。一辆沿​​着第一条道路以每秒12.0米的速度行驶的汽车接近跑步的行人,以每秒2.0米的距离越过交叉路口。

方案= drivingscenario('采样时间',0.1,'StopTime',1);ROAD1 = ROAD(方案,[-10 0 0; 45 -20 0]);ROAD2 = ROAD(方案,[-10 -10 0; 35 10 0]);障碍(场景,ROAD1)障碍(场景,Road1,'roudedge','剩下')ped =演员(场景,'ClassID',4,'长度',0.4,'宽度',0.6,'高度',1.7); car = vehicle(scenario,'ClassID',1);pedspeed = 2.0;Carspeed = 12.0;光滑的标题(ped,[15 -3 0; 15 3 0],pedspeed);光滑的标题(汽车,[-10 -10 0; 35 10 0],carspeed);

Create an ego-centric chase plot for the vehicle.

chaseplot(汽车,“中心线”,'on')

创建一个空的鸟眼情节,并添加轮廓绘图仪和车道边界绘图仪。然后,运行模拟。在每个模拟步骤中:

  • 更新追逐图以显示道路边界和目标大纲。

  • 更新Bird's-eye图,以显示更新的道路边界和目标大纲。情节的观点始终与自我车辆有关。

bepplot = birdseyeplot('xlim',[-50 50],'YLim',[-40 40]);outlinePlotter = utlinePlotter(bepplot);laneplotter = laneboundaryplotter(bepplot);传奇('离开')尽管Advance(场景)RB = Roadbouldaries(CAR);[位置,偏航,长度,宽度,原点,颜色] = targetOutlines(car);[bposition,byaw,blength,bwidth,boriginOffset,bcolor,barriersegments] = targetOutlines(汽车,“障碍”);PlotLaneBoundary(LANEPLOTTER,RB)PLOTOUTLINE(轮廓图,位置,偏航,长度,宽度,...“原点”,originOffset,'颜色',颜色)plotBarrierOutline(大纲,壁垒,bposition,bposition,byaw,blength,bwidth,...“原点”,boriginOffset,'颜色',bcolor)暂停(0.01)end

图包含一个轴对象。轴对象为空。

创建一个驾驶场景,其中包含自我车辆和沿着三车道道路行驶的目标车辆。通过使用视觉检测发生器检测车道边界。

方案= drivingscenario;

使用车道规格创建三车道的道路。

路Centers = [0 0 0; 60 0 0; 120 30 0]; lspc = lanespec(3); road(scenario,roadCenters,“车道”,LSPC);

指定自我vehicle follows the center lane at 30 m/s.

egovehicle =车辆(场景,'ClassID',1);egopath = [1.5 0 0;60 0 0;111 25 0];Egospeed = 30;光滑的标题(Egovhicle,Egopath,Egospeed);

指定目标车辆以40 m/s的速度在自我车辆前行驶,并更换靠近自我车辆的车道。

targetcar = vehicle(scenario,'ClassID',1);targetPath = [8 2;60 -3.2;120 33];targetspeed = 40;光滑的标题(TargetCar,TargetPath,TargetSpeed);

在自我车辆后面显示一个环境的3-D视图。

chaseplot(egovehicle)

Create a vision detection generator that detects lanes and objects. The pitch of the sensor points one degree downward.

VisionSenSor = VisionDetectiongenerator('沥青',1.0);VisionSensor.detectorOutput =“车道和物体”;VisionsEnsor.actorProfiles = ActorProfiles(方案);

运行模拟。

  1. 创建一个鸟的眼情节和相关的绘图仪。

  2. 显示传感器覆盖区域。

  3. 显示车道标记。

  4. 在道路上获得目标的地面真相姿势。

  5. 获得理想的车道边界指向高达60 m。

  6. 从理想目标姿势和车道边界产生检测。

  7. 显示目标的轮廓。

  8. Display object detections when the object detection is valid.

  9. 当车道检测有效时,显示车道边界。

bep = birdseyeplot('xlim',[0 60],'YLim',[-35 35]);caplotter = coverAgeAreaeAplotter(BEP,'显示名称','覆盖区域',...“ faceColor”,'蓝色的');DITPLOTTER =检测Plotter(BEP,'显示名称',“对象检测”);lmplotter = lanemarkingPlotter(BEP,'显示名称',“车道标记”);lbplotter = LaneboundaryPlotter(BEP,'显示名称',...“车道边界检测”,'颜色','red');olplotter = utlinePlotter(BEP);PlotCoverageArea(Caplotter,Visionsensor.sensorlocation,...VisionSensor.maxrange,Visionsensor.yaw,...VisionSensor.FieldOfView(1));尽管预先(场景)[LMV,LMF] = LANEMARKINGVERTICES(EGOVEHICLE);PlotLaneMarking(LMPLOTTER,LMV,LMF)TGTPOSE = targetpose(Egovehicle);lookaheaddistance = 0:0.5:60;lb =车道(egovehicle,'XDistance',lookaheaddistance,'LocationType','内');[obdets,nobdets,abvalid,lb_dets,nlb_dets,lbvalid] =...VisionSenSor(tgtpose,lb,scenario.simulationtime);[objposition,objyaw,objlength,objwidth,objoriginOffset,color] = targetoutlines(egovehicle);plotOutline(橄榄球,objposition,objyaw,objlength,objwidth,...“原点”,objoriginOffset,'颜色',颜色)如果明显的detpos = cellfun(@(d)d.measurement(1:2),obdets,“统一输出”,false); detPos = vertcat(zeros(0,2),cell2mat(detPos')'); plotDetection(detPlotter,detPos)end如果lbvalid plotlaneboundary(lbplotter,vertcat(lb_dets.laneboundaries))endend

算法

展开全部

Version History

Introduced in R2017a