Skip to content
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

perf(dynamic_obstacle_stop): create rtree with packing algorithm #7730

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,14 @@ void make_ego_footprint_rtree(EgoData & ego_data, const PlannerParam & params)
for (const auto & p : ego_data.trajectory)
ego_data.trajectory_footprints.push_back(autoware::universe_utils::toFootprint(
p.pose, params.ego_longitudinal_offset, 0.0, params.ego_lateral_offset * 2.0));
std::vector<BoxIndexPair> rtree_nodes;
rtree_nodes.reserve(ego_data.trajectory_footprints.size());
for (auto i = 0UL; i < ego_data.trajectory_footprints.size(); ++i) {
const auto box = boost::geometry::return_envelope<autoware::universe_utils::Box2d>(
ego_data.trajectory_footprints[i]);
ego_data.rtree.insert(std::make_pair(box, i));
rtree_nodes.push_back(std::make_pair(box, i));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a must, but I recommend

rtree_nodes.emplace_back({box, i}) // or meybe rtree_nodes.emplace_back(box, i)

ego_data.rtree = std::move(rtree_nodes);

for performance

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the comment and sorry the branch was auto-merged.
I will try building the pairs in place and if it improves performance I will open a new PR.

}
ego_data.rtree = Rtree(rtree_nodes);
}

} // namespace autoware::motion_velocity_planner::dynamic_obstacle_stop
Loading