Files
NODEDC_MISSION_CORE/simulation/ai-polygon/navigation/patch_footprint.py
T

15 lines
808 B
Python

"""Apply one explicit adapter patch to the pinned CMU selector; fail on drift."""
from pathlib import Path
path = Path("/opt/cmu/src/local_planner/src/localPlanner.cpp")
source = path.read_text()
needle = " maxScore = clearPathPerGroupScore[i];\n selectedGroupID = i;"
replacement = """\
if (!missioncoreFootprintClear(*plannerCloudCrop, *startPaths[i % groupNum],
rotAng, pathScale, std::min(pathRange, relativeGoalDis),
vehicleLength, vehicleWidth, obstacleHeightThre, twoWayDrive)) continue;
maxScore = clearPathPerGroupScore[i];
selectedGroupID = i;"""
assert source.count(needle) == 1, "CMU selector source changed"
path.write_text('#include "missioncore_footprint.hpp"\n' + source.replace(needle, replacement))