drivingScenario
Create driving scenario
描述
这drivingScenario
物体代表一个3D竞技场,其中包含道路,停车场,车辆,行人,障碍和驾驶场景的其他方面。使用此对象对现实的流量情景进行建模,并生成用于测试控制器或传感器融合算法的合成检测。
您还可以通过使用驾驶场景设计师应用程序。此外,您可以导出drivingScenario
该应用程序中的对象生成方案变化,以用于应用程序或在simulink中万博1manbetx®。有关更多详细信息,请参阅以编程方式创建驾驶场景变化。
创建
描述
创建一个空的驾驶场景。设想
= DrivingsCenario
设置设想
= drivingscenario(名称,价值
)SampleTime
,StopTime
, 和地理
使用名称值对的属性。例如,DrivingsCenario('Georeference',[42.3 -71.0 0])
将场景的地理起源设置为(42.3,–71.0)的纬度尺度坐标和0。
特性
SampleTime
—方案模拟步骤之间的时间间隔
0.01
(默认)|积极的真实标量
方案模拟步骤之间的时间间隔, specified as a positive real scalar. Units are in seconds.
例子:1.5
StopTime
—模拟的结束时间
inf
(默认)|积极的真实标量
模拟的结束时间,指定为正实量表。单位在几秒钟内。默认值StopTime
的inf
当第一演员到达其轨迹的末端时,会导致模拟结束。
例子:60.0
仿真时间
—当前模拟时间
非负实际标量
此属性仅阅读。
模拟的当前时间,指定为非负实量表。要将时间重置为零,请致电重新开始
功能。单位在几秒钟内。
IsRunning
—仿真状态
真的
|false
此属性仅阅读。
模拟状态,指定为真的
或者false
。如果模拟正在运行,IsRunning
是真的
。
障碍
—场景中包含的障碍
异构阵列Barrier
objects
此属性仅阅读。
障碍contained in the scenario, specified as a heterogeneous array ofBarrier
对象。要在驾驶场景中增加障碍,请使用障碍
功能。
停车场
—场景中包含的停车场
异构阵列ParkingLot
objects
此属性仅阅读。
场景中包含的停车场,指定为异质阵列ParkingLot
对象。要在驾驶场景中添加停车场,请使用停车场
功能。
地理
—Geographic coordinates of road network origin
形式的三元素数字行向量[拉特
,朗
,alt
]
此属性仅阅读。
道路网络起源的地理坐标,被指定为表格的三元素数字行矢量[拉特
,朗
,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
Scenarios
演员
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 |
将目标姿势从自我转换为场景坐标 |
道路
车道
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');标题('设想');
显示演员的姿势和个人资料。
姿势= actorposes(场景)
姿势=带有字段的2×1结构数组:演员ID Position Velocity Roll Pitch Yaw AngularVelocity
profiles = actorProfiles(scenario)
配置文件=带有字段的2×1结构数组:ActorId classid长度宽度高度原始网格网格网格rcspattern rcsazimuthangles rcselevationangles
Show Target Outlines in Driving Scenario Simulation
创建驾驶场景,并显示目标概述如何随着模拟的进展而发生变化。
创建一个由两条相交的直路组成的驾驶场景。第一个路段长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(方案);
运行模拟。
创建一个鸟的眼情节和相关的绘图仪。
显示传感器覆盖区域。
显示车道标记。
在道路上获得目标的地面真相姿势。
获得理想的车道边界指向高达60 m。
从理想目标姿势和车道边界产生检测。
显示目标的轮廓。
Display object detections when the object detection is valid.
当车道检测有效时,显示车道边界。
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
算法
Specify Actor Motion in Driving Scenarios
为了在驾驶场景中指定演员的动作,您可以为演员定义轨迹或手动指定动作。
这trajectory
和光滑的标题
functions determine actor pose properties based on a set of waypoints and the speeds at which the actor travels between those waypoints. Actor pose properties are position, velocity, roll, pitch, yaw, and angular velocity. With this approach, motion is defined by speed, not velocity, because the trajectory determines the direction of motion.
这光滑的标题
函数还根据航路点,速度和最大纵向混蛋确定行为者之间的加速度。
这actor moves along the trajectory each time theadvance
函数被调用。您可以在模拟过程中随时手动更新演员构图。但是,这些属性在下一个调用到advance
。
当您手动指定演员运动时,设置速度或角速度属性不会自动以连续的呼叫将演员移动到advance
功能。因此,您必须使用自己的运动模型在每个仿真时间步骤中更新位置,速度和其他姿势参数。
Version History
See Also
应用
Objects
matlab命令
You clicked a link that corresponds to this MATLAB command:
通过在MATLAB命令窗口中输入该命令。Web浏览器不支持MATLAB命令。万博1manbetx
您还可以从以下列表中选择一个网站:
如何获得最佳网站性能
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
美洲
- AméricaLatina(Español)
- 加拿大(英语)
- 美国(英语)