Skip to content

sim_world::set_risk_governor, and pycvc's nav_sim_world_set_risk_governor - #1012

Merged
transfix merged 1 commit into
masterfrom
feat/sim-world-risk-governor
Nov 4, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/sim-world-risk-governor

Conversation

@transfix

@transfix transfix commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Why

In GRL-SNAM's material demo, the scenario story sends one vehicle square at a water strip. On the dynamic plant, turning the material on leaves the run exactly as it is without material, to the millimetre. The witness gate is active for 49 ticks, yet nothing changes.

The reason is the drive, not the plant. The material force joins the force sum, and the sum is then held to the speed cap. So the force slows an agent only by what it takes from the goal pull's surplus over that cap.

On a plant whose top speed is under nav's cruise, that surplus swallows it:

  • the dynamic RoboRacer meets the water at its top speed of 10 m/s;
  • the goal pull has 2.8 to spare; the water takes 1.45 at most, so the command is unchanged;
  • head on, the push has no sideways part, so it does not steer either.

The kinematic arm, with nav's own vmax, moves by 0.1 m; Jolt's run diverges.

The drive already has the mechanism for slowing on risky ground: the risk governor (veh_params::risk_governor). But a sim_world took it only from cfg.veh at construction or from the state tree's pull, and pycvc's nav_sim_world_create never sets it.

What

  • sim_world::set_risk_governor(on, vmin, onset, lookahead, probes) switches it from the next step and checks its arguments. risk_governor() reads it back.
  • pycvc binds nav_sim_world_set_risk_governor and nav_sim_world_risk_governor.
  • docs: docs/PHYSICS_API.md's governor paragraph explains why a plant needs it.

The governor slows a vehicle on risky ground; it does not wall it off. With the goal beyond the water, a kinematic agent still crosses, at the speed the risk allows.

Tests

  • NavMaterialSimWorld.RiskGovernorSlowsAnAgentTheMaterialForcesDoNot: water 17 m wide lies across an agent's path. With the forces alone it crosses at its 18 m/s top speed; with the governor, at 2.4 m/s on average. Switched off before the water, the run is the ungoverned one, bit for bit. It also covers the argument checks.
  • test_pycvc_nav_governor.py: the same from Python (8.0 m/s against 0.4 m/s) and the switch. Registered as pycvc_nav_governor.

Local run: Windows, MSVC 14.44 Release. Passing:

  • nav_material (34), nav_sim_world (4);
  • test_pycvc_nav_governor.py (11 checks).

clang-format 18 is clean on the changed lines.

GRL-SNAM's material-demo --plant turns the governor on for the dynamic and Jolt plants when the running pycvc has it (CVC-Lab/GRL-SNAM, follow-up PR). On the dynamic plant the scenario story then goes from 14 hazard steps (the material-off run) to none.

…rnor

The material's forces slow an agent only by what they take from its goal
pull's surplus over its speed cap. On a plant whose top speed is under nav's
cruise the surplus swallows them: GRL-SNAM's dynamic RoboRacer meets a water
strip square across its path at its top speed of 10 m/s, the water's push
(half the surplus at most) leaves its command as it is, and its run matches
the material-off one to the millimetre. Head on, the push does not steer
either. The drive's answer is the risk governor (veh_params::risk_governor),
but a sim_world took it only from cfg.veh at construction (or the state
tree's pull), and pycvc's create never set it.

sim_world::set_risk_governor(on, vmin, onset, lookahead, probes) switches it
from the next step, with argument checks; risk_governor() reads it back.
pycvc binds nav_sim_world_set_risk_governor and nav_sim_world_risk_governor.

NavMaterialSimWorld.RiskGovernorSlowsAnAgentTheMaterialForcesDoNot: water
17 m wide across an agent's path; it crosses at its 18 m/s top speed with the
forces alone and at 2.4 m/s on average with the governor, and switched off
before the water the run is the ungoverned one, bit for bit.
test_pycvc_nav_governor.py checks the same from Python (8.0 vs 0.4 m/s).
transfix added a commit to CVC-Lab/GRL-SNAM that referenced this pull request Nov 3, 2026
…r material (#154)

JoltPlant names its ground to pycvc's nav_plant (ground_bodies,
transfix/libcvc#1011), so a chassis scraping it is no building contact in
nav_stats; it falls back on a pycvc without the argument.

material-demo --plant runs libcvc's risk governor on the dynamic and Jolt
plants where pycvc has it (sim_world::set_risk_governor, transfix/libcvc#1012;
NativeSimWorld.set_risk_governor, PlantNavigator(risk_governor=...)).
--no-governor shows the forces alone, --governor puts it on the kinematic
bicycle too. The forces slow a vehicle only by what they take from its goal
pull's surplus over its top speed, which on a physics plant is all of it: the
dynamic RoboRacer crossed the scenario story's water at its top speed, its run
the same to the millimetre as without material. Under the governor it stops
short of the water (0 hazard steps, 14 before).

docs/PLANTS.md explains both, with the material demo's table for every plant
with and without the governor.
@transfix
transfix merged commit c8148da into master Nov 4, 2026
27 checks passed
@transfix
transfix deleted the feat/sim-world-risk-governor branch November 4, 2026 03:24
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