Add vision-based route costmap from YOLOPv2 drivable-area segmentation - #507
Open
siddarthnandy wants to merge 1 commit into
Open
Add vision-based route costmap from YOLOPv2 drivable-area segmentation#507siddarthnandy wants to merge 1 commit into
siddarthnandy wants to merge 1 commit into
Conversation
Adds two new perception nodes built on YOLOPv2's existing drivable-area segmentation head (already loaded for lane-line detection, now also published on /drivable_mask/front for the first time): - yolopv2_drivable_grid_node: projects the drivable-area mask directly into the shared BEV grid via the existing camera->ground-plane ray-cast lookup table (bev_geometry.CamLUT), publishing to /grid/drivable/segmented_v3 alongside the existing PSPNet-based /grid/drivable/segmented for live comparison. - route_costmap_v2_node: builds on that projection to publish a graded route-planning cost grid on /route_costmap/segmented_v2 -- lowest cost at the lane center, rising toward the edges, and non-drivable outside the lane entirely. Unlike the existing costs package's route_costmap_node (distance to the planned path), this is a second, independent cost source built purely from live camera segmentation, kept side by side for comparison rather than replacing it. The robustness logic (connected-component seeding at the vehicle's own cell, a short fixed-window majority vote across frames, and a distance-transform-based cost field so the lane center falls out for free with no separate centerline-tracking step) lives in lane_costmap.py, unit-tested independently of ROS. Both nodes are wired into the perception launch alongside the existing drivable-grid and lane-line nodes; nothing existing is removed or replaced.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a second, vision-based route costmap alongside the existing planned-path-distance costmap (
costs/route_costmap_node), built from YOLOPv2's drivable-area segmentation head rather than the planned route path.yolopv2_drivable_grid_node— projects a drivable-area segmentation mask (/drivable_mask/front) into the shared BEV grid using a camera-to-ground-plane ray-cast lookup table (bev_geometry.CamLUT). Publishes to/grid/drivable/segmented_v3, alongside the existing PSPNet-based/grid/drivable/segmented, for live side-by-side comparison.route_costmap_v2_node— turns that projection into a graded route-planning cost grid on/route_costmap/segmented_v2: lowest cost at the lane center, rising toward the edges, fully non-drivable outside the lane. This is a second, independent cost source from the existingcosts/route_costmap_node(which costs distance to the planned path) — kept side by side for comparison, not a replacement.The robustness logic behind
route_costmap_v2_nodelives inlane_costmap.py, unit-tested independently of ROS:seeded_connected_mask— keeps only the connected component touching the vehicle's own grid cell, dropping disconnected noise islands or an unrelated lane picked up elsewhere in the frame.RollingMajorityFilter— a short, fixed-length window of recent per-cell masks with a majority vote, so a few frames of the model briefly bleeding into an adjacent lane can't reach the output, while a real sustained change still wins within a fraction of a second.distance_cost_grid— a distance transform on the robust region turns it directly into a 0-100 cost field; the lane center falls out for free as whichever cell is farthest from every edge, with no separate centerline-tracking step.Dependency note
Both new nodes import
bev_geometry.CamLUTand subscribe to/drivable_mask/front, both introduced in #505 (not yet merged). This PR does not duplicate any of #505's files — it only adds the 4 new files above plus the minimal registration lines insetup.pyand the launch files. Until #505 merges, these two nodes build and start cleanly but idle (nobev_geometrymodule / no mask to consume yet); once #505 lands, they become fully functional with no further changes needed here.