Repository navigation
boats: nav drives them, dyn_boat_plant and plant_host's dynamicboat (O12) - #1306
Merged
Merged
Conversation
…O12) cvc::physics::dyn_boat_plant (OCEAN-AND-WEATHER-ROADMAP.md D4) puts a sim_world's agents on boats (world::add_boat) in a borrowed world that floats them, beside dyn_bike_plant and dyn_4w_plant. Each boat goes in over its agent's start at the draft its hull_mesh gives (float_height); a start with no water under it, too shallow, or a hull that cannot float is refused. Every world step a driver turns nav's bicycle angle and acceleration into set_boat_controls. The throttle takes the acceleration as dyn_driver.h does, over the propeller's thrust at the speed through the water, its trim kept across sign changes since the water holds the boat back either way. The rudder holds the bicycle's yaw rate u tan(delta) / L: a feed-forward share of full rudder and a PI term on the yaw rate's error as a curvature. state()'s steer is the angle the driver holds, not the rudder, which fed the driver's corrections into nav's steering-rate limit. The books are the hull's mechanical energy every step: drive and brake (the thrust's T u_a through the water), rudder, damping, water (the field load and the water's own motion on the propeller and rudder), gravity and the integrator's residual. Presets launch (physics_boat_test's boat; 3.19 m/s, 15.4 m) and jonboat (a 350 kg flat box with a steering outboard; 4.0 m/s, 4.1 m), measured. - plant_host: dynamicboat / dynamicboat:<presets> on set_water's field and the geometry; no water is a fallback to the bicycle. - world::water_at; water_sample moves to field.h. - cvc::nav::plant_medium (land, water) and vehicle_plant::medium(), for spawning boats on water later. physics_dyn_boat_plant_test: the presets' envelopes; 2.5 m/s and 0.08 rad/s held exactly on calm water and within 1 % on a 0.3 m swell; the books' residual 6e-8 to 3.5e-5 of the flow; nav drives a launch and a jonboat 120 m to their goals and turns them round to goals behind them; plant_host; a hosted world bit for bit; a pier contact; the refusals; and the pinned hash 96abfc30fcae4fd4 (Windows MSVC; CI to confirm Linux and macOS). No existing hash moved. pycvc does not bind the plant (it binds no boats yet).
transfix
enabled auto-merge (squash)
November 16, 2026 07:29
This was referenced Nov 16, 2026
transfix
added a commit
that referenced
this pull request
Nov 17, 2026
One conflict, in ci.yml's SAN_CXX_TESTS: this branch added stream_test, net_ws_client_test and ariadne_host_test to the sanitizer legs' list, and #1292 added gradient_vector_diffusion_test, critical_points_test and seed_generators_test (reflowing the lines). Kept both. ci.yml's line 1271 (the arigl-web path filter's files.h/files.cpp line) also goes back to master's bytes: master stores ci.yml with CRLF but that one line LF-only, and an earlier merge here had given it a CR, a whitespace-only change in this PR's diff.
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.
O12 of the water roadmap (D4): nav's agents drive boats.
dyn_boat_plantsits besidedyn_bike_plantanddyn_4w_plant, takes nav's command through a driver, keeps an energy ledger like theirs, andplant_hostselects it asdynamicboat.What changed
cvc/physics/dyn_boat_plant.h,src/cvc/physics/dyn_boat_plant.cpp(new). Acvc::nav::vehicle_plantwhose agents drive O11b's boats (world::add_boat) in a borrowed world that holds their water.dyn_boat_descis aboat_descwith ahull_mesh, plusmax_speedandturn_radiusfor nav's plan. Presets, measured:launch()(physics_boat_test's 4 m box boat with a shaft propeller and rudder: 3.19 m/s, 15.4 m) andjonboat()(a 3.6 m flat box of 350 kg with a steering outboard: 4.0 m/s, 4.1 m).hull_meshgives (float_height, by bisection). A start with no fluid field under it, water shallower than the draft, or a hull too heavy to float is refused, and a refused attach leaves no boats behind.dyn_driver.hdoes, over the propeller's thrust at the boat's speed through the water. Its trim is kept when the command changes sign: restarting it, as a car's driver does, held the swell runs 3–5 % slow. The rudder holds the bicycle's yaw rate u·tan δ / L, with a feed-forward share of full rudder and a PI term on the yaw-rate error taken as a curvature.state().steeris the bicycle angle the driver holds, not the rudder. Reported as the rudder, the driver's corrections went into nav's steering-rate limit, and the launch chattered instead of turning round.field_load_on) plus the water's own motion's push on the propeller and rudder. Each force works at the step's mean velocity, so the residual is the integrator's.step_worldoff withbefore_world_step/after_world_step,world_gone,add_vehicle/remove_vehicle/add_desc(what a scene's world vehicles use), and the plant ledger'ssample().plant_host:dynamicboat(the launch) anddynamicboat:<presets>, in a world of the geometry (no flat ground) andset_water(field)'s fluid field.use()throws and the agents fall back to the bicycle, withfallback()true, sopull()does not retry every call.world::water_at(point)(new, public): the water at a point at the field time, as the propeller reads it.water_samplemoved fromfield_step.hintofield.h.cvc::nav::plant_medium(land,water) inplant_types.h, andvehicle_plant::medium(),landby default andwaterfor the boat plant. This is for the later PR that spawns boats as world vehicles and filters spawn points by medium.PHYSICS_API.md("Boats as nav's plant", plant_host,water_at, the header table), and "As built (O12)" under D4 in the roadmap. The roadmap's Status line is untouched.How it was checked (Windows 11, MSVC Release, Jolt)
physics_dyn_boat_plant_test, 11 tests, all pass:sim_worldover open water, a launch and a jonboat reach goals 120 m east from rest in 37.9 s. Then both turn round to goals about 100 m behind them and reach those in 61.0 s, with their books balanced.DynBoatPlant.CrossPlatformGoldenHash=96abfc30fcae4fd4.Every other physics and nav suite this could touch passes, plus
physics_replay_test(ctest),ariadne_scene_world_testandworld_rules_test. The physics ones arephysics_boat_test,physics_hull_test,physics_field_test,physics_world_test,physics_plant_host_test,physics_dyn_bike_plant_test,physics_dyn_4w_plant_test,physics_plant_log_test,physics_codec_test,physics_immersion_test,physics_energy_test,physics_vehicle_test,physics_parity_test,physics_jolt_rollout_test,physics_dyn_contact_testandphysics_pose_tracker_test. The nav ones arenav_plant_test(28 pass; 5 skip by design: experiments behind environment variables),nav_sim_world_test,nav_sim_world_agents_test,nav_stats_test,nav_test,nav_binding_test,nav_route_follower_test,nav_terrain_test,nav_trace_test,nav_vehicle_route_test,nav_world_grid_test,nav_world_planes_testandnav_yield_test.No existing golden hash moved: the world's step is unchanged. Changed lines are formatted with git-clang-format.
Not checked or not done
96abfc30fcae4fd4there. The plant uses onlydet::math andstd::sqrt, and the test's scripted commands avoid libm.boat_desc,hull_mesh,boat_state), and this build has pycvc off.world::water_atreads a field's box, which knows nothing of the terrain inside it, so the spawner needs the water bodies, or the water's top against the ground's height and the boat's draft.snapshot(),physics_codecand a plant save and restore do not carry the plant's driver or books.