Skip to content

Bind the VehicleSim front brake bias to brake.front_bias - #158

Merged
raorjun merged 2 commits into
feat/fourpost-wheel-center-antifrom
fix/generator-brake-bias-binding
Oct 29, 2026
Merged

raorjun merged 2 commits into
feat/fourpost-wheel-center-antifrom
fix/generator-brake-bias-binding

Conversation

@raorjun

@raorjun raorjun commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

What

vehicle.yml brake.front_bias never reached Modelica. BaseVehicleSim binds only brakes.maxTorque, so BasicVCUBrakes ran its own 0.55 front bias, while DynPy and the envelope used 0.84 for the BobSim car.

Changes

  • When brake.front_bias is set, the generated VehicleSim template adds brakes(frontBrakeBias = ...).
  • When it is missing, nothing is bound, and the status and CLI say so. The 9 shipped templates keep working.
  • An invalid value fails before any write.

How to check

New tests in tests/test_modelica_generator.py. A VehicleSim build from a generated template shows brakes.frontBrakeBias start 0.84 in the init XML, against 0.55 on main.

Notes

Risk

This changes the executed VehicleSim braking physics once a template is regenerated. The default car's checked-in templates still run 0.55 until its records are regenerated, which today is blocked by the records-versus-YAML initialization mismatch. No baseline is changed.

Stack

7 of 7, kept last.

vehicle.yml brake.front_bias never reached Modelica. BaseVehicleSim
binds only brakes.maxTorque, so BasicVCUBrakes ran its own 0.55 front
bias while dynpy and the envelope used the YAML value (0.84 for the
BobSim car).

The generated VehicleSim template now adds brakes(frontBrakeBias = ...)
to the BaseVehicleSim extends clause, from brake.front_bias. A missing
key fails with KeyError. A non-numeric value fails with TypeError. A
value outside 0 to 1, NaN or infinity fails with ValueError. Each
failure happens before any write. The FourPost template is unchanged
because BaseFourPostSim has no brakes.

This changes executed VehicleSim braking physics for any regenerated
template. No regression baseline is changed here.
The previous commit made brake.front_bias required. None of the 9
shipped common/vehicle_templates files has a brake section, so Modelica
generation failed for each of them and for the app apply-template flow.
No source names a value to add to those templates.

A missing brake section, a missing key or a null value now binds
nothing. The generated VehicleSim template is then the same as before
this branch, and BobLib BasicVCUBrakes keeps its own default. The status
payload reports the case under front_brake_bias, and the CLI prints a
brake line. A set value still binds brakes.frontBrakeBias. A value that
is not a number, is out of 0 to 1, or a brake entry that is not a
mapping still fails before any write.

Test fixtures no longer copy the brake block from vehicle.yml into
template-based cars. A new test plans each shipped template. The docs
now say when DynPy and the envelope use the same value, and that they
use 0.84 when the key is missing.
@raorjun
raorjun added this pull request to stack #159 October 25, 2026 00:43
@raorjun
raorjun marked this pull request as ready for review October 25, 2026 02:41
@raorjun
raorjun requested a review from rhorvath02 October 25, 2026 02:41
@raorjun
raorjun merged commit 17ce5a8 into main Oct 29, 2026
6 of 7 checks passed
@raorjun
raorjun deleted the fix/generator-brake-bias-binding branch October 29, 2026 22:20
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.

2 participants