Skip to content

sdf_nav: thread the ext_force_fn hook through SdfNavigator - #70

Merged
transfix merged 1 commit into
mainfrom
feat/sdfnav-ext-force-fn
Sep 9, 2026
Merged

transfix merged 1 commit into
mainfrom
feat/sdfnav-ext-force-fn

Conversation

@transfix

@transfix transfix commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

What

#66 added a generic ext_force_fn hook to sdf_rollout / bicycle_rollout, but SdfNavigator — the navigator the demos and Squad actually drive — never accepted or passed one, so a force term couldn't reach the deployed drive. This completes the plumbing.

  • grl_snam/nav.py: add self.ext_force_fn = None and thread it into both rollout calls in step(). Unlike carrot_bias_fn (which nudges the pure-pursuit carrot), this enters the integrator's force law — the seam the DBG comm force uses as a genuine force term.
  • Native-drive guard: the C++ drive_step has no ext_force_fn plumbing, so step() falls back to the torch rollout when a hook is set (same pattern as material/friction) rather than silently dropping the force.

Byte-identical when unset

Default None hits #66's inert guards. New tests/test_nav_ext_force.py pins that a None or zero-force hook leaves both the point and bicycle traces bit-for-bit unchanged (torch.equal), and that a non-zero force bends them (northward push raises final y). The existing nav suite (test_nav, test_vehicle, test_material_nav, test_ext_force, test_nav_native_drive) stays green — 45 passed / 1 skipped (pycvc).

Why

This is the GRL-SNAM half of the DBG cf.bias → cf.force cutover: the deployed comm force moves from a carrot-bias steering hack to a genuine force term in the integrator. The grl_snam_dbg half (the live_convoy wiring + the world↔normalized adapter) is a companion PR.

#66 added a generic ext_force_fn hook to sdf_rollout / bicycle_rollout, but the
navigator that the demos and Squad drive (grl_snam.nav.SdfNavigator) never
accepted or passed one — so the force term could not reach the deployed drive.

Add `self.ext_force_fn = None` and thread it into both rollout calls in step().
Unlike carrot_bias_fn (which nudges the pure-pursuit carrot), this enters the
integrator's force law itself — the seam the DBG comm force uses as a genuine
force term. The native C++ drive_step has no ext_force_fn plumbing, so step()
falls back to the torch rollout when a hook is set (same pattern as material /
friction), rather than silently dropping the force.

Byte-identical when unset: default None hits #66's inert guards; tests/
test_nav_ext_force.py pins that a None or zero-force hook leaves both the point
and bicycle traces bit-for-bit unchanged, and that a non-zero force bends them.
Existing nav suite (test_nav / test_vehicle / test_material_nav / test_ext_force
/ test_nav_native_drive) stays green.
@transfix
transfix merged commit 9628256 into main Sep 9, 2026
3 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.

1 participant