Skip to content

Commit 85bedda

Browse files
committed
Revert "include bug fix for nav2_smac_planner (#5198)"
This reverts commit 6a74ba6.
1 parent 3b11d0f commit 85bedda

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

‎nav2_smac_planner/include/nav2_smac_planner/analytic_expansion.hpp‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,14 @@ class AnalyticExpansion
112112

113113
/**
114114
* @brief Refined analytic path from the current node to the goal
115-
* @param node The node to start the analytic path from. Node head may
116-
* change as a result of refinement
115+
* @param current_node The node to start the analytic path from
117116
* @param goal_node The goal node to plan to
118117
* @param getter The function object that gets valid nodes from the graph
119118
* @param analytic_nodes The set of analytic nodes to refine
120119
* @return The score of the refined path
121120
*/
122121
float refineAnalyticPath(
123-
NodePtr & node,
122+
const NodePtr & current_node,
124123
const NodePtr & goal_node,
125124
const NodeGetter & getter,
126125
AnalyticExpansionNodes & analytic_nodes);

‎nav2_smac_planner/src/analytic_expansion.cpp‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ typename AnalyticExpansion<NodeT>::NodePtr AnalyticExpansion<NodeT>::tryAnalytic
6666

6767
AnalyticExpansionNodes current_best_analytic_nodes = {};
6868
NodePtr current_best_goal = nullptr;
69-
NodePtr current_best_node = nullptr;
7069
float current_best_score = std::numeric_limits<float>::max();
7170

7271
closest_distance = std::min(
@@ -98,15 +97,13 @@ typename AnalyticExpansion<NodeT>::NodePtr AnalyticExpansion<NodeT>::tryAnalytic
9897
current_node->motion_table.state_space);
9998
if (!analytic_nodes.empty()) {
10099
found_valid_expansion = true;
101-
NodePtr node = current_node;
102-
float score = refineAnalyticPath(
103-
node, current_goal_node, getter, analytic_nodes);
100+
bool score = refineAnalyticPath(
101+
current_node, current_goal_node, getter, analytic_nodes);
104102
// Update the best score if we found a better path
105103
if (score < current_best_score) {
106104
current_best_analytic_nodes = analytic_nodes;
107105
current_best_goal = current_goal_node;
108106
current_best_score = score;
109-
current_best_node = node;
110107
}
111108
}
112109
}
@@ -119,15 +116,13 @@ typename AnalyticExpansion<NodeT>::NodePtr AnalyticExpansion<NodeT>::tryAnalytic
119116
current_node, current_goal_node, getter,
120117
current_node->motion_table.state_space);
121118
if (!analytic_nodes.empty()) {
122-
NodePtr node = current_node;
123-
float score = refineAnalyticPath(
124-
node, current_goal_node, getter, analytic_nodes);
119+
bool score = refineAnalyticPath(
120+
current_node, current_goal_node, getter, analytic_nodes);
125121
// Update the best score if we found a better path
126122
if (score < current_best_score) {
127123
current_best_analytic_nodes = analytic_nodes;
128124
current_best_goal = current_goal_node;
129125
current_best_score = score;
130-
current_best_node = node;
131126
}
132127
}
133128
}
@@ -136,7 +131,7 @@ typename AnalyticExpansion<NodeT>::NodePtr AnalyticExpansion<NodeT>::tryAnalytic
136131

137132
if (!current_best_analytic_nodes.empty()) {
138133
return setAnalyticPath(
139-
current_best_node, current_best_goal,
134+
current_node, current_best_goal,
140135
current_best_analytic_nodes);
141136
}
142137
analytic_iterations--;
@@ -278,11 +273,12 @@ typename AnalyticExpansion<NodeT>::AnalyticExpansionNodes AnalyticExpansion<Node
278273

279274
template<typename NodeT>
280275
float AnalyticExpansion<NodeT>::refineAnalyticPath(
281-
NodePtr & node,
276+
const NodePtr & current_node,
282277
const NodePtr & goal_node,
283278
const NodeGetter & getter,
284279
AnalyticExpansionNodes & analytic_nodes)
285280
{
281+
NodePtr node = current_node;
286282
NodePtr test_node = node;
287283
AnalyticExpansionNodes refined_analytic_nodes;
288284
for (int i = 0; i < 8; i++) {
@@ -411,7 +407,7 @@ getAnalyticPath(
411407

412408
template<>
413409
float AnalyticExpansion<Node2D>::refineAnalyticPath(
414-
NodePtr &,
410+
const NodePtr &,
415411
const NodePtr &,
416412
const NodeGetter &,
417413
AnalyticExpansionNodes &)

‎nav2_smac_planner/test/test_a_star.cpp‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,7 @@ TEST(AStarTest, test_a_star_2d)
141141
int dummy_int2 = 0;
142142
EXPECT_EQ(expander.tryAnalyticExpansion(nullptr, {}, {}, {},
143143
nullptr, dummy_int1, dummy_int2), nullptr);
144-
145-
nav2_smac_planner::Node2D * start = nullptr;
146-
EXPECT_EQ(expander.refineAnalyticPath(start, nullptr, nullptr,
144+
EXPECT_EQ(expander.refineAnalyticPath(nullptr, nullptr, nullptr,
147145
analytic_expansion_nodes), std::numeric_limits<float>::max());
148146
nav2_smac_planner::AnalyticExpansion<nav2_smac_planner::Node2D>::AnalyticExpansionNodes
149147
expected_nodes = expander.getAnalyticPath(nullptr, nullptr, nullptr, nullptr);

0 commit comments

Comments
 (0)