Unverified Commit 31e42a5c authored by Nikita Rudin's avatar Nikita Rudin Committed by GitHub

Fixes shape argument ordering in `hf_terrains.random_uniform_terrain` (#426)

# Description

Fixes the shape of arguments in random_uniform_terrain. Previously the
function would crash if the sizes x and y were different.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [ ] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have run all the tests with `./orbit.sh --test` and they pass
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------
Signed-off-by: 's avatarNikita Rudin <48368649+nikitardn@users.noreply.github.com>
parent f44129c4
[package]
# Note: Semantic Versioning is used: https://semver.org/
version = "0.10.22"
version = "0.10.23"
# Description
title = "ORBIT framework for Robot Learning"
......
Changelog
---------
0.10.23 (2024-02-21)
~~~~~~~~~~~~~~~~~~~~
Fixed
^^^^^
* Fixes the order of size arguments in :meth:`omni.isaac.orbit.terrains.height_field.random_uniform_terrain`. Previously, the function would crash if the size along x and y were not the same.
0.10.22 (2024-02-14)
~~~~~~~~~~~~~~~~~~~~
......
......@@ -69,12 +69,12 @@ def random_uniform_terrain(difficulty: float, cfg: hf_terrains_cfg.HfRandomUnifo
# create interpolation function for the sampled heights
x = np.linspace(0, cfg.size[0] * cfg.horizontal_scale, width_downsampled)
y = np.linspace(0, cfg.size[1] * cfg.horizontal_scale, length_downsampled)
func = interpolate.RectBivariateSpline(y, x, height_field_downsampled)
func = interpolate.RectBivariateSpline(x, y, height_field_downsampled)
# interpolate the sampled heights to obtain the height field
x_upsampled = np.linspace(0, cfg.size[0] * cfg.horizontal_scale, width_pixels)
y_upsampled = np.linspace(0, cfg.size[1] * cfg.horizontal_scale, length_pixels)
z_upsampled = func(y_upsampled, x_upsampled)
z_upsampled = func(x_upsampled, y_upsampled)
# round off the interpolated heights to the nearest vertical step
return np.rint(z_upsampled).astype(np.int16)
......
......@@ -22,7 +22,7 @@ class TestScipyOperations(unittest.TestCase):
def test_interpolation(self):
"""Test scipy interpolation 2D method."""
# parameters
size = (10.0, 10.0)
size = (10.0, 12.0)
horizontal_scale = 0.1
vertical_scale = 0.005
downsampled_scale = 0.2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment