-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Insert in-place rotation waypoint if missing #111
Changes from 2 commits
3120bb6
20ac53a
53908a2
67ae677
349d583
344559c
a756cfe
bd86f2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -551,6 +551,33 @@ reconstruct_waypoints( | |
{ | ||
const auto& node = node_sequence.at(i); | ||
const auto yaw = node->yaw; | ||
|
||
// Insert in-place rotation waypoint if the current and previous waypoints | ||
// are disconnected | ||
const auto prev_candidate = candidates.back(); | ||
const auto prev_wp = prev_candidate.waypoint; | ||
const auto current_wp = node->waypoint; | ||
const bool same_stack = | ||
prev_wp.graph_index.has_value() && current_wp.has_value() | ||
&& *prev_wp.graph_index == *current_wp; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this condition a subset of the position check? Would two waypoints that are exactly the same always return true for:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think same graph index always mean same position, but same (or sufficiently close) positions don't always mean same graph index. Having There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yap that's what I meant, if two waypoints have the same index they will always have the exact same position, so would checking only for the position be sufficient? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see what you mean, gotcha removed in 67ae677 |
||
const Eigen::Vector2d prev_pos = | ||
Eigen::Vector2d{prev_wp.position[0], prev_wp.position[1]}; | ||
const bool same_pos = (prev_pos - node->position).norm() < 1e-3; | ||
const bool same_ori = | ||
std::abs(prev_wp.position[2] - node->yaw)*180.0 / M_PI < 1e-2; | ||
if (!(same_stack || same_pos) && !same_ori) | ||
{ | ||
candidates.push_back(WaypointCandidate{ | ||
true, | ||
Plan::Waypoint::Implementation{ | ||
Eigen::Vector3d{prev_pos[0], prev_pos[1], node->yaw}, | ||
prev_wp.time, prev_wp.graph_index, | ||
prev_wp.approach_lanes, {}, {}, prev_wp.event, {} | ||
}, | ||
prev_candidate.velocity | ||
}); | ||
} | ||
|
||
if (node->approach_lanes.empty()) | ||
{ | ||
// This means we are doing an in-place rotation or a wait | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, we should use references for more complex types to avoid copying
const auto&
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
53908a2