Skip to content

Vehicles start on a slope, not inside it - #1202

Merged
transfix merged 2 commits into
feat/world-gymfrom
fix/generated-world-terrain-hole
Nov 13, 2026
Merged

transfix merged 2 commits into
feat/world-gymfrom
fix/generated-world-terrain-hole

Conversation

@transfix

Copy link
Copy Markdown
Owner

Stacked on #1170 (feat/world-gym). This branch also carries 4a81d3d, the gym follow-up (every plant in a scene world, buildings as obstacles, a world per episode). That commit isn't on GitHub as its own branch yet. The fix is the top commit, 5624aad; review that one.

What was wrong

In world_gym.ari's generated world (seed 1), agent 3 at about (-51.7, 46.4) fell from z 9.7 to -27 on its first steps.

  • The terrain collider has no hole there. A downward raycast at every free 2 m grid cell (17,686 cells) hits the ground within 0.1 m of the grid's height.
  • The spot is a slope of about 0.75. nav_plant::place put every start level, with its origin at one ground sample (the nearest grid cell under the rear axle) plus the resting height.
  • Facing uphill, the Humvee's origin started below the ground at its own centre, with its nose more than a metre deep. A body that starts below a Jolt height field falls through it: the wheel rays start underground and the chassis is pushed out downward.

Fix

  • nav_plant (ground_pose): with ground_height set, a start is tilted onto the least-squares plane through 9 samples under the chassis. Its origin goes its resting height above that plane, then is lifted to clear the highest ground under the chassis underside and the wheels at full reach (+3 cm). Level ground and a constant ground_z keep the pose they had, bit for bit.
  • WorldVehicles: every plant's ground height, and height_at, read the world's terrain height field (the collider's own heights) where it has one. Otherwise they interpolate the grid bilinearly, not the nearest sample.

Tests

  • AriadneSceneWorld.AGeneratedWorldsColliderIsUnderEveryFreeCell: the raycast sweep.
  • AriadneWorldGym.AVehicleStartedOnASlopeStaysOnTheGround: 12 Humvees on slopes from 1 in 3 to 1 in 1, facing up the slope or across it. They start above the ground and are on it 3 s later. With ground_pose off, 2 of the 12 fall to z -27.
  • 195/195 related ctest pass locally.
  • world_gym.py --world generated, seeds 1-6, with both the policy and nav@1: every vehicle stays on the ground (its lowest point is at least 0.15 m above it). Agent 3 now starts 1.32 m above the ground.

Not in this PR

Seed 1's episode still ends early (9.8 s). Agent 1 drives into the shallow water at the west edge, slides down the low-friction underwater slope, and leaves the grid at x = -150 while still on the ground. The world has no edge barrier there.

…a world per episode

WorldVehicles runs jolt, kinematic, dynamic and dynamic4w entities, a navigator per plant (the
dynamic models' chassis in a world of their own holding the world's colliders); entity_spec and
vehicles.spawn.plant name it; across plants vehicles touch by their chassis boxes, and cvcGL draws a
vehicle with no chassis from its pose. A world's terrain alone is its ground
(SceneWorldBody::ground), so a building is an obstacle. WorldGym's regenerate makes a generated
world per episode from the reset's seed (SceneWorld::regenerate_world). GymCars and --gym take the
cars template's plant names; dyn_bike_plant and dyn_4w_plant gain add_desc.
A vehicle in world_gym.ari's generated world (seed 1, agent 3 at about
(-51.7, 46.4)) fell straight down from its first step. The terrain
collider has no hole there: a raycast at every free grid cell hits the
ground. The spot is a slope of about 0.75, and nav_plant placed every
start level at one ground sample (the nearest 2 m grid cell under the
rear axle) plus its resting height. Facing uphill, the Humvee's origin
started under the ground at its own centre and its nose more than a
metre deep; a body that starts below a height field falls through it.

nav_plant: with ground_height set, a start is tilted onto the plane
fitted to the ground under its chassis, its origin its resting height
above that plane, then lifted clear of the highest ground under the
chassis and the wheels at full reach. Level ground and a constant
ground_z keep the pose they had.

WorldVehicles: every plant's ground height (and height_at) is the world's
terrain where it has one, the physics collider's own heights, else the
grid bilinear between its samples, not the nearest sample.

Tests: a downward raycast at every free cell of the generated world finds
the ground at the grid's height; twelve Humvees placed on its slopes
(1 in 3 to 1 in 1, up and across) start above the ground and are on it
3 s later (two fell to z -27 before).
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