Feat(planner): add optional Bézier trajectory head as swappable planner#69
Conversation
4119613 to
502e382
Compare
m-zain-khawaja
left a comment
There was a problem hiding this comment.
Hi @gcordova10 - this looks good to me. I noticed that you added a compute_planner_loss function. We already have a losses folder with a trajectory loss - could you please therefore remove the planner loss from your bezier_planner.py and if you need to add further losses, could you please add them under the losses folder.
Also, have you tried a forward pass test with your planner, do the layers work correctly?
502e382 to
1dc1ecc
Compare
…Loss + add forward-pass tests - compute_planner_loss now calls losses/TrajectoryImitationLoss instead of an inline F.mse_loss (removes torch.nn.functional import); the planner owns no loss logic of its own. The method stays because BasePlanner declares it abstract and AutoE2E.forward(mode='train') invokes it. - add end-to-end forward-pass tests through AutoE2E(planner_mode='bezier') in train and infer modes + a direct compute_planner_loss test. 14/14 green. Addresses review on autowarefoundation#69. Signed-off-by: GABRIELA CORDOVA <100548769@alumnos.uc3m.es>
74f88ef to
1dc1ecc
Compare
|
Hi @zainkhawaja! |
Adds Model/model_components/trajectory_planning/ with a BasePlanner contract and a BezierPlanner that smooths the (acceleration, curvature) control profiles via a fixed Bernstein basis (math.comb, no scipy). Selectable from AutoE2E via planner='bezier'; default 'autoregressive' (TrajectoryPlanner) is unchanged, preserving the (trajectory, ego_hidden, future) 3-tuple. Relates to autowarefoundation#45 (optional/swappable planners). Signed-off-by: GABRIELA CORDOVA <100548769@alumnos.uc3m.es>
Signed-off-by: GABRIELA CORDOVA <100548769@alumnos.uc3m.es>
Signed-off-by: GABRIELA CORDOVA <100548769@alumnos.uc3m.es>
Signed-off-by: GABRIELA CORDOVA <100548769@alumnos.uc3m.es>
…tibility Signed-off-by: GABRIELA CORDOVA <100548769@alumnos.uc3m.es>
…Loss + add forward-pass tests - compute_planner_loss now calls losses/TrajectoryImitationLoss instead of an inline F.mse_loss (removes torch.nn.functional import); the planner owns no loss logic of its own. The method stays because BasePlanner declares it abstract and AutoE2E.forward(mode='train') invokes it. - add end-to-end forward-pass tests through AutoE2E(planner_mode='bezier') in train and infer modes + a direct compute_planner_loss test. 14/14 green. Addresses review on autowarefoundation#69. Signed-off-by: GABRIELA CORDOVA <100548769@alumnos.uc3m.es>
1dc1ecc to
158539c
Compare
m-zain-khawaja
left a comment
There was a problem hiding this comment.
Approved, thanks @gcordova10
|
@ryotayamada @m-zain-khawaja — as suggested in #56, I put together a small planner benchmark harness that runs What it measures now (no checkpoint/dataset/sim needed): inference latency, parameter count, and architectural smoothness on the Results (GPU, batch=1, random weights — see caveat):
So Bézier is ~28× faster than flow-matching and ~110× faster than GRU, the lightest, and the smoothest by construction (Bernstein basis) — relevant for the real-time R-Car target. Honest caveat: these are untrained weights, so the smoothness/latency numbers are architectural; ADE/FDE, off-road rate, collision and closed-loop stability are NOT comparable yet — they need a trained checkpoint + dataset (KITScenes/L2D) + a simulator (NAVSIM/Bench2Drive). The harness has hooks for those. @m-zain-khawaja — since you're leading this comparison, happy to fold the harness into this PR or move it to a separate one, whatever you prefer. I can also help wire the trained ADE/FDE + closed-loop metrics once the training loop (#78/#67) is in place. |
|
Stop Sent from my iPhoneOn Jun 22, 2026, at 3:48 PM, Gabriela Cordova ***@***.***> wrote:gcordova10 left a comment (autowarefoundation/auto_e2e#69)
@ryotayamada @m-zain-khawaja — as suggested in #56, I put together a small planner benchmark harness that runs gru, flow_matching and bezier through the PLANNER_REGISTRY under identical conditions (same embed_dim/horizon/inputs/device).
What it measures now (no checkpoint/dataset/sim needed): inference latency, parameter count, and architectural smoothness on the (accel, curvature) output — jerk = Var(Δaccel), curvature = Var(Δcurvature).
Results (GPU, batch=1, random weights — see caveat):
planner
params
latency p50 (ms)
jerk Var(Δaccel)
curv Var(Δcurv)
gru (autoregressive)
829K
43.3
1.4e-04
3.8e-04
flow_matching (ODE)
988K
11.3
4.2e+00
2.0e+00
bezier (one-shot)
495K
0.39
5.0e-06
1.2e-06
So Bézier is ~28× faster than flow-matching and ~110× faster than GRU, the lightest, and the smoothest by construction (Bernstein basis) — relevant for the real-time R-Car target.
Honest caveat: these are untrained weights, so the smoothness/latency numbers are architectural; ADE/FDE, off-road rate, collision and closed-loop stability are NOT comparable yet — they need a trained checkpoint + dataset (KITScenes/L2D) + a simulator (NAVSIM/Bench2Drive). The harness has hooks for those.
@m-zain-khawaja — since you're leading this comparison, happy to fold the harness into this PR or move it to a separate one, whatever you prefer. I can also help wire the trained ADE/FDE + closed-loop metrics once the training loop (#78/#67) is in place.
—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
Thank you @gcordova10 - these results are encouraging. Could you please add this in a separate PR 👍 |
… for gru/flow_matching/bezier Compares the registered planners under identical conditions: inference latency (p50/p99/jitter), param count, and architectural smoothness (Var(Δaccel), Var(Δcurvature)) on the (accel, curvature) unicycle output. ADE/FDE, off-road, collision and closed-loop are left as documented hooks (need trained checkpoint + dataset/simulator). Addresses @m-zain-khawaja's request in #69 / #56. Signed-off-by: GABRIELA CORDOVA <100548769@alumnos.uc3m.es>
Description
This PR introduces an optional, swappable Bézier trajectory planner head into the
AutoE2Earchitecture, aligning with the WG's requirements for trajectory smoothing and jerk reduction.Key Changes
BezierPlannerunderModel/model_components/trajectory_planning/using a precomputed Bernstein basis (zeroscipydependency).PLANNER_REGISTRYto support modular, swappable planners.AutoE2Econtract (trajectory, ego_hidden, future_visual_features).Testing
Closes #45 (Relates to #51)
WG Alignment Note: This implementation aligns with the "fast/reactive" planning layer discussed in the WG meeting. It serves as one of the metric trajectory planner heads identified as a
requirement for the current reactive block, ensuring compatibility with the broader architectural goal of separating reactive trajectory planning from future "slow-thinking" reasoning modules.