Skip to content

drive: use signed v in lane-align velocity term to match GIGAFLOW paper#457

Merged
eugenevinitsky merged 1 commit into
emerge/temp_trainingfrom
ev/lane-align-signed-speed
May 30, 2026
Merged

drive: use signed v in lane-align velocity term to match GIGAFLOW paper#457
eugenevinitsky merged 1 commit into
emerge/temp_trainingfrom
ev/lane-align-signed-speed

Conversation

@eugenevinitsky
Copy link
Copy Markdown

@eugenevinitsky eugenevinitsky commented May 30, 2026

Summary

One-line fix in `compute_rewards` for `R_l-align`. The GIGAFLOW paper defines the velocity-weighted term as

$$\alpha_{\text{vel-align}} \cdot \min(\cos(\theta_f) \cdot v, 0)$$

with signed longitudinal velocity `v`. The implementation in `drive.h:4247` was using the unsigned `sim_speed`, which inverts the sign of the product for reverse motion and so flips the four cases that come out of the (heading × motion) truth table:

heading vs lane longitudinal v world motion paper penalizes? code before
with (cos>0) forward (v>0) with lane no no ✓
with (cos>0) reverse (v<0) against yes no ✗
against (cos<0) forward (v>0) against yes yes ✓
against (cos<0) reverse (v<0) with no yes ✗

R_l-align's velocity-weighted term in the paper is α_vel-align * min(cos(θ_f) * v, 0)
with signed longitudinal velocity v. The implementation was using the unsigned
sim_speed, which flips behavior in the two reverse-motion cases:

  - Facing forward, reversing (world motion against lane): paper penalizes
    proportional to speed; code was returning 0.
  - Facing backward, reversing (world motion along lane): paper says no penalty;
    code was adding one.

Forward driving is unaffected since cos*v and cos*|v| agree when v>0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 30, 2026 16:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Single-character fix in compute_rewards that swaps agent->sim_speed for agent->sim_speed_signed in the GIGAFLOW R_l-align velocity-weighted term so the sign of longitudinal velocity is preserved, matching the paper's formula and correctly handling reverse motion.

Changes:

  • Replace unsigned sim_speed with sim_speed_signed in the vel_aligned_penalty computation.
  • Reformat the assignment across two lines.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@eugenevinitsky eugenevinitsky merged commit 8dfd6e2 into emerge/temp_training May 30, 2026
14 checks passed
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