vehicleCostmap function inverts my data from lidar sensor

1 次查看(过去 30 天)
Hello, I used the vehicleCostmap function to create a map for path planning. The problem is this function is inverting my data vertically.
I tried using set(gca,'YDir','reverse') however when using this, the y axis information is also the other way round so the 'coordinates' are not actually correct.
This is my lidar data displayed using surf.
This is the costmap created using the vehicleCostmap function.
This is the costmap when I use set(gca,'YDir','reverse'), using this the points are in the right place but the coordinates value are also "inverted" (shown in a blue rectangle).
Is there a way to make the vehicleCostMap function display my lidar data in the 'correct' direction?
The lidar data consists of a double matrix of zeros and ones, where zero (dark blue) is empty and one (yellow) is an obstacle.

采纳的回答

Ranjeet
Ranjeet 2023-4-7
Hi Jian,
Can you provide the MATLAB version you are using. I tried to run the following code in MATLAB R2022b, and there is no costmap inversion.
% example lidar data as indicated in the question
lidar_data = zeros(400, 400);
lidar_data(200:256, 200:220) = 1;
lidar_data(100:156, 50:78) = 1;
lidar_data(132:156, 1:78) = 1;
imshow(lidar_data);
% create vehicle costmap
costf = vehicleCostmap(lidar_data);
figure;
plot(costf);

更多回答(0 个)

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by