Skip to content

Faithful implementation of the nuPlan at-fault collision metric#440

Open
WaelDLZ wants to merge 1 commit into
emerge/temp_trainingfrom
wbd/nuplan_at_fault
Open

Faithful implementation of the nuPlan at-fault collision metric#440
WaelDLZ wants to merge 1 commit into
emerge/temp_trainingfrom
wbd/nuplan_at_fault

Conversation

@WaelDLZ
Copy link
Copy Markdown

@WaelDLZ WaelDLZ commented May 24, 2026

The previous implementation was more a rough simplification while this one is designate to be as faithful as i could to nuPlan's original code.

Copilot AI review requested due to automatic review settings May 24, 2026 00:32
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

This PR updates PufferDrive’s at-fault collision metric implementation to more closely mirror nuPlan’s collision-fault classification logic, replacing the prior simplified heuristic with geometry-based collision typing and lane-position checks.

Changes:

  • Added nuPlan-oriented collision type constants and a behind-angle threshold (NUPLAN_BEHIND_COS_THRESHOLD).
  • Introduced helper geometry routines to detect whether the ego’s front bumper intersects another agent’s box.
  • Reworked is_at_fault_collision to use a collision-type classifier (stopped-track, active-front, active-rear, active-lateral) and lane cleanliness logic.

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

}
}

// helpers for nuPlan's at-fault collision, you need to know if the front bumper was involed
Comment on lines 2367 to 2371
static bool is_at_fault_collision(Drive *env, int agent_idx, int other_idx) {
Agent *agent = &env->agents[agent_idx];
Agent *other = &env->agents[other_idx];
int collision_type = classify_collision_type(agent, other);

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.

2 participants