roadCenters = [-150, -150; 150,150; -150, 150; 150, -150; -150, -150]
添加道路:道路上有中心点、车道(车道规格、车道宽)road(scenario, roadCenters, 'Lanes', lanespec([4, 4]))
绘制场景(及其道路中心点、中心线、路由点)plot(scenario, 'RoadCenters', 'on', 'Centerline', 'on', 'Waypoints', 'on')
道路边界 roadBoundaries = roadBoundaries(scenario)
trajectory(vehicle, waypoints, speed)
1.1
绘制场景(及其道路中心点、中心线、路由点)plot(scenario, 'RoadCenters', 'on', 'Centerline', 'on', 'Waypoints', 'on')
scenario = drivingScenario;
设置道路中心
>> roadCenters = [-150, -150; 150,150; -150, 150; 150, -150; -150, -150]
>> road(scenario, roadCenters)
>> plot(scenario)
>> plot(scenario, 'Centerline', 'on')
>> plot(scenario, 'RoadCenters', 'on')
>> plot(scenario, 'Centerline', 'on', 'RoadCenters', 'on')
1.2
添加道路:道路上有中心点、车道(车道规格、车道宽)
road(scenario, roadCenters, 'Lanes', lanespec([4, 4]))
1.3
添加车辆
car = vehicle(scenario, 'ClassID', 1, 'Position', [1, 1.8, 0])
car =
Vehicle - 属性:
ActorID: 1
ClassID: 1
PlotColor: [0 0.4470 0.7410]
Position: [1 1.8000 0]
Velocity: [0 0 0]
Yaw: 0
Pitch: 0
Roll: 0
AngularVelocity: [0 0 0]
Length: 4.7000
Width: 1.8000
Height: 1.4000
Mesh: [1×1 extendedObjectMesh]
RCSPattern: [2×2 double]
RCSAzimuthAngles: [-180 180]
RCSElevationAngles: [-90 90]
FrontOverhang: 0.9000
RearOverhang: 1
Wheelbase: 2.8000
1.4
有路由点和车速,就可以记录车辆轨迹
trajectory(vehicle, waypoints, speed)
while advance(scenario)
pause(0.1)
end