From 82b88419a6d3b8e29035d2578baac8070dff6f63 Mon Sep 17 00:00:00 2001 From: CloudRipple <30491374+CloudRipple@users.noreply.github.com> Date: Wed, 8 Jan 2025 18:11:58 +0800 Subject: [PATCH] Modify the deprecated interp2d method into the supported RegularGridInterpolator method --- genesis/ext/isaacgym/terrain_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/genesis/ext/isaacgym/terrain_utils.py b/genesis/ext/isaacgym/terrain_utils.py index 2adf519e..ec5c3bed 100644 --- a/genesis/ext/isaacgym/terrain_utils.py +++ b/genesis/ext/isaacgym/terrain_utils.py @@ -77,11 +77,13 @@ def random_uniform_terrain( x = np.linspace(0, terrain.width * terrain.horizontal_scale, height_field_downsampled.shape[0]) y = np.linspace(0, terrain.length * terrain.horizontal_scale, height_field_downsampled.shape[1]) - f = interpolate.interp2d(y, x, height_field_downsampled, kind="linear") + # f = interpolate.interp2d(y, x, height_field_downsampled, kind="linear") + f = interpolate.RegularGridInterpolator((y, x), height_field_downsampled, method="linear") x_upsampled = np.linspace(0, terrain.width * terrain.horizontal_scale, terrain.width) y_upsampled = np.linspace(0, terrain.length * terrain.horizontal_scale, terrain.length) - z_upsampled = np.rint(f(y_upsampled, x_upsampled)) + # z_upsampled = np.rint(f(y_upsampled, x_upsampled)) + z_upsampled = np.rint(f((y_upsampled, x_upsampled))) terrain.height_field_raw += z_upsampled.astype(np.int16) return terrain