vehicleCostmap function inverts my data from lidar sensor
1 view (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
Ranjeet
on 7 Apr 2023
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 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!