BinaryOccupancyGrid map created with Image Labeler

조회 수: 8 (최근 30일)
Ivan Enzo
Ivan Enzo 2024년 2월 4일
댓글: Ivan Enzo 2024년 2월 17일
Dear MATLAB Community,
CONTEXT: I am working on a global planner based on a multilayermap where there is a layer coming from a DEM file and a layer where obstacles are specified (very similar to this example, just for reference -> https://it.mathworks.com/help/nav/ug/offorad-planning-on-digital-elevation-models.html). In a similar way to what has been performed in the use case shown here (webinar: https://it.mathworks.com/videos/design-and-simulating-autonomy-for-construction-vehicles-1679066541903.html) i used the Image Labeler to have a labeled image with obstacles, which then i successfully converted in a binaryOccupancyGrid object.
PROBLEM: after the previous passages, my map is ready to be used for planning. I tried to use PlannerAstrGrid as in the first example. When i specify the start and goal positions (in grid coords because i manually choose them from the displayed map), i check their validity on the map using checkOccupancy(map, start) and for both start and goal i get "0". However, when i call the plan function, i get an error from the plannerAStarGrid/validateStartGoal telling me that the start position is not valid because its occupied (despite the checkOccupancy result).
MY GUESS: to me i seems like the map is good but actually not, like there is some sort of mismatch i cannot directly see (maybe coming from the Labeler itself?) because when i create the multilayermap project eerything works fine, i can even see the occupancygrid map itself and both the start/goal poses to be in free space indeed. It might be me being wrong in defining the coordinates (like messing with word/grid/local reference frames).
Anyway ,here is my code (unfortunatley I am not able to share the map file due to permissions issues)
Thank you in advance for any answer/support!
start = [838 207]; % [x, y] , GRID COORDS
goal = [510 1116];
map = multimap.getLayer('envObstaclesFilt');
dummyplanner = plannerAStarGrid(map);
show(dummyplanner.Map)
path = plan(dummyplanner, start, goal, "grid");

채택된 답변

Cameron Stabile
Cameron Stabile 2024년 2월 5일
편집: Cameron Stabile 2024년 2월 5일
Hi Ivan,
Based on your problem description, it appears that start/goal are defined with respect to the world frame (i.e. xy cartesian) since that is the default frame when calling checkOccupancy(map,xy), whereas your planner is accepting those same values as though they were "grid" (IJ with respect to top-left corner of the matrix inside the map) coordinates (which is the default for plannerAStarGrid.plan).
Can you verify whether the issue resolves itself by either removing "grid" from your call to plan, or by converting your xy start/goal to grid using world2grid.
You can also use the Occupancy Grids documentation page if you need to double check the different coordinate systems and the location of their origins with respect to each other.
Best,
Cameron
  댓글 수: 1
Ivan Enzo
Ivan Enzo 2024년 2월 17일
Dear Cameron, sorry for the delayed responde
The day after I posted this question, I made your suggested changes and it worked well so, yes indeed that was the problem.
Thank you for the help.
Best,
IE

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Motion Planning에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by