Skip to content

Goal-system rewrite: direct goal sampling (replaces Path/Waypoint)#512

Open
vcharraut wants to merge 20 commits into
3.0from
vcha/goals-func
Open

Goal-system rewrite: direct goal sampling (replaces Path/Waypoint)#512
vcharraut wants to merge 20 commits into
3.0from
vcha/goals-func

Conversation

@vcharraut

@vcharraut vcharraut commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

What

Rewrites the target/waypoint system into a direct goal abstraction. Stacked on top of the rename PR (#), so this diff is functional-only.

  • Removes the Path/Waypoint densification layer: struct Path, struct Waypoint, MAX_NUM_WP_PATH (200-pt buffer), build_path, get_closest_waypoint_index_on_path, path_progression, closest_path_idx_wp, num_waypoints_reached.
  • New generation/regen pipeline: chain_goals, commit_goals, generate_new_goals_from_route, generate_new_goals_from_map, roll_goals, route_point_at_distance, compute_new_route.
  • Config: target_type (static/dynamic) -> goal_regen_mode (finite/rolling); goal_on_lane -> goal_source (route/map); new obs_goal_lane_distance flag.
  • Lane-graph GPS distance: LaneGraph.lane_to_graph_idx + normalized distance-to-goal-lane on lane obs rows.
  • gt_goal_* ground-truth goal pin for replay; goal reward via point-to-segment distance.

🤖 Generated with Claude Code

vcharraut and others added 2 commits July 6, 2026 22:07
Pure identifier renames ahead of the goal-system rewrite, so the
functional PR is reviewable on its own. Behavior is unchanged: builds
clean and passes the existing 3.0 golden rollout + unit tests.

  current_route_index   -> current_route_idx
  MAX_TARGET_WAYPOINTS  -> MAX_GOALS
  goal_positions_{xyz}  -> list_goal_{xyz}
  goal_position_{xyz}   -> current_goal_{xyz}
  num_target_waypoints  -> num_goals
  {min,max}_waypoint_spacing -> {min,max}_goal_spacing

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Removes the Path/Waypoint densification layer (struct Path, struct
Waypoint, MAX_NUM_WP_PATH, build_path, closest-waypoint tracking,
path_progression) and samples goals directly along the route or map.

- New generation/regen pipeline: chain_goals, commit_goals,
  generate_new_goals_from_route/_from_map, roll_goals,
  route_point_at_distance, compute_new_route.
- goal_regen_mode (finite|rolling), goal_source (route|map) replace
  target_type / goal_on_lane.
- Lane-graph GPS distance: LaneGraph.lane_to_graph_idx +
  obs_goal_lane_distance obs flag.
- gt_goal_* ground-truth goal pin for replay; goal reward via
  point-to-segment distance.
- Golden rollout/smoke data regenerated (behavior changed by design).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vcharraut vcharraut mentioned this pull request Jul 6, 2026
Base automatically changed from vcha/goals-rename to 3.0 July 6, 2026 20:29
Comment thread pufferlib/config/ocean/drive.ini Outdated
# Town10HD map diameter (~260m) so goals can land anywhere on the network.
env.num_goals: 1
env.goal_on_lane: False
env.goal_source: "map"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ty

}

// Build reverse lookup road-element idx -> graph idx. lane_ids[g] holds road-element
// indices (binary is reindexed so road id == array idx, drive.h:1003).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

drive.h:1003 is probably not a good pointer

const float seg_dx = wp_b.x - wp_a.x;
const float seg_dy = wp_b.y - wp_a.y;
const float seg_len_sq = seg_dx * seg_dx + seg_dy * seg_dy;
for (int pass = 0; pass < 2; pass++) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

would appreciate a comment at the top of here I think, it's not immediately obvious to me the logic of this method though I am digging into it before approving

; in front of the agent). False: scatter each goal at a uniformly random
; drivable point anywhere on the map.
goal_on_lane = True
; --- Goal ---

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think we need to update the target definitions in the validation set

Comment thread pufferlib/ocean/drive/drive.h
Comment thread pufferlib/ocean/drive/drive.h
Comment on lines +222 to +224
// GT source spaces num_goals goals along the logged trajectory. They carry no lane (list_goal_lane
// = -1, so no GPS lane-distance) and every coordinate is finite. current_goal_idx starts at 0 but
// may already have advanced if the agent spawns inside the first goal's radius (metrics run in reset).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

hmm, can we not assign a lane to the expert goal points?

@eugenevinitsky eugenevinitsky left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

So as not to block, going to suggest that we merge. Please squash so that we can revert easily if it causes a regression.

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.

3 participants