vehicleCostmap function inverts my data from lidar sensor

조회 수: 1 (최근 30일)
JIAN-HONG YE ZHU
JIAN-HONG YE ZHU 2023년 3월 29일
답변: Ranjeet 2023년 4월 7일
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