Fix costmap-resize reinit leak: refresh snapshot instead of recreating planner state

makePlan() no longer tears down and reallocates Spline_Inf/Curve_common when
the costmap size or footprint changes — the snapshot is only used to detect
the change, so refresh it in place. Destructor now frees the two allocations.
initialize() validates the costmap pointer before use.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-12 21:17:45 +07:00
parent 7c84705ce7
commit c16f846136
2 changed files with 134 additions and 70 deletions

View File

@@ -90,7 +90,7 @@ public:
return false;
}
virtual ~CustomPlanner(){};
~CustomPlanner() override;
private:
void publishStats(int solution_cost, int solution_size,
@@ -101,10 +101,10 @@ private:
const std::vector<robot_geometry_msgs::Point>& footprint,
std::vector<robot_geometry_msgs::Point>& out_footprint);
Pose pointOnAngleBisector(Pose& A, Pose& B, Pose& C, double length = 1.0);
bool countRobotDirectionChangeAngle(vector<Pose>& savePosesOnEdge, int& total_edge);
Pose pointOnAngleBisector(Pose& A, Pose& B, Pose& C, double length);
inline bool isOppositeSign(double angleA, double angleB)
{
return (angleA > 0 && angleB < 0) || (angleA < 0 && angleB > 0);
@@ -172,4 +172,3 @@ private:
}
#endif