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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1339839/image.png)
This is the costmap created using the vehicleCostmap function.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1339844/image.png)
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).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1339849/image.png)
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 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!