Commit ea711bcf authored by Anton Bjørndahl Mortensen's avatar Anton Bjørndahl Mortensen Committed by Mayank Mittal

Fixes AttributeError in terrain-based position command (#191)

Fixes AttributeError in position_command.py and adds a dummy function to TerrainImporter for sampling target locations.

Fixes #189

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

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [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
parent 51ccd99f
......@@ -29,6 +29,7 @@ Guidelines for modifications:
## Contributors
* Anton Bjørndahl Mortensen
* Alice Zhou
* Andrej Orsula
* Antonio Serrano-Muñoz
......
[package]
# Note: Semantic Versioning is used: https://semver.org/
version = "0.10.10"
version = "0.10.11"
# Description
title = "ORBIT framework for Robot Learning"
......
Changelog
---------
0.10.11 (2024-01-08)
~~~~~~~~~~~~~~~~~~~~
Fixed
^^^^^
* Fixed attribute error raised when calling the :class:`omni.isaac.orbit.envs.mdp.TerrainBasedPositionCommand`
command term.
* Added a dummy function in :class:`omni.isaac.orbit.terrain.TerrainImporter` that returns environment
origins as terrain-aware sampled targets. This function should be implemented by child classes based on
the terrain type.
0.10.10 (2023-12-21)
~~~~~~~~~~~~~~~~~~~~
......@@ -11,6 +24,7 @@ Fixed
by ensuring that the extension ``omni.kit.viewport.window`` is enabled in :class:`omni.isaac.orbit.app.AppLauncher` when
livestreaming is enabled
0.10.9 (2023-12-21)
~~~~~~~~~~~~~~~~~~~
......
......@@ -106,12 +106,12 @@ class TerrainBasedPositionCommand(CommandTerm):
"""Re-target the position command to the current root position and heading."""
target_vec = self.pos_command_w - self.robot.data.root_pos_w[:, :3]
self.pos_command_b[:] = quat_rotate_inverse(yaw_quat(self.robot.data.root_quat_w), target_vec)
self.heading_command_b[:] = wrap_to_pi(self.heading_command_w - self.robot.heading_w)
self.heading_command_b[:] = wrap_to_pi(self.heading_command_w - self.robot.data.heading_w)
def _update_metrics(self):
# logs data
self.metrics["error_pos"] = torch.norm(self.pos_command_w - self.robot.data.root_pos_w[:, :3], dim=1)
self.metrics["error_heading"] = torch.abs(wrap_to_pi(self.heading_command_w - self.robot.heading_w))
self.metrics["error_heading"] = torch.abs(wrap_to_pi(self.heading_command_w - self.robot.data.heading_w))
def _set_debug_vis_impl(self, debug_vis: bool):
# create markers if necessary for the first tome
......
......@@ -8,7 +8,7 @@ from __future__ import annotations
import numpy as np
import torch
import trimesh
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Sequence
import warp
from pxr import UsdGeom
......@@ -304,6 +304,26 @@ class TerrainImporter:
# update the env origins
self.env_origins[env_ids] = self.terrain_origins[self.terrain_levels[env_ids], self.terrain_types[env_ids]]
"""
Operations - Sampling
"""
def sample_new_targets(self, env_ids: Sequence[int]) -> torch.Tensor:
"""Samples terrain-aware locations of flat patches to set spawn or target locations.
Note:
This is a dummy function that returns the environment origins as target locations.
Please inherit the class and reimplement the function for specific terrain types
Args:
env_ids: The environment indices to sample targets locations for.
Returns:
The sampled target locations as (x, y, z). Shape is (N, 3).
"""
return self.env_origins[env_ids]
"""
Internal helpers.
"""
......
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