Skip to content

Add vision-based route costmap from YOLOPv2 drivable-area segmentation - #507

Open
siddarthnandy wants to merge 1 commit into
Nova-UTD:devfrom
siddarthnandy:feature/route-costmap-clean
Open

Add vision-based route costmap from YOLOPv2 drivable-area segmentation#507
siddarthnandy wants to merge 1 commit into
Nova-UTD:devfrom
siddarthnandy:feature/route-costmap-clean

Conversation

@siddarthnandy

@siddarthnandy siddarthnandy commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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 existing costs/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_node lives in lane_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.CamLUT and 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 in setup.py and the launch files. Until #505 merges, these two nodes build and start cleanly but idle (no bev_geometry module / no mask to consume yet); once #505 lands, they become fully functional with no further changes needed here.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant