Repository navigation
nav: physics in the navigator's energy (P5): grade, gravity, slope features, slip modulators, an energy route - #692
Merged
Merged
Conversation
Terrain enters the drive, the governors, the features and the routes (doc 31 D9, H1-H5). Without a terrain and without modulation gains every tick is unchanged. - cvc/nav/terrain.h: the slope, the grade cost (sin over the sine of the vehicle's limit) and the infeasible cells from a height raster; sim_world::set_terrain / set_terrain_config / infeasible_entries; nav_plant::terrain_config_of gives a vehicle's climb and SSF. - H1: the grade cost through the material pipeline as a soft force and a hard barrier; infeasible cells join the occupancy. - H2: gravity along the path in the stopping governor (less braking downhill, never counting on help uphill) and across it in the corner cap; the Jolt driver model feeds the contact normals' grade forward. - H3: the slope look-ahead feature (kFlagFeatSlope, format v3). - H4: plant_state gains tire use, load transfer, pitch and roll; the plant's plant_modulation scales gamma and the hard barriers. - H5: astar's climb cost, a metre of rise as 1 / C_rr metres of flat. nav_stats gains infeasible_slope_steps when a terrain is set. The terrain knobs (nav_terrain.*, cvc/physics/nav_terrain_binding.h), the modulation knobs (nav_plant.modulation.*) and each vehicle's measured state are in the state tree, every key described with a comment, access, unit and recommended min/max. On the Jolt Humvee: over a 12 m hill 7826 kJ/km against 15403 for a path 1.44x as long; 0 ticks on a 1.2-slope ridge; round a 30 m circle on mu 0.7 mean tire use 0.79 against 1.36 with the modulator.
sim_world::pull / publish put the world's settings in the state tree, as world_binding and nav_plant do, under <prefix>.nav: - the live knobs: sensing, belief, arrival and the crowd (set_live_knobs' set), veh_params' scalars under nav.vehicle, the material weights under nav.material and the terrain under nav.terrain (a change rebuilds its planes); - publish(): nav.settings (the grid, the frame, dt, agents, planes, the plant), nav.tick and the terrain's telemetry. Lengths, speeds and accelerations are in nav's world frame (metres), not the normalized one. Each knob is seeded from the world, applied on a change and ignored when invalid. The physics-side terrain binding (cvc/physics/nav_terrain_binding.h) is gone: sim_world binds its terrain itself. The key-description form moves into core as cvc/state/state_key_meta.h, which physics' binding_meta.h now aliases. nav_binding_test covers the seeding, the units, a change reaching the drive, the material and terrain groups and every key's metadata.
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.
P5 of the vehicle physics roadmap: physics in the navigator's energy (doc 31 D9, H1–H5). A
sim_worldcan take a height raster and a vehicle's limits. From them it gets terrain in its drive, its governors, its features and its routes. Without a terrain and without modulation gains, every tick is byte-identical to before.Stacked on P4 (the plant seam), and opened once that merges.
The terrain
cvc/nav/terrain.h:terrain_buildturns a height raster into three planes:max_grade, or, with a tip ratio, thantip_margin× the static stability factor.Everything is per unit mass, so the trained coefficients keep their meaning.
sim_world::set_terrain(heights, config)builds the planes.set_terrain_configrebuilds them from the same heights.infeasible_entries()counts each agent's ticks with its footprint (rear axle or body discs) on an infeasible cell.nav_plant::terrain_config_of(desc, mu)gives a vehicle's limits:The M1097A2 climbs 0.68 and tips past 1.23 (CG 0.742 m).
H1–H5
H1, the grade force and the hard barrier. The grade cost goes through
material_buildand the material force path:F = -lam_grade ∇r̃_gplus a material-style barrier off the infeasible cells (terrain_drive). Withblock_infeasible(the default) the infeasible cells also join every belief plane's occupancy, so the SDF barrier and the governors keep agents off them.H2, gravity in the governors. The drive samples the slope under each agent:
a_stop = max(min(a_max, a_max + g_along), 0.1 a_max). That is less braking downhill and never counts on gravity's help uphill, because the command never brakes harder thana_max. An earlier version that did count on it let the kinematic agent tunnel into a wall uphill;On the Jolt plant the vehicle's driver model also feeds gravity along the ground forward. It takes the grade from the wheels' contact normals, not the chassis pitch, which biased it. The contact normal is saved and restored, so replays still match.
H3, the slope look-ahead feature.
coef_feats(..., slope)appends the worst grade cost between the agent and its carrot, after grip and risk.kFlagFeatSlope(bit 4) and needs format v3. A pre-v3 host refuses it instead of reading a 6-input slope net as a grip net.has_mu()no longer claims a slope net.H4, measured slip and load as modulators.
plant_stategainstire_use(the most used tire's combined slip over its peak; 0 below 2 m/s),load_transfer,pitchandroll;nav_plantmeasures them.plant_modulationscales each agent's gamma pasttire_onset/tip_onset, and its hard barriers' weight pasttip_onset.vehicle_plant::modulation(),nav_plant::set_modulation) and are 0 by default.H5, an energy route cost.
astar(..., cost, climb)andastar_query::climbcharge each moveper_metre× its rise.climb_weight(c_rr, cell_w)weighs a metre of rise as 1 / C_rr metres of flat. Downhill costs nothing extra, and the heuristic stays admissible.Stats and the state tree
nav_statsgainsinfeasible_slope_stepsper vehicle andtotal_infeasible_slope_stepsper episode. They appear in the record, the JSON and cvcGL'spublish_nav_statsonly when a terrain is set (terrain_tracked).sim_worldbinds its own settings (sim_world::pull/publish), asworld_bindingandnav_plantdo. The code is insrc/cvc/nav/sim_world_binding.cpp, kept out of sim_world.cpp so the state tree's platform headers never meet the drive's. Lengths, speeds and accelerations are in nav's world frame (metres), not the normalized one. Each knob is seeded from the world, applied on a change and ignored when invalid:<prefix>.nav.{range_m, n_rays, fov_rad, sense_every, freeze_sense, l_occ, l_free, optimistic, p_thresh, band, ttl_s, reach_tol, sep_radius, sep_gain, min_gap, min_gap_iters}: sensing, belief, arrival and the crowd;<prefix>.nav.vehicle.{vmax, a_max, a_lat_max, wheelbase, delta_max, track_width, k_steer, nsub, allow_reverse, rr, d_hat, body_rr, body_gain, mass, mu_lookahead, mu_probes};<prefix>.nav.material.{lam_soft, lam_hard, lam_soft_scale, lam_hard_scale}, with a material;<prefix>.nav.terrain.{max_grade, tip_ratio, tip_margin, sigma, lam_grade, lam_grade_hard, k_sharp, d_hat_m, block_infeasible, governors}, with a terrain; a change rebuilds its planes.publish()writes<prefix>.nav.settings.{rows, cols, min_x, ..., dt, agents, planes, plant},nav.tickand the terrain's{active, gravity, limit, infeasible_cells}.One metadata form.
cvc/state/state_key_meta.h(state_key_meta,describe_state_key,describe_state_keys) is the key-description formworld_bindingused privately, now in core so nav uses it too. Physics'binding_meta.haliases it.The plant's keys.
nav_plant::pullreadsnav_plant.modulation.{tire_onset, tire_gain, tip_onset, tip_gain}.nav_plant::publishadds each vehicle'snav.{tire_use, load_transfer, pitch_rad, roll_rad}.Every new key has a comment,
accessandunit, and every knob has a recommendedminandmax.Gates
nav_plant_testruns on the Jolt plant andnav_terrain_teston the kinematic one. All runs are Windows MSVC with the Humvee.Also measured:
tire_gain3.Not in this PR
Test
nav_terrain_test(6),nav_binding_test(4) andnav_plant_test(13) pass.RegistryKeyLookupFailed CoderModulesPath), fixed on master by image: find ImageMagick's coders beside its own DLL; init it before every Magick++ use #673. The fourth is a timing test that fails under-j 8load and passed five runs alone; it wasStateClusterMembership.FailureDetectionSuspecton the last run andStateExecTypesTest.TimeBudgetChargesAStallAtMostASixteenthOfTheSecondHalfon the one before./Zs); cvcGL is not built on this box.