“chasePlot” doesn't show ego vehicle

조회 수: 1 (최근 30일)
cui,xingxing
cui,xingxing 2022년 7월 18일
편집: Adam Danz 2023년 5월 23일
why the following code did not show egovhicle? I try to set chasePlot propertites ViewLocation to larger than default,but it still can't show egovhicle? how can i fixt it?(run in R2022a)
scenario = drivingScenario("SampleTime",0.01,"StopTime",3);
roadNetwork(scenario,"OpenStreetMap","my_openstreetmap_export.xml");% openstreetmap xml file see attachment
egovhicle = vehicle(scenario,ClassID=1);
egopath = [-133,-388,0;-98,-266,0];
egospeed = 30;
smoothTrajectory(egovhicle,egopath,egospeed);
chasePlot(egovhicle)
  댓글 수: 3
cui,xingxing
cui,xingxing 2022년 7월 19일
hi,the data is in attachment
Adam Danz
Adam Danz 2022년 7월 19일
Thanks!

댓글을 달려면 로그인하십시오.

채택된 답변

Adam Danz
Adam Danz 2022년 7월 19일
편집: Adam Danz 2022년 7월 19일
chasePlot is outside my area of expertise but I did some digging found that if you change the ViewLocation of the scene then your vehicle comes into view.
The default ViewLocation is behind the actor's center at 2.5x the length of the actor. Your vehicle length is 4.7 but for whatever reason, the viewLocation needs to be back even further. This value worked.
chasePlot(egovhicle,'ViewLocation', [-32,0])
This may indicate that there's something not right with your scene or vehicle properties or that there is a bug. If you think there's a bug, please contact tech support and supply your code and data file. Contact Us - MATLAB & Simulink
It may be helpful to trouble shoot by plotting the scene with a top-down view
% Look at a bird's eye view to see where the vehicle is
plot(scenario)
% It's a large scene which makes the vehicle small, zoom in to the vehicle
xlim([-190 -90])
ylim([-440, -350])
  댓글 수: 1
Brandon Ballard
Brandon Ballard 2023년 5월 23일
Similar Problem occured when using the chasePlot after going from Matlab 2021a to Matlab 2023a. Scenario created fine but visualisation for the car patch or mesh did not appear for the duration of advancing the scenario. When changing the viewing angle between scenario advances the patch appeared in the correct location but the viewing angle would reset after advancing the scenario and it would disappear again.
Code worked fine in Matlab 2021a but does not work correctly in 2023a. After changing the viewing location of the camera chasing the vehicle to [-32, 0] the patch reappears. May be related to the dimensions of the road since the code being run was a 3 lane motorway with lane widths of 3.65m on a straight path. The standard example for the chasePlot works fine so it seems that for some road/lane specifications the Viewing Location must be changed.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by