How to display Vehicle name and it's distance from ego vehicle with birdsEyePlot() function.
1 次查看(过去 30 天)
显示 更早的评论
At present i am able to simulate road conditions and radar detections . i used drivingRadarDataGenerator() and createDrivingScenario objects for simulations.
using
bep = birdsEyePlot('XLim',[0 60],'YLim',[-75 75]); to plot the detections and road conditions.
using below function for detectons..
clusterDetPlotter = detectionPlotter(bep, ...
'DisplayName','Clustered detections', ...
'MarkerEdgeColor','red', ...
'MarkerFaceColor','red');
using below function to plot the detection using birdsEyePlot() function.
plotDetection(clusterDetPlotter,detPos);
With below code i was able to measure the target vehicle distance from the ego vehicle but not able to display that measurement on bird's eye plot on the screen.
for c=1:numDets
sqrX = targets(c).Position(1) *targets(c).Position(1);
sqrY = targets(c).Position(2) *targets(c).Position(2);
distance_target(c)= sqrt(sqrX+sqrY);
end
How can i display distance of target vehicle wrt to ego vehicle on birds eye plot??
0 个评论
回答(1 个)
Raghava S N
2025-4-9
The distances of the targets in the "distance_target" vector can be converted to strings and passed as labels to the "plotDetection" function. To convert the distances captured in the "distance_target" vector, you may use the function "num2str" in an "arrayfun" function to apply it to all the elements of "distance_target"-
labels = arrayfun(@num2str, distance_target,'UniformOutput', false);
After this, call "plotDetection" to plot the targets with the distances as the labels-
plotDetection(clusterDetPlotter,detPos,labels);
For more details about labels in the "plotDetection" function, you may refer to this link - https://www.mathworks.com/help/radar/ref/theaterplot.plotdetection.html#:~:text=10%2C%20%2D4%2C%201%5D%3B-,labels,-%3D%20%7B%27R1%27
For information about "num2str" and "arrayfun", you may refer to these links-
Hope that helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Programmatic Scenario Authoring 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!