Skip to content

Commit

Permalink
Fixes AttributeError in terrain-based position command (#191)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
abmoRobotics authored and Mayankm96 committed Jan 9, 2024
1 parent 51ccd99 commit ea711bc
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Guidelines for modifications:

## Contributors

* Anton Bjørndahl Mortensen
* Alice Zhou
* Andrej Orsula
* Antonio Serrano-Muñoz
Expand Down
2 changes: 1 addition & 1 deletion source/extensions/omni.isaac.orbit/config/extension.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

# Note: Semantic Versioning is used: https://semver.org/
version = "0.10.10"
version = "0.10.11"

# Description
title = "ORBIT framework for Robot Learning"
Expand Down
14 changes: 14 additions & 0 deletions source/extensions/omni.isaac.orbit/docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
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)
~~~~~~~~~~~~~~~~~~~~

Expand All @@ -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)
~~~~~~~~~~~~~~~~~~~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ def _update_command(self):
"""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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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
Expand Down Expand Up @@ -304,6 +304,26 @@ def update_env_origins(self, env_ids: torch.Tensor, move_up: torch.Tensor, move_
# 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.
"""
Expand Down

0 comments on commit ea711bc

Please sign in to comment.