Repository navigation
nav: every length and force in the state tree is in world units - #824
Merged
Merged
Conversation
transfix
force-pushed
the
docs/nav-key-tooltips
branch
from
October 27, 2026 00:08
d74e751 to
b65929a
Compare
transfix
force-pushed
the
fix/nav-tree-world-units
branch
from
October 27, 2026 04:04
dbea9f4 to
937590f
Compare
nav.sep_gain (the carrot shift at contact) and nav.terrain.sigma (the grade cost's blur, kept in cells) crossed the tree unconverted: the first in the normalized frame, the second in cells. Both are metres now. The material and terrain force weights are in world units too: lam_hard and lam_grade_hard (a barrier's full push) in m/s^2, lam_soft and lam_grade (the push per unit of risk or grade cost gained per metre) in m^2/s^2. set_terrain_config recomposites the occupancy at once when infeasible cells were blocking, so cells it frees (block_infeasible off, a looser limit) leave the map now, a frozen one's too, not at the next sense tick (never, with freeze_sense).
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.
Stacked on #823 (base
docs/nav-key-tooltips); I'll retarget it to master when #823 merges.Why
The state tree is meant to hold world units: metres and seconds, whatever
config.scaleis or how big the map's cells are. An audit of every keysim_worldbinds found six that didn't.nav.sep_gain: the carrot shift at contact, a length in the normalized frame, passed through unconverted.nav.terrain.sigma: the grade cost's blur, passed through in grid cells.lam_soft,lam_hard,lam_gradeandlam_grade_hardwere in the drive's normalized acceleration units. The soft weights multiply a risk gradient taken per normalized unit, so their world size goes as 1/scale². The barrier weights multiply a unit direction, so theirs goes as 1/scale.nav_plant's keys were already consistent: lengths and speeds go through
world_units, and accelerations are SI.A separate bug: with
block_infeasibleon, turning it off (or loosening the limit) left the formerly infeasible cells as obstacles until the next sense tick. Withfreeze_sensethere is never a sense tick, so they stayed forever.What
Units (
sim_world_binding.cpp):nav.sep_gainnav.terrain.sigmanav.material.lam_hard,nav.terrain.lam_grade_hardnav.material.lam_soft,nav.terrain.lam_gradelam_soft_scaleandlam_hard_scalestay plain ratios.docs/PHYSICS_API.mdlists the conversions.Freed cells leave at once:
set_terrain_confignow recomposites every plane's occupancy from its log-odds, via a new privaterecomposite_occupancy(), whenever infeasible cells were blocking. A frozen map's log-odds hold its prior, so that works for it too.Nothing inside the library changes. The structs keep their units, and only the tree's view of them changes.
Tests
NavBinding.EveryLengthIsInMetres: scale 0.05 with 2 m cells.sep_gainandsigmaare seeded in metres, applied converted, and stable across pulls.NavBinding.MaterialWeightsAreKnobsOnceAMaterialIsSetandTerrainSettingsRebuildThePlanes: now check the weights' world units.NavTerrain.CellsTheTerrainFreesLeaveTheMapAtOnce: on a frozen map, the field is rebuilt as soon asblock_infeasibleis turned off, and an agent held short of a ramp then crosses it.Ran locally (Windows, MSVC, no CUDA) and all pass: nav_binding (6), nav_terrain (11), nav_material (33), nav (62).