Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prev_prev_action to ActionTerm #1614

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions source/extensions/omni.isaac.lab/docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
---------

0.30.2 (2024-12-31)
~~~~~~~~~~~~~~~~~~~

Added
^^^^^

* Added ``prev_prev_action`` and ``_prev_prev_action`` to :class:`omni.isaac.lab.managers.ActionTerm`


0.30.1 (2024-12-17)
~~~~~~~~~~~~~~~~~~~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def __init__(self, cfg: object, env: ManagerBasedEnv):
# create buffers to store actions
self._action = torch.zeros((self.num_envs, self.total_action_dim), device=self.device)
self._prev_action = torch.zeros_like(self._action)
self._prev_prev_action = torch.zeros_like(self._action)

# check if any term has debug visualization implemented
self.cfg.debug_vis = False
Expand Down Expand Up @@ -250,6 +251,11 @@ def prev_action(self) -> torch.Tensor:
"""The previous actions sent to the environment. Shape is (num_envs, total_action_dim)."""
return self._prev_action

@property
def prev_prev_action(self) -> torch.Tensor:
"""The previous previous actions sent to the environment. Shape is (num_envs, total_action_dim)."""
return self._prev_prev_action

@property
def has_debug_vis_implementation(self) -> bool:
"""Whether the command terms have debug visualization implemented."""
Expand Down Expand Up @@ -307,6 +313,7 @@ def reset(self, env_ids: Sequence[int] | None = None) -> dict[str, torch.Tensor]
if env_ids is None:
env_ids = slice(None)
# reset the action history
self._prev_prev_action[env_ids] = 0.0
self._prev_action[env_ids] = 0.0
self._action[env_ids] = 0.0
# reset all action terms
Expand All @@ -328,6 +335,7 @@ def process_action(self, action: torch.Tensor):
if self.total_action_dim != action.shape[1]:
raise ValueError(f"Invalid action shape, expected: {self.total_action_dim}, received: {action.shape[1]}.")
# store the input actions
self._prev_prev_action[:] = self._prev_action
self._prev_action[:] = self._action
self._action[:] = action.to(self.device)

Expand Down