-
Notifications
You must be signed in to change notification settings - Fork 2k
Antoiner/action clipping #2694
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
base: main
Are you sure you want to change the base?
Antoiner/action clipping #2694
Conversation
Hi @AntoineRichard, I’ve reviewed the OSC-related parts. They’re largely similar, but this version differs from #1856 in a few places. Below are the items I think deserve another look:
Let me know what you think! |
Thanks a lot for the feedback @ozhanozen I factored in your comments: |
Hi @AntoineRichard, thank you for your consideration and the changes.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AntoineRichard thanks for taking this on. I have a few line specific comments, but one thought I had was that for the more complex actions that require very specific formulation of the clip dict(), we may want to switch to useing subclass config (similar to how we use OffsetCfgs) to help define the API and reduce the checking logic you need to do.
In general things look good a functional. I think the biggest thing will be to define some unit tests for this. I know we don't currently have mdp tests. But I think it would be good to start adding them specifically for the actions without integration to the managers.
preserve_order: bool = False | ||
"""Whether to preserve the order of the joint names in the action output. Defaults to False.""" | ||
|
||
clip: dict[str, tuple] | None = None | ||
"""Clip range for the action (dict of regex expressions). Defaults to None.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Clip range for the action (dict of regex expressions). Defaults to None.""" | |
"""Clip range for the action (dict of regex expressions). Defaults to None. | |
Dictionary keys should be regex expressions of joint names and values should be tuples of (lower, upper) bounds. | |
""" |
@@ -124,6 +130,9 @@ class JointPositionToLimitsActionCfg(ActionTermCfg): | |||
This operation is performed after applying the scale factor. | |||
""" | |||
|
|||
clip: dict[str, tuple] | None = None | |||
"""Clip range for the action (dict of regex expressions). Defaults to None.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Clip range for the action (dict of regex expressions). Defaults to None.""" | |
"""Clip range for the action (dict of regex expressions). Defaults to None. | |
Dictionary keys should be regex expressions of joint names and values should be tuples of (lower, upper) bounds. | |
""" |
clip: dict[str, tuple] | None = None | ||
"""Clip range for the action (dict of regex expressions). | ||
|
||
The expected keys are "v", and "yaw". Defaults to None for no clipping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expected keys are "v", and "yaw". Defaults to None for no clipping. | |
The expected keys are "v", and "yaw". Values are tuples of (lower, upper) bounds. Defaults to None for no clipping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or something like this. min/max or lower/upper is fine whatever is consistent through the actions.
if self._clip_position is not None: | ||
self._processed_actions[:, self._pose_abs_idx : self._pose_abs_idx + 3] = torch.clamp( | ||
self._processed_actions[:, self._pose_abs_idx : self._pose_abs_idx + 3] * self._position_scale, | ||
min=self._clip_position[:, :, 0], | ||
max=self._clip_position[:, :, 1], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure in the class/cfg documentation that we explain the order in which scaling an clipping get handled.
) | ||
else: | ||
self._processed_actions[:, self._pose_abs_idx : self._pose_abs_idx + 3] *= self._position_scale | ||
if self._clip_orientation is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self._clip_orientation is not None: | |
if self._clip_orientation is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just for readability
Description
Improves the support for clipping in the action terms. The
clip
parameter was removed from theActionTermCfg
, and per action term clipping is implemented where relevant. For instance, the Binary action no longer supports clipping. However, the JointActions remain unchanged. Where the biggest changes occurs is on the Holonomic, DifferentialIK, and OSC controllers. These controllers get unique clip configurations tailored to their use-cases.@ozhanozen I know it's been a while since you posted your initial PR, though if you have time, could you check that this PR does what you'd like it to?
Fixes #1548 #1732
Type of change
Checklist
pre-commit
checks with./isaaclab.sh --format
config/extension.toml
fileCONTRIBUTORS.md
or my name already exists there