Unverified Commit 6451d235 authored by xavier's avatar xavier Committed by GitHub

Adds flag to preserve joint order inside `JointActionCfg` action term (#787)

# Description

Adds the attribute `preserve_order` in `JointActionCfg`, to choose whether joint-related actions should keep the same
order as how the `joint_names` are listed in the config.

Fixes #786

## Type of change

- New feature 

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [ ] 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 0bad5005
...@@ -54,6 +54,7 @@ Guidelines for modifications: ...@@ -54,6 +54,7 @@ Guidelines for modifications:
* Rosario Scalise * Rosario Scalise
* Shafeef Omar * Shafeef Omar
* Vladimir Fokow * Vladimir Fokow
* Xavier Nal
* Zhengyu Zhang * Zhengyu Zhang
* Ziqi Fan * Ziqi Fan
......
[package] [package]
# Note: Semantic Versioning is used: https://semver.org/ # Note: Semantic Versioning is used: https://semver.org/
version = "0.21.0" version = "0.21.1"
# Description # Description
title = "Isaac Lab framework for Robot Learning" title = "Isaac Lab framework for Robot Learning"
......
Changelog Changelog
--------- ---------
0.21.1 (2024-08-06)
~~~~~~~~~~~~~~~~~~~
* Added a flag to preserve joint ordering inside the :class:`omni.isaac.lab.envs.mdp.JointAction` action term.
0.21.0 (2024-08-05) 0.21.0 (2024-08-05)
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
......
...@@ -29,6 +29,8 @@ class JointActionCfg(ActionTermCfg): ...@@ -29,6 +29,8 @@ class JointActionCfg(ActionTermCfg):
"""Scale factor for the action (float or dict of regex expressions). Defaults to 1.0.""" """Scale factor for the action (float or dict of regex expressions). Defaults to 1.0."""
offset: float | dict[str, float] = 0.0 offset: float | dict[str, float] = 0.0
"""Offset factor for the action (float or dict of regex expressions). Defaults to 0.0.""" """Offset factor for the action (float or dict of regex expressions). Defaults to 0.0."""
preserve_order: bool = False
"""Whether to preserve the order of the joint names in the action output. Defaults to False."""
@configclass @configclass
......
...@@ -56,7 +56,9 @@ class JointAction(ActionTerm): ...@@ -56,7 +56,9 @@ class JointAction(ActionTerm):
super().__init__(cfg, env) super().__init__(cfg, env)
# resolve the joints over which the action term is applied # resolve the joints over which the action term is applied
self._joint_ids, self._joint_names = self._asset.find_joints(self.cfg.joint_names) self._joint_ids, self._joint_names = self._asset.find_joints(
self.cfg.joint_names, preserve_order=self.cfg.preserve_order
)
self._num_joints = len(self._joint_ids) self._num_joints = len(self._joint_ids)
# log the resolved joint names for debugging # log the resolved joint names for debugging
carb.log_info( carb.log_info(
......
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