Repository navigation
nav: per-agent footprint radii (heterogeneous fleet) — veh_params rr_col/body_rr_col - #395
Merged
Merged
Conversation
…col/body_rr_col First step of pushing per-vehicle nav telemetry + physics down into cvc::nav (see CVC-DBG/cvcdbg docs/nav-stats-design.md, PR 2): let a mixed convoy drive with real per-vehicle footprints instead of one shared radius. - veh_params gains optional borrowed columns rr_col / body_rr_col ([n], normalized). Null (default) = every agent uses the scalar rr / body_rr — the same borrowed-pointer pattern as body_offsets/grip, so the homogeneous path is byte-identical and the CPU<->CUDA parity gates are unchanged. - rollout_impl reads rr_i / body_rr_i per agent (rr_col[i] ? : rr) at the disc-clearance, barrier and governor sites; when the column is null this is the same float as before, so no existing trajectory moves. - sim_world::set_vehicle_radii(rr, body_rr, n) / clear_vehicle_radii() own the columns and point cfg.veh at them, so the runtime swarm can set them; tail-padded with the scalar to never read past a short column. - Only the CPU rollout reads the columns today; the CUDA twin falls back to the scalar (documented in drive.h) — wiring the device path is a follow-up. Test: nav_test PerAgentRadiiOverrideFootprint — a uniform column set to the scalar rr is byte-identical to the scalar path (parity, EXPECT_FLOAT_EQ on positions + min_clearance), and a bigger column actually changes the drive.
…umn set Extends the per-agent footprint (rr_col/body_rr_col) with the rest of the per-vehicle physics the heterogeneous-fleet design calls for: - veh_params gains `mass` (kg) + `mass_col` ([n]). The kinematic bicycle has no dynamics so the drive does NOT read mass — it is carried for the fuel model (fuel = f(accel, mass, material)) + telemetry. Default 1 keeps mass-weighted terms inert; null column = the shared scalar (parity-safe). - sim_world::set_vehicle_mass / vehicle_mass own + read back the per-agent mass column. - sim_world::set_vehicle_dims_m(width_m, length_m) takes METRIC per-agent dimensions: width DERIVES the drive footprint (rr[i] = width_m[i]/2 in normalized units, via cfg.scale) so a wider vehicle keeps more clearance, and length is carried for corridor-fit / telemetry. vehicle_dims_m reads them back. Test: nav_test PerAgentMassAndDims — mass round-trips (and clears back to the scalar), and a wider fleet's derived footprint changes the drive (positions differ from the baseline). Parity: mass/mass_col are unread by the drive and the dims path only sets rr_col, so a fleet with no columns set is byte-identical to before.
Owner
Author
|
Extended: this PR now covers the full per-agent physics column set — footprint ( |
Completes the per-agent physics column set: a slow heavy truck and a nimble scout can now carry different top speed, longitudinal accel and wheelbase. - veh_params gains vmax_col / a_max_col / L_col (borrowed [n]); null = the shared scalar. - rollout_impl computes vmax/a_max/L PER AGENT inside the lambda and SHADOWS the names the loop body already uses, so every use site (the L-derived dmax/tan_dmax/v_creep_cap, the vmax-derived sp_min, the curvature and speed limits) picks up the per-agent value with no per-site edits. A null column reproduces v.vmax/v.a_max/v.L, and the L-derived thresholds recompute to the same float (same inputs, no fast-math), so the homogeneous path and the CPU<->CUDA parity gate are byte-identical. Only the CPU rollout reads the columns; the CUDA twin falls back to the scalar (documented) — a follow-up. - sim_world::set_vehicle_kinematics(vmax, a_max, L, n) / vehicle_kinematics own + read back the columns (any of the three may be null to keep that param scalar). Test: nav_test PerAgentKinematics — vmax/a_max/L round-trip (and clear to the scalar), and a lower per-agent vmax caps the fleet's peak speed below the fast baseline and below its own vmax/scale.
Owner
Author
|
Added per-agent kinematics ( |
transfix
added a commit
that referenced
this pull request
Sep 22, 2026
Wire the per-agent columns (rr/body_rr/vmax/a_max/L) into the GPU drive so a heterogeneous fleet runs on CUDA too, matching the CPU rollout. - dev_veh gains the 5 borrowed device column pointers (null = the scalar, so the homogeneous path is bit-for-bit the legacy kernel). Mass is not here — the kinematic drive never reads it. - d_veh_for(v, i) substitutes the columns into a per-thread copy before d_bicycle, so every use site (incl. the L-derived dmax/tan_dmax/v_creep_cap and the vmax-derived sp_min) becomes per-agent with no change to d_bicycle — the device mirror of the CPU loop's shadowing. - upload_cols copies each set host column [n] to the device in both batch entry points (bicycle_rollout_cuda / drive_step_cuda) and frees them after. The persistent sim_world_cuda path keeps the scalar for now (a follow-up). Test: nav_drive_refinements_test CudaMatchesCpuWithPerAgentColumns — a heterogeneous fleet (distinct rr/vmax/a_max/L per agent) matches the CPU bicycle_rollout within the ~1e-5 float-equivalence contract. Verified on a GTX 1650 (both this and the existing scalar-path CUDA parity test pass); the null-column path leaves the CPU/CUDA parity gate byte-identical.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First step of pushing per-vehicle nav physics down into
cvc::nav: let a mixed convoy drive with real per-vehicle footprints instead of one shared radius.What
veh_paramsgains optional borrowed columnsrr_col/body_rr_col([n], normalized). Null (default) = every agent uses the scalarrr/body_rr— the same borrowed-pointer pattern asbody_offsets/grip, so the homogeneous path is byte-identical and the CPU↔CUDA parity gates are unchanged.rollout_implreadsrr_i/body_rr_iper agent (rr_col[i] ? : rr) at the disc-clearance, barrier, and governor sites; with a null column this is the samefloatas before, so no existing trajectory moves.sim_world::set_vehicle_radii(rr, body_rr, n)/clear_vehicle_radii()own the columns and pointcfg.vehat them (tail-padded with the scalar), so the runtime swarm can set them.drive.h) — wiring the device path is a follow-up.Parity + test
nav_test.PerAgentRadiiOverrideFootprint: a uniform column set to the scalarrris byte-identical to the scalar path (EXPECT_FLOAT_EQon positions +min_clearance), and a bigger column actually changes the drive. Because the null/uniform column reproduces the scalarfloatexactly, existing behavior and the CPU/CUDA parity tests are preserved by construction.Small and additive, designed to compose with concurrent
cvc::navwork. Builds on #394 (min_clearance).