Repository navigation
pycvc: nav_terrain_build, the terrain planes as numpy arrays - #696
Merged
Merged
Conversation
The C++ reference for a Python twin of P5's terrain plane (the open item "GRL-SNAM's Python twin of H1"). grl-snam-dbg's grade force needs the same planes. nav_terrain_build(heights, cell_w, config) runs terrain_build and returns its slope ((2, rows, cols) float32), grade cost, infeasible cells and limit; config is terrain_config_of's dict form. test_pycvc_physics checks it against numpy, bit for bit: the slope is np.gradient of the float32 heights, and the grade cost is min(1, sin(atan t) / sin(atan limit)) in double, stored float32. It also checks the infeasible cells, a tip ratio lowering the limit, and cell_w 0 refused (68 checks).
transfix
added a commit
to CVC-Lab/GRL-SNAM
that referenced
this pull request
Oct 18, 2026
grl_snam/terrain.py is the twin of libcvc's cvc/nav/terrain.h, the terrain-physics plane of the vehicle-physics plan's P5: - terrain_planes(heights, cell_w, max_grade, tip_ratio, tip_margin): the slope, the grade cost (sin over the sine of the vehicle's limit) and the infeasible cells, bit-identical to cvc::nav::terrain_build; - terrain_limit; - terrain_material(heights, bounds, ...): the grade cost and the infeasible cells as a MaterialGrid, whose field gives the material force law the soft grade force and the barrier, as sim_world::set_terrain builds them; - climb_weight, the H5 route cost's per-metre weight. tests/test_terrain.py: a plane's slope and cost, a tip ratio lowering the limit, the material field pushing downhill, and, with a pycvc carrying nav_terrain_build (transfix/libcvc#696), the planes equal to libcvc's bit for bit under three configs (5 passed locally).
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.
This is the C++ reference for a Python twin of P5's terrain plane, which closes the open item "GRL-SNAM's Python twin of H1". grl-snam-dbg's grade force (H1 in
_compose_forces) needs the same planes.pycvc.nav_terrain_build(heights, cell_w, config)runsterrain_buildand returns a dict:slope: (2, rows, cols) float32, dz/dx then dz/dy;grade_cost: (rows, cols) float32, 1 at the vehicle's limit;infeasible: (rows, cols) uint8;limit: the tangent of the steepest feasible slope.configisnav_plant.terrain_config_of's dict form; missing keys keep the defaults.Test
test_pycvc_physics.py, 68 checks on Windows:np.gradientof the float32 heights, and the grade cost ismin(1, sin(atan t) / sin(atan limit))in double, stored as float32.cell_w0 refused.The new
pycvc-linuxCI job (#694) runs it on every PR once that merges.