HKUST-Aerial-Robotics / Fast-Planner

A Robust and Efficient Trajectory Planner for Quadrotors
GNU General Public License v3.0
2.4k stars 665 forks source link

Question in topo_prm.cpp -> function <<needConnection>> #26

Closed MichaelFYang closed 4 years ago

MichaelFYang commented 4 years ago

In the function "needConnection", if the checking for a shorter path is true, should the neighbor for both Graph node g1 and g2 need to be changed. [OLD] if (pathLength(path1) < pathLength(path2)) { g1->neighbors[i]->pos = pt; // ROSWARN("shorter!"); } ----> [NEW] if (pathLength(path1) < pathLength(path2)) { g1->neighbors[i]->pos = pt; g2->neighbors[j]->pos_ = pt; // ROS_WARN("shorter!"); } Or maybe I miss understanding some parts of code.

ZbyLGsc commented 4 years ago

@MichaelFYang Yes you are right. But since the we already have: 'g1->neighbors[i]->id == g2->neighbors[j]->id', so the two pointers of neighbors point to the same node, and we only need to change the 'pos' of the node once. Therefore the original code is also correct.

ZbyLGsc commented 4 years ago

Please close this issue given no other problem

MichaelFYang commented 4 years ago

I see. Thanks.