[Question] Extracting the heights of the surface of the ground terrain #3650
sashenkalex
started this conversation in
General
Replies: 2 comments
-
To extract the height value of a terrain surface in IsaacLab, access to the height field array is required, as terrains are typically represented by 2D numpy arrays where each cell denotes the surface height at a specific (x, y) coordinate. For height field terrains, IsaacLab provides or generates this array during terrain creation, and sampling it can be achieved by mapping world (x, y) positions to height field grid indices. How to Extract Terrain Height
# Given a height field 'hf' as a (width, length) numpy array
# and horizontal/vertical scales (in meters):
horizontal_scale = cfg.horizontal_scale
vertical_scale = cfg.vertical_scale
# World coordinates (x, y)
x_world = ...
y_world = ...
# Convert to index in the numpy array
i = int(x_world / horizontal_scale)
j = int(y_world / horizontal_scale)
# Clip to array bounds to avoid index errors
i = np.clip(i, 0, hf.shape[^0] - 1)
j = np.clip(j, 0, hf.shape[^1] - 1)
# Get height (in height field units, multiply by vertical_scale if needed)
height = hf[i, j] * vertical_scale
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi, thank you for your reply. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Question
Hello,
I’m working on a locomotion training task in IsaacLab. I’m currently setting up related rewards, and I’d like to get the height of the feet like this relative to the terrains like stairs and slopes. To do so, I'm just wondering whether we can extract the height value of the terrain surface. Are there any functions for this in IsaacLab?
Beta Was this translation helpful? Give feedback.
All reactions