Repository navigation
pycvc: dyn_bike_plant's wheel spin, side slope, compliant contact and ground - #1002
Merged
Merged
Conversation
… ground pycvc.dyn_bike_plant takes the plant's opt-in options from #982, #983 and #987: wheel_spin; side_slope; and contact, with contact_field (a sim_world handle, whose signed distance on contact_plane is copied as it is now), contact_vehicles and contact_params (a dict of dyn_contact_params' fields). ground, a pycvc.height_field in world metres (copied), gives the plant a ground height, which the vehicle climbs and the side slope reads; before, Python had only a flat ground_z. contact with a world raises, as do contact_field without contact and a contact setting that does not exist. The books gain slip, contact_energy, contact_stored, contact_dissipated and contact_exchange. options() reports the new settings. wheel_speed(i, axle) and contact_now(i) (the barrier's energy, the damper's power, the points touching and the body wrench) read an agent. test_pycvc_physics.py's test_the_dynamic_plant_options: - wheel spin on grip 0.3 books 1.75 kJ of slip, and the axles' wheels part; - a 5% ramp costs 51.5 kJ; - a 10% side slope pulls the vehicle 0.23 m downhill, where the plain ground leaves it on its line; - driven at a wall in another sim_world's map, it stops with its rear axle 4.55 m short, pressed with 4 points at 23.5 kN, and the damping books 81.6 kJ. Every run's books close to 1e-9 of the flow. The contact run uses a 0.005 s substep. At the default 0.01 s the damper, held over the substep, overshoots this 7.8 m/s impact: the books show contact_dissipated at -1.5e5 J (the contact supplying energy), the limiter takes 2.4e5 J, and the residual is 3.1e-2 of the flow. At 0.005, 0.0025 and 0.00125 s the residual is 2.4e-3, 1.3e-3 and 2.6e-4 of the flow. physics_dyn_contact_test impacts at 5 m/s only.
This was referenced Nov 3, 2026
transfix
added a commit
that referenced
this pull request
Nov 7, 2026
…efault substep (#1038) 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.
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.
#982, #983 and #987 gave
dyn_bike_plantthree opt-in options: wheel spin, compliant contact and the side slope.pycvc.dyn_bike_plant(#979) exposed none of them, and none of their book lines. Python also had no way to give the plant a ground other than a flatground_z, so the side slope had nothing to read. This PR binds all of it.The binding (
bindings/pycvc/pycvc_physics.i)New keywords, all defaulting to the plant's current behaviour:
groundpycvc.height_fieldin world metres, copied as it is now. It setsplant.ground_height, falling back toground_zwhere the field has no height. The vehicle climbs it (#869), and the side slope reads it.wheel_spinside_slopecontactcontact_fieldcontact_planeas it is now.dyn_bike_plant::sdf_fieldonly borrows the grid, which the world rebuilds when its map changes, so the copy keeps the field valid.contact_vehiclescontact_paramsdyn_contact_params' fields.Each of these raises:
contacttogether withworld, sincedyn_bike_plant.hsays to use one or the other;contact_fieldwithoutcontact;contact_fieldthat is not a sim_world;Other changes:
books()andlast_tick()gainslip,contact_energy,contact_stored,contact_dissipatedandcontact_exchange.wheel_speed(i, axle), andcontact_now(i), which returns the barrier's energy, the damper's power, the points touching and the body wrench, orNonewithout contact.options()reports the new settings.Test (
test_pycvc_physics.py)test_the_dynamic_plant_optionsruns make_sim's world on the full-size preset:Every run's books close to 1e-9 of the flow, with residuals below 5e-3 of it.
books_gapnow includes the slip and contact lines.All 73 checks of
test_pycvc_physics.pypass, on Windows with MSVC 19.44 Release and Python 3.11.A limit found on the way
The contact case runs at a 0.005 s substep. At the default 0.01 s, the damper, held over each substep, overshoots this 7.8 m/s impact:
contact_dissipatedphysics_dyn_contact_testimpacts at 5 m/s only. This PR changes no plant code. The fix belongs in the plant: an implicit damper, a contact substep, or a cap on h·c_k/m.