diff --git a/source/isaaclab/isaaclab/envs/mdp/actions/binary_joint_actions.py b/source/isaaclab/isaaclab/envs/mdp/actions/binary_joint_actions.py index 289045bd37b..0ad8489b817 100644 --- a/source/isaaclab/isaaclab/envs/mdp/actions/binary_joint_actions.py +++ b/source/isaaclab/isaaclab/envs/mdp/actions/binary_joint_actions.py @@ -34,7 +34,7 @@ class BinaryJointAction(ActionTerm): Based on above, we follow the following convention for the binary action: - 1. Open action: 1 (bool) or positive values (float). + 1. Open action: 1 (bool) or non-negative values (float). 2. Close action: 0 (bool) or negative values (float). The action term can mostly be used for gripper actions, where the gripper is either open or closed. This @@ -133,10 +133,10 @@ def process_actions(self, actions: torch.Tensor): self._raw_actions[:] = actions # compute the binary mask if actions.dtype == torch.bool: - # true: close, false: open + # action=True (1) -> open, action=False (0) -> close binary_mask = actions == 0 else: - # true: close, false: open + # action >= 0 -> open, action < 0 -> close binary_mask = actions < 0 # compute the command self._processed_actions = torch.where(binary_mask, self._close_command, self._open_command) diff --git a/source/isaaclab/isaaclab/utils/string.py b/source/isaaclab/isaaclab/utils/string.py index dc1cdaf5347..f78c8de3136 100644 --- a/source/isaaclab/isaaclab/utils/string.py +++ b/source/isaaclab/isaaclab/utils/string.py @@ -183,17 +183,18 @@ def resolve_matching_names( When a list of query regular expressions is provided, the function checks each target string against each query regular expression and returns the indices of the matched strings and the matched strings. - If the :attr:`preserve_order` is True, the ordering of the matched indices and names is the same as the order - of the provided list of strings. This means that the ordering is dictated by the order of the target strings - and not the order of the query regular expressions. + If the :attr:`preserve_order` is False (default), the ordering of the matched indices and names follows + the order of the provided list of strings. This means that the ordering is dictated by the order of the + target strings and not the order of the query regular expressions. - If the :attr:`preserve_order` is False, the ordering of the matched indices and names is the same as the order - of the provided list of query regular expressions. + If the :attr:`preserve_order` is True, the ordering of the matched indices and names follows the order + of the query regular expressions. For example, consider the list of strings is ['a', 'b', 'c', 'd', 'e'] and the regular expressions are ['a|c', 'b']. - If :attr:`preserve_order` is False, then the function will return the indices of the matched strings and the - strings as: ([0, 1, 2], ['a', 'b', 'c']). When :attr:`preserve_order` is True, it will return them as: - ([0, 2, 1], ['a', 'c', 'b']). + If :attr:`preserve_order` is False (default), then the function will return the indices of the matched strings and + the strings as: ([0, 1, 2], ['a', 'b', 'c']) - following the order of list_of_strings. When + :attr:`preserve_order` is True, it will return them as: + ([0, 2, 1], ['a', 'c', 'b']) - following the order of the regex keys. Note: The function does not sort the indices. It returns the indices in the order they are found.