Skip to content

pycvc: dyn_bike_plant's contact_step_depth; the contact test at the default substep - #1038

Merged
transfix merged 1 commit into
masterfrom
feat/pycvc-contact-step-depth
Nov 7, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/pycvc-contact-step-depth

Conversation

@transfix

@transfix transfix commented Nov 7, 2026

Copy link
Copy Markdown
Owner

This follow-up to #1002 and #1004 binds contact_step_depth in pycvc and puts the binding test's contact case back on the default 0.01 s substep.

Why

#1002 bound dyn_bike_plant's compliant contact for Python. It found that the plant overshot a fast impact at the default substep: driven into a wall at 7.8 m/s, the books showed the contact supplying energy. So its test ran the contact case at 0.005 s.

#1004 fixed the overshoot with an implicit damper and friction, plus contact substeps (dyn_bike_plant_options::contact_step_depth, 0.1 m). It left two things for pycvc:

  • contact_step_depth wasn't bound, so Python always got the default;
  • the test's 0.005 s workaround could go.

What changed

bindings/pycvc/pycvc_physics.i

  • pycvc.dyn_bike_plant(..., contact_step_depth=None) takes a number in metres. None keeps the plant's default, and a value ≤ 0 never substeps, as in C++. Anything else raises.
  • options() reports contact_step_depth.

bindings/pycvc/test_pycvc_physics.py, in test_the_dynamic_plant_options:

Checks

On libcvc master f94a9b27 (Windows, MSVC 19.44 Release, Python 3.11), all 77 checks of test_pycvc_physics.py pass.

The contact case at 0.01 s matches #1004's C++ DynContactPlant.AFastImpactAtTheDefaultSubstep: contact_dissipated 8.15e4 J, limiter 0, and a residual of 1.33e-3 of the flow. The books' identity holds to 5e-16 of the flow. Before #1004 the same case gave contact_dissipated −1.52e5 J, limiter −2.42e5 J and a residual of 3.1e-2 of the flow.

…efault substep

pycvc.dyn_bike_plant(..., contact_step_depth=None) binds #1004's
dyn_bike_plant_options::contact_step_depth (m; None keeps the plant's default,
<= 0 never substeps), and options() reports it.

test_pycvc_physics.py's contact case, the navigator driving into a wall from
another sim_world's map at about 7.8 m/s, goes back to the default 0.01 s
substep: #1002 ran it at 0.005 s because the damper overshot, and #1004's
implicit damper and contact substeps fixed that. It now also checks the speed
clamp takes nothing, and the new keyword's round trip, default and type.

All 77 checks pass (Windows, MSVC 19.44 Release, Python 3.11, on master
f94a9b2). At 0.01 s the contact dissipates 8.15e4 J, the limiter takes 0 and
the residual is 1.33e-3 of the flow, as #1004's C++ fast-impact test has it.
@transfix
transfix merged commit 2434c33 into master Nov 7, 2026
26 of 27 checks passed
@transfix
transfix deleted the feat/pycvc-contact-step-depth branch November 7, 2026 06:25
transfix added a commit that referenced this pull request Nov 7, 2026
Bumps the project version and every recipe's upstream_version from 3.7.11 to 3.7.12. The v3.7.12 tag on this commit is the first release with the multi-car controller template (pycvc_gl.cars, #1031 #1035 #1040), the hidden-subtree fix in cvcGL (#1037), the discrete-gradient dyn_bike step (#978), semi-implicit Euler by default in the nav rollout (#981), the implicit contact damper (#1004, #1038), and generated_world's roads and water (#1032, #1034).
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