BinaryOccupancyGrid map created with Image Labeler
4 views (last 30 days)
Show older comments
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");
0 Comments
Accepted Answer
Cameron Stabile
on 5 Feb 2024
Edited: Cameron Stabile
on 5 Feb 2024
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
More Answers (0)
See Also
Categories
Find more on Motion Planning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!