Skip to content

Commit

Permalink
Fixes naming and shape issues in binary action commands (#25)
Browse files Browse the repository at this point in the history
# Description

This MR fixes naming and shape issues in binary action commands. Previously the action term was not working.

## Type of change

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

## Screenshots

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [x] 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
renezurbruegg committed Nov 16, 2023
1 parent f640376 commit 4a6bd7d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
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.9.40"
version = "0.9.41"

# Description
title = "ORBIT framework for Robot Learning"
Expand Down
9 changes: 9 additions & 0 deletions source/extensions/omni.isaac.orbit/docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
---------

0.9.41 (2023-11-16)
~~~~~~~~~~~~~~~~~~~

Fixed
^^^^^

* Fixed the naming and shaping issues in the binary joint action term.


0.9.40 (2023-11-09)
~~~~~~~~~~~~~~~~~~~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ class BinaryJointActionCfg(ActionTermCfg):

joint_names: list[str] = MISSING
"""List of joint names or regex expressions that the action will be mapped to."""
open_command: dict[str, float] = MISSING
open_command_expr: dict[str, float] = MISSING
"""The joint command to move to *open* configuration."""
close_command: dict[str, float] = MISSING
close_command_expr: dict[str, float] = MISSING
"""The joint command to move to *close* configuration."""


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(self, cfg: actions_cfg.BinaryJointActionCfg, env: BaseEnv) -> None:
raise ValueError(
f"Could not resolve all joints for the action term. Missing: {set(self._joint_names) - set(name_list)}"
)
self._open_command[:, index_list] = torch.tensor(value_list, device=self.device)
self._open_command[index_list] = torch.tensor(value_list, device=self.device)

# parse close command
self._close_command = torch.zeros_like(self._open_command)
Expand All @@ -80,7 +80,7 @@ def __init__(self, cfg: actions_cfg.BinaryJointActionCfg, env: BaseEnv) -> None:
raise ValueError(
f"Could not resolve all joints for the action term. Missing: {set(self._joint_names) - set(name_list)}"
)
self._close_command[:, index_list] = torch.tensor(value_list, device=self.device)
self._close_command[index_list] = torch.tensor(value_list, device=self.device)

"""
Properties.
Expand Down Expand Up @@ -108,10 +108,10 @@ def process_actions(self, actions: torch.Tensor):
# compute the binary mask
if actions.dtype == torch.bool:
# true: close, false: open
binary_mask = (actions == 0).unsqueeze(1)
binary_mask = actions == 0
else:
# true: close, false: open
binary_mask = (actions < 0).unsqueeze(1)
binary_mask = actions < 0
# compute the command
self._processed_actions = torch.where(binary_mask, self._close_command, self._open_command)

Expand Down

0 comments on commit 4a6bd7d

Please sign in to comment.