“chasePlot” do't show ego vhicle?

3 views (last 30 days)
cui
cui on 18 Jul 2022
Edited: Adam Danz on 19 Jul 2022
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 Comments

Sign in to comment.

Accepted Answer

Adam Danz
Adam Danz on 19 Jul 2022
Edited: Adam Danz on 19 Jul 2022
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])

More Answers (0)

Community Treasure Hunt

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

Start Hunting!