-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat: add clip range of JointAction #1476
base: main
Are you sure you want to change the base?
Conversation
Currently limits are handled by the actuators. Primarily this is done on the effort. |
So how can I clip actions in isaaclab like in legged_gym? |
Hmm I guess if you are using joint position commands the actuator limits won't really handle that. Actuator limits really only do effort. I will take another look at the current api and get back to you. |
Thanks for reply! |
The discussion in this PR may be relevant - #984. This seems like something that would make more sense for the wrappers. |
Which method is better? I don't know if this should be an env feature or an action feature |
Yeah #984 makes the clip for all actions where this PR will makes the clip configurable for each action separately. To me it makes sense to have the action handle the clipping rather than the environment. |
I guess this one only handles the joint_actions. |
For me, this allows more flexibility in configuring each joint individually. So is this PR necessary? |
That's a good point, this could be useful for configuring the joints separately, but only applicable for joint actions. Perhaps there's value in adopting both approaches. |
I could see both and also adding the clip configuration at the base ActionTerm/Cfg. It would just require that the actual processing be added to all provided actions. |
Hey @fan-ziqi would you be willing to add the clipping cfg to the top level ActionTermCfg, the clip checking in the top level ActionTerm.init , and then add the clipping execution to all the provided actions in the envs/mdp/actions directory? |
I have added But I have a question, is @configclass
class ActionsCfg:
"""Action specifications for the MDP."""
joint_pos = mdp.JointPositionActionCfg(
asset_name="robot", joint_names=[".*"], scale=0.5, use_default_offset=True, clip={".*": (-100.0, 100.0)}
) or @configclass
class ActionsCfg:
"""Action specifications for the MDP."""
joint_pos = mdp.JointPositionActionCfg(
asset_name="robot", joint_names=[".*"], scale=0.5, use_default_offset=True, clip=(-100.0, 100.0)
) |
I think being able to do clip=dict[str,tuple] is necessary to be able to set clips on a per joint basis. |
Thanks a lot for the feature! would it be possible to add some unit tests for it as well? |
@@ -115,6 +123,13 @@ def process_actions(self, actions: torch.Tensor): | |||
binary_mask = actions < 0 | |||
# compute the command | |||
self._processed_actions = torch.where(binary_mask, self._close_command, self._open_command) | |||
# clip actions | |||
if self._clip is not None: | |||
# resolve the dictionary config |
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.
is it possible to resolve this once at initialization and convert to a torch tensor to avoid more overhead with the loop?
Description
Add action clip to all mdp/actions
Type of change
Checklist
pre-commit
checks with./isaaclab.sh --format
config/extension.toml
fileCONTRIBUTORS.md
or my name already exists there