@@ -93,8 +93,16 @@ class RRT {
9393 * Evaluates a certain interval to determine if the algorithm is making
9494 * meaningful progress. If it isn't, it will simply tell the RRT algoritm to
9595 * stop.
96+ *
97+ * @param goal_node ==> current best node reaching the goal (updated if better found)
98+ * @param goal_parent ==> parent of the goal_node (updated if better found)
99+ * @param current_goal_index ==> index of the goal that we are trying to connect to
100+ * @return ==> true if the RRT algorithm should stop (converged or
101+ * adequate), false otherwise
96102 */
97- bool epochEvaluation (RRTNode *goal_node, int current_goal_index);
103+ bool epochEvaluation (std::shared_ptr<RRTNode> goal_node,
104+ std::shared_ptr<RRTNode> goal_parent,
105+ int current_goal_index);
98106
99107 /* *
100108 * Generates a random point in the airspace (uniformly)
@@ -111,11 +119,10 @@ class RRT {
111119 * connect to
112120 * @param total_options ==> number of options to try to connect to the goal
113121 * @return ==> list of options to connect to the goal
114- * <RRTPoint GOAL, {RRTNode* ANCHOR,
115- * RRTOption} >
122+ * <RRTPoint GOAL, {RRTNode* ANCHOR, RRTOption} >
116123 */
117- std::vector<std::pair<RRTPoint, std::pair<RRTNode * , RRTOption>>> getOptionsToGoal (
118- int current_goal_index, int total_options) const ;
124+ std::vector<std::pair<RRTPoint, std::pair<std::shared_ptr< RRTNode> , RRTOption>>>
125+ getOptionsToGoal ( int current_goal_index, int total_options) const ;
119126
120127 /* *
121128 * Tries to get the optimal node to the goal, which is NOT connected into the
@@ -124,10 +131,13 @@ class RRT {
124131 * @param current_goal_index ==> index of the goal that we are trying to
125132 * connect to
126133 * @param total_options ==> number of options to try to connect to the goal
134+ * @param parent ==> pointer to the parent node (output parameter)
127135 * @return ==> pointer to the node if one was found,
128136 * nullptr otherwise
129137 */
130- RRTNode *sampleToGoal (int current_goal_index, int total_options) const ;
138+ std::shared_ptr<RRTNode> sampleToGoal (int current_goal_index,
139+ int total_options,
140+ std::shared_ptr<RRTNode>& parent) const ;
131141
132142 /* *
133143 * Connects to the goal after RRT is finished
@@ -148,9 +158,12 @@ class RRT {
148158 * - adds altitude to the path
149159 *
150160 * @param goal_node ==> node to add to the tree
161+ * @param parent ==> parent of the goal node
151162 * @param current_goal_index ==> index of the goal that we are trying to
152163 */
153- void addNodeToTree (RRTNode *goal_node, int current_goal_index);
164+ void addNodeToTree (std::shared_ptr<RRTNode> goal_node,
165+ std::shared_ptr<RRTNode> parent,
166+ int current_goal_index);
154167
155168 /* *
156169 * Goes through generated options to try to connect the sample to the tree
@@ -160,8 +173,9 @@ class RRT {
160173 * @return ==> whether or not the sample was successfully added to
161174 * the tree (nullptr if not added)
162175 */
163- RRTNode *parseOptions (const std::vector<std::pair<RRTNode *, RRTOption>> &options,
164- const RRTPoint &sample);
176+ std::shared_ptr<RRTNode> parseOptions (
177+ const std::vector<std::pair<std::shared_ptr<RRTNode>, RRTOption>> &options,
178+ const RRTPoint &sample);
165179
166180 /* *
167181 * Rewires the tree by finding paths that are more efficintly routed through
@@ -170,7 +184,7 @@ class RRT {
170184 *
171185 * @param sample ==> sampled point
172186 */
173- void optimizeTree (RRTNode * sample);
187+ void optimizeTree (std::shared_ptr< RRTNode> sample);
174188};
175189
176190/* *
0 commit comments