-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
If you are submitting a bug report, please fill in the following details and use the tag [bug].
Describe the bug
With torch.bool, False == 0 evaluates to True, so False is mapped to close_command and True is mapped to open_command (because torch.where(binary_mask, close, open) is used).
This behavior appears to contradict the inline comment (true: close, false: open) and can also be interpreted as inconsistent with a common expectation that True means “activate/close”. Even if the intended convention is “Open=1/True, Close=0/False”, the current comment is misleading and likely to cause user confusion / integration bugs.
Code reference Binary Joint Action
Steps to reproduce
import torch
# Dummy open/close commands for 2 joints
open_command = torch.tensor([1.0, 1.0])
close_command = torch.tensor([0.0, 0.0])
def process_bool(actions_bool: torch.Tensor):
# current repo logic
binary_mask = actions_bool == 0 # False -> True, True -> False
processed = torch.where(binary_mask, close_command, open_command)
return binary_mask, processed
actions = torch.tensor([[True], [False]], dtype=torch.bool)
mask, out = process_bool(actions)
print("actions:\n", actions.squeeze(-1))
print("binary_mask (True => close):\n", mask.squeeze(-1))
print("processed:\n", out)
Observed output:
actions=True -> binary_mask=False -> selects open_command
actions=False -> binary_mask=True -> selects close_command
So for torch.bool inputs: True => open, False => close.
System Info
Describe the characteristic of your environment:
- Commit: [e.g. 8f3b9ca]
- Isaac Sim Version: [e.g. 5.0, this can be obtained by
cat ${ISAACSIM_PATH}/VERSION] - OS: [e.g. Ubuntu 22.04]
- GPU: [e.g. RTX 5090]
- CUDA: [e.g. 12.8]
- GPU Driver: [e.g. 553.05, this can be seen by using
nvidia-smicommand.]
Additional context
Potential fix options:
If intended behavior is Open=True, Close=False:
Keep logic but fix the comment to match reality, e.g.:
binary_mask: True -> close, False -> open
or # actions: True -> open, False -> close
If intended behavior is Close=True, Open=False:
Change the bool branch to something like:
binary_mask = actions (if True means close)
or binary_mask = actions != 0
and ensure comments + docs match.
Right now the mismatch between code and comment makes it easy for downstream code to pass boolean actions with the wrong meaning.
Checklist
- I have checked that there is no similar issue in the repo (required)
- I have checked that the issue is not in running Isaac Sim itself and is related to the repo
Acceptance Criteria
Add the criteria for which this task is considered done. If not known at issue creation time, you can add this once the issue is assigned.
- Criteria 1
- Criteria 2