Commit 01dcde53 authored by peterd-NV's avatar peterd-NV Committed by Kelly Guo

Fixes idle action in replay script for GR1 Pick-Place env (#360)

# Description

<!--
Thank you for your interest in sending a pull request. Please make sure
to check the contribution guidelines.

Link:
https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html
-->

Adds an "idle_action" parameter to the GR1 pick-place env. The
replay_demo script is also updated to check if envs have an idle action
pre-defined in its config and uses it if present. If not present, the
replay script will continue to use a zero tensor for idle actions.

This fixes errors during demo replay if an env doesn't support a zero
action tensor.

## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

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


## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.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
- [ ] 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

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->
parent 79a5d9f6
...@@ -162,6 +162,12 @@ def main(): ...@@ -162,6 +162,12 @@ def main():
elif args_cli.validate_states and num_envs > 1: elif args_cli.validate_states and num_envs > 1:
print("Warning: State validation is only supported with a single environment. Skipping state validation.") print("Warning: State validation is only supported with a single environment. Skipping state validation.")
# Get idle action (idle actions are applied to envs without next action)
if hasattr(env_cfg, "idle_action"):
idle_action = env_cfg.idle_action.repeat(num_envs, 1)
else:
idle_action = torch.zeros(env.action_space.shape)
# reset before starting # reset before starting
env.reset() env.reset()
teleop_interface.reset() teleop_interface.reset()
...@@ -175,8 +181,8 @@ def main(): ...@@ -175,8 +181,8 @@ def main():
first_loop = True first_loop = True
has_next_action = True has_next_action = True
while has_next_action: while has_next_action:
# initialize actions with zeros so those without next action will not move # initialize actions with idle action so those without next action will not move
actions = torch.zeros(env.action_space.shape) actions = idle_action
has_next_action = False has_next_action = False
for env_id in range(num_envs): for env_id in range(num_envs):
env_next_action = env_episode_data_map[env_id].get_next_action() env_next_action = env_episode_data_map[env_id].get_next_action()
......
[package] [package]
# Note: Semantic Versioning is used: https://semver.org/ # Note: Semantic Versioning is used: https://semver.org/
version = "0.10.30" version = "0.10.31"
# Description # Description
title = "Isaac Lab Environments" title = "Isaac Lab Environments"
......
Changelog Changelog
--------- ---------
0.10.31 (2025-04-02)
~~~~~~~~~~~~~~~~~~~~
Changed
^^^^^^^
* Adds an idle action parameter to the ``Isaac-PickPlace-GR1T2-Abs-v0`` environment configuration.
0.10.30 (2025-03-25) 0.10.30 (2025-03-25)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
import tempfile import tempfile
import torch
from pink.tasks import FrameTask from pink.tasks import FrameTask
...@@ -342,6 +343,48 @@ class PickPlaceGR1T2EnvCfg(ManagerBasedRLEnvCfg): ...@@ -342,6 +343,48 @@ class PickPlaceGR1T2EnvCfg(ManagerBasedRLEnvCfg):
# Temporary directory for URDF files # Temporary directory for URDF files
temp_urdf_dir = tempfile.gettempdir() temp_urdf_dir = tempfile.gettempdir()
# Idle action to hold robot in default pose
# Action format: [left arm pos (3), left arm quat (4), right arm pos (3), right arm quat (4),
# left hand joint pos (11), right hand joint pos (11)]
idle_action = torch.tensor([
-0.22878,
0.2536,
1.0953,
0.5,
0.5,
-0.5,
0.5,
0.22878,
0.2536,
1.0953,
0.5,
0.5,
-0.5,
0.5,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
])
def __post_init__(self): def __post_init__(self):
"""Post initialization.""" """Post initialization."""
# general settings # general settings
......
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