OpenMowerNext icon indicating copy to clipboard operation
OpenMowerNext copied to clipboard

Logical Issues Regarding Map Rendering

Open lxb20251022 opened this issue 1 month ago • 0 comments

hello @jkaflik ,I have a question about “Logical Issues Regarding Map Rendering”

  1. EXCLUSION = 0 (Forbidden Zone), NAVIGATION = 1 (Working Area), OPERATION = 2 (Navigation Area)

  2. In the areasWithExclusionsLast function, sorting is done in ascending order. // Project Source Code std::vectormsg::Area MapServerNode::areasWithExclusionsLast(std::vectormsg::Area areas) { std::sort(areas.begin(), areas.end(), [](const msg::Area& a, const msg::Area& b) { if (a.type == b.type) // If the types are the same { return a.type == msg::Area::TYPE_EXCLUSION; // TYPE_EXCLUSION Forbidden Zone }

    return a.type < b.type; // Otherwise, sort by type value Forbidden Zone });

return areas; } 3. According to this logic: First drawn: EXCLUSION(0) → Value = 100 (Obstacle) Then drawn: NAVIGATION(1) → Value = 0 (Free Space) Finally drawn: OPERATION(2) → Value = 0 (Free Space) Following this overlay logic, the initially drawn forbidden zones get overwritten and become free areas, which causes the forbidden zones to effectively not function! 4. I believe the drawing order should be: NAVIGATION(1) → OPERATION(2) → EXCLUSION(0) 5. My modified areasWithExclusionsLast: std::sort(areas.begin(), areas.end(), [](const msg::Area& a, const msg::Area& b) { // Primarily sort by type, but ensure exclusions are last if (a.type == msg::Area::TYPE_EXCLUSION && b.type != msg::Area::TYPE_EXCLUSION) { return false; // Exclusions come after non-exclusions } if (a.type != msg::Area::TYPE_EXCLUSION && b.type == msg::Area::TYPE_EXCLUSION) { return true; // Non-exclusions come before exclusions } // Maintain original order when types are the same return a.type < b.type; });

lxb20251022 avatar Nov 18 '25 02:11 lxb20251022