Skip to content
Snippets Groups Projects
Unverified Commit 042dfdba authored by crthilakraj's avatar crthilakraj Committed by GitHub
Browse files

Issue 1608 segmentation fault planner server node master (#1612)


* corrected wrong indexing in NavfnPlanner::smoothApproachToGoal function

* resolved uncrustify errors

* corrected the condition inside NavfnPlanner::smoothApproachToGoal to replace last pose of computed path

Co-authored-by: default avatarchikmagalore.thilak <chikmagalore.thilak@bshg.com>
parent 9ab0bf35
No related branches found
No related tags found
No related merge requests found
......@@ -257,19 +257,20 @@ NavfnPlanner::smoothApproachToGoal(
{
// Replace the last pose of the computed path if it's actually further away
// to the second to last pose than the goal pose.
auto second_to_last_pose = plan.poses.end()[-2];
auto last_pose = plan.poses.back();
if (
squared_distance(last_pose.pose, second_to_last_pose.pose) >
squared_distance(goal, second_to_last_pose.pose))
{
plan.poses.back().pose = goal;
} else {
geometry_msgs::msg::PoseStamped goal_copy;
goal_copy.pose = goal;
plan.poses.push_back(goal_copy);
if (plan.poses.size() >= 2) {
auto second_to_last_pose = plan.poses.end()[-2];
auto last_pose = plan.poses.back();
if (
squared_distance(last_pose.pose, second_to_last_pose.pose) >
squared_distance(goal, second_to_last_pose.pose))
{
plan.poses.back().pose = goal;
return;
}
}
geometry_msgs::msg::PoseStamped goal_copy;
goal_copy.pose = goal;
plan.poses.push_back(goal_copy);
}
bool
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment