Skip to content

Commit 29aead7

Browse files
SteveMacenskiJakub-husarz
authored andcommitted
Revert recent smac changes causing regressions (ros-navigation#5221)
* Revert "Prototype solving ros-navigation#5192 Issue 2: Reeds-Shepp reduce small reverse expansions (ros-navigation#5207)" This reverts commit c32873d. * Revert "include bug fix for nav2_smac_planner (ros-navigation#5198)" This reverts commit 6a74ba6. * Revert "Feat/smac planner include orientation flexibility (ros-navigation#4127)" This reverts commit f5543c3.
1 parent 11ef30e commit 29aead7

24 files changed

+174
-5288
lines changed

‎nav2_smac_planner/include/nav2_smac_planner/a_star.hpp‎

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include "nav2_smac_planner/node_hybrid.hpp"
3535
#include "nav2_smac_planner/node_lattice.hpp"
3636
#include "nav2_smac_planner/node_basic.hpp"
37-
#include "nav2_smac_planner/goal_manager.hpp"
3837
#include "nav2_smac_planner/types.hpp"
3938
#include "nav2_smac_planner/constants.hpp"
4039

@@ -57,9 +56,6 @@ class AStarAlgorithm
5756
typedef typename NodeT::CoordinateVector CoordinateVector;
5857
typedef typename NodeVector::iterator NeighborIterator;
5958
typedef std::function<bool (const uint64_t &, NodeT * &)> NodeGetter;
60-
typedef GoalManager<NodeT> GoalManagerT;
61-
typedef std::vector<GoalState<NodeT>> GoalStateVector;
62-
6359

6460
/**
6561
* @struct nav2_smac_planner::NodeComparator
@@ -96,8 +92,6 @@ class AStarAlgorithm
9692
* or planning time exceeded
9793
* @param max_planning_time Maximum time (in seconds) to wait for a plan, createPath returns
9894
* false after this timeout
99-
* @param lookup_table_size Size of the lookup table to store heuristic values
100-
* @param dim_3_size Number of quantization bins
10195
*/
10296
void initialize(
10397
const bool & allow_unknown,
@@ -133,15 +127,11 @@ class AStarAlgorithm
133127
* @param mx The node X index of the goal
134128
* @param my The node Y index of the goal
135129
* @param dim_3 The node dim_3 index of the goal
136-
* @param goal_heading_mode The goal heading mode to use
137-
* @param coarse_search_resolution The resolution to search for goal heading
138130
*/
139131
void setGoal(
140132
const float & mx,
141133
const float & my,
142-
const unsigned int & dim_3,
143-
const GoalHeadingMode & goal_heading_mode = GoalHeadingMode::DEFAULT,
144-
const int & coarse_search_resolution = 1);
134+
const unsigned int & dim_3);
145135

146136
/**
147137
* @brief Set the starting pose for planning, as a node index
@@ -166,6 +156,12 @@ class AStarAlgorithm
166156
*/
167157
NodePtr & getStart();
168158

159+
/**
160+
* @brief Get pointer reference to goal node
161+
* @return Node pointer reference to goal node
162+
*/
163+
NodePtr & getGoal();
164+
169165
/**
170166
* @brief Get maximum number of on-approach iterations after within threshold
171167
* @return Reference to Maximum on-approach iterations parameter
@@ -196,18 +192,6 @@ class AStarAlgorithm
196192
*/
197193
unsigned int & getSizeDim3();
198194

199-
/**
200-
* @brief Get the resolution of the coarse search
201-
* @return Size of the goals to expand
202-
*/
203-
unsigned int getCoarseSearchResolution();
204-
205-
/**
206-
* @brief Get the goals manager class
207-
* @return Goal manager class
208-
*/
209-
GoalManagerT getGoalManager();
210-
211195
protected:
212196
/**
213197
* @brief Get pointer to next goal in open set
@@ -228,6 +212,13 @@ class AStarAlgorithm
228212
*/
229213
inline NodePtr addToGraph(const uint64_t & index);
230214

215+
/**
216+
* @brief Check if this node is the goal node
217+
* @param node Node pointer to check if its the goal node
218+
* @return if node is goal
219+
*/
220+
inline bool isGoal(NodePtr & node);
221+
231222
/**
232223
* @brief Get cost of heuristic of node
233224
* @param node Node pointer to get heuristic for
@@ -251,11 +242,6 @@ class AStarAlgorithm
251242
*/
252243
inline void clearGraph();
253244

254-
/**
255-
* @brief Check if node has been visited
256-
* @param current_node Node to check if visited
257-
* @return if node has been visited
258-
*/
259245
inline bool onVisitationCheckNode(const NodePtr & node);
260246

261247
/**
@@ -276,11 +262,12 @@ class AStarAlgorithm
276262
unsigned int _x_size;
277263
unsigned int _y_size;
278264
unsigned int _dim3_size;
279-
unsigned int _coarse_search_resolution;
280265
SearchInfo _search_info;
281266

267+
Coordinates _goal_coordinates;
282268
NodePtr _start;
283-
GoalManagerT _goal_manager;
269+
NodePtr _goal;
270+
284271
Graph _graph;
285272
NodeQueue _queue;
286273

‎nav2_smac_planner/include/nav2_smac_planner/analytic_expansion.hpp‎

Lines changed: 10 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@
1515
#ifndef NAV2_SMAC_PLANNER__ANALYTIC_EXPANSION_HPP_
1616
#define NAV2_SMAC_PLANNER__ANALYTIC_EXPANSION_HPP_
1717

18-
#include <ompl/base/ScopedState.h>
19-
#include <ompl/base/spaces/DubinsStateSpace.h>
20-
#include <ompl/base/spaces/ReedsSheppStateSpace.h>
21-
22-
#include <string>
23-
#include <vector>
18+
#include <functional>
2419
#include <list>
2520
#include <memory>
21+
#include <string>
22+
#include <vector>
2623

2724
#include "nav2_smac_planner/node_2d.hpp"
2825
#include "nav2_smac_planner/node_hybrid.hpp"
@@ -38,10 +35,8 @@ class AnalyticExpansion
3835
{
3936
public:
4037
typedef NodeT * NodePtr;
41-
typedef std::vector<NodePtr> NodeVector;
4238
typedef typename NodeT::Coordinates Coordinates;
4339
typedef std::function<bool (const uint64_t &, NodeT * &)> NodeGetter;
44-
typedef typename NodeT::CoordinateVector CoordinateVector;
4540

4641
/**
4742
* @struct nav2_smac_planner::AnalyticExpansion::AnalyticExpansionNodes
@@ -64,33 +59,7 @@ class AnalyticExpansion
6459
Coordinates proposed_coords;
6560
};
6661

67-
/**
68-
* @struct AnalyticExpansionNodes
69-
* @brief Analytic expansion nodes and associated metadata
70-
*
71-
* This structure holds a collection of analytic expansion nodes and the number of direction
72-
* changes encountered during the expansion.
73-
*/
74-
struct AnalyticExpansionNodes
75-
{
76-
AnalyticExpansionNodes() = default;
77-
78-
void add(
79-
NodePtr & node,
80-
Coordinates & initial_coords,
81-
Coordinates & proposed_coords)
82-
{
83-
nodes.emplace_back(node, initial_coords, proposed_coords);
84-
}
85-
86-
void setDirectionChanges(int changes)
87-
{
88-
direction_changes = changes;
89-
}
90-
91-
std::vector<AnalyticExpansionNode> nodes;
92-
int direction_changes{0};
93-
};
62+
typedef std::vector<AnalyticExpansionNode> AnalyticExpansionNodes;
9463

9564
/**
9665
* @brief Constructor for analytic expansion object
@@ -110,22 +79,17 @@ class AnalyticExpansion
11079
/**
11180
* @brief Attempt an analytic path completion
11281
* @param node The node to start the analytic path from
113-
* @param coarse_check_goals Coarse list of goals nodes to plan to
114-
* @param fine_check_goals Fine list of goals nodes to plan to
115-
* @param goals_coords vector of goal coordinates to plan to
82+
* @param goal The goal node to plan to
11683
* @param getter Gets a node at a set of coordinates
11784
* @param iterations Iterations to run over
118-
* @param closest_distance Closest distance to goal
119-
* @return Node pointer reference to goal node with the best score out of the goals node if
120-
* successful, else return nullptr
85+
* @param best_cost Best heuristic cost to propertionally expand more closer to the goal
86+
* @return Node pointer reference to goal node if successful, else
87+
* return nullptr
12188
*/
12289
NodePtr tryAnalyticExpansion(
12390
const NodePtr & current_node,
124-
const NodeVector & coarse_check_goals,
125-
const NodeVector & fine_check_goals,
126-
const CoordinateVector & goals_coords,
127-
const NodeGetter & getter, int & iterations,
128-
int & closest_distance);
91+
const NodePtr & goal_node,
92+
const NodeGetter & getter, int & iterations, int & best_cost);
12993

13094
/**
13195
* @brief Perform an analytic path expansion to the goal
@@ -139,21 +103,6 @@ class AnalyticExpansion
139103
const NodePtr & node, const NodePtr & goal,
140104
const NodeGetter & getter, const ompl::base::StateSpacePtr & state_space);
141105

142-
/**
143-
* @brief Refined analytic path from the current node to the goal
144-
* @param node The node to start the analytic path from. Node head may
145-
* change as a result of refinement
146-
* @param goal_node The goal node to plan to
147-
* @param getter The function object that gets valid nodes from the graph
148-
* @param analytic_nodes The set of analytic nodes to refine
149-
* @return The score of the refined path
150-
*/
151-
float refineAnalyticPath(
152-
NodePtr & node,
153-
const NodePtr & goal_node,
154-
const NodeGetter & getter,
155-
AnalyticExpansionNodes & analytic_nodes);
156-
157106
/**
158107
* @brief Takes final analytic expansion and appends to current expanded node
159108
* @param node The node to start the analytic path from
@@ -165,13 +114,6 @@ class AnalyticExpansion
165114
const NodePtr & node, const NodePtr & goal,
166115
const AnalyticExpansionNodes & expanded_nodes);
167116

168-
/**
169-
* @brief Counts the number of direction changes in a Reeds-Shepp path
170-
* @param path The Reeds-Shepp path to count direction changes in
171-
* @return The number of direction changes in the path
172-
*/
173-
int countDirectionChanges(const ompl::base::ReedsSheppStateSpace::ReedsSheppPath & path);
174-
175117
/**
176118
* @brief Takes an expanded nodes to clean up, if necessary, of any state
177119
* information that may be polluting it from a prior search iteration

‎nav2_smac_planner/include/nav2_smac_planner/constants.hpp‎

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ enum class MotionModel
2828
STATE_LATTICE = 4,
2929
};
3030

31-
enum class GoalHeadingMode
32-
{
33-
UNKNOWN = 0,
34-
DEFAULT = 1,
35-
BIDIRECTIONAL = 2,
36-
ALL_DIRECTION = 3,
37-
};
38-
3931
inline std::string toString(const MotionModel & n)
4032
{
4133
switch (n) {
@@ -67,33 +59,6 @@ inline MotionModel fromString(const std::string & n)
6759
}
6860
}
6961

70-
inline std::string toString(const GoalHeadingMode & n)
71-
{
72-
switch (n) {
73-
case GoalHeadingMode::DEFAULT:
74-
return "DEFAULT";
75-
case GoalHeadingMode::BIDIRECTIONAL:
76-
return "BIDIRECTIONAL";
77-
case GoalHeadingMode::ALL_DIRECTION:
78-
return "ALL_DIRECTION";
79-
default:
80-
return "Unknown";
81-
}
82-
}
83-
84-
inline GoalHeadingMode fromStringToGH(const std::string & n)
85-
{
86-
if (n == "DEFAULT") {
87-
return GoalHeadingMode::DEFAULT;
88-
} else if (n == "BIDIRECTIONAL") {
89-
return GoalHeadingMode::BIDIRECTIONAL;
90-
} else if (n == "ALL_DIRECTION") {
91-
return GoalHeadingMode::ALL_DIRECTION;
92-
} else {
93-
return GoalHeadingMode::UNKNOWN;
94-
}
95-
}
96-
9762
const float UNKNOWN_COST = 255.0;
9863
const float OCCUPIED_COST = 254.0;
9964
const float INSCRIBED_COST = 253.0;

0 commit comments

Comments
 (0)