Skip to content

Add input_ref_frame = base option for whole body ik and devices#754

Merged
kevin-thankyou-lin merged 11 commits intomasterfrom
add-input-ref-frame-whole-body-ik
Oct 23, 2025
Merged

Add input_ref_frame = base option for whole body ik and devices#754
kevin-thankyou-lin merged 11 commits intomasterfrom
add-input-ref-frame-whole-body-ik

Conversation

@kevin-thankyou-lin
Copy link
Contributor

What this does

This pull request introduces support for specifying the input reference frame (input_ref_frame) for whole-body inverse kinematics (IK) controllers, allowing actions and goals to be interpreted in either the world or base frame. It also adds a new goal_update_mode parameter to device interfaces, enabling more flexible goal updates based on either desired or achieved states. These changes are reflected in controller configuration, device logic, and demonstration collection scripts.

Whole-Body IK Reference Frame Support

  • Added input_ref_frame as a configurable parameter in robosuite/controllers/composite/composite_controller.py, robosuite/utils/ik_utils.py, and controller config JSONs, enabling IK actions to be interpreted in either the "world" or "base" frame. [1] [2] [3] [4]
  • Modified IK solver logic in robosuite/utils/ik_utils.py to transform target poses between frames as needed, ensuring correct pose computation when using the base frame.

Device and Action Interface Enhancements

  • Updated device interfaces (robosuite/devices/device.py, robosuite/devices/mjgui.py) to support a new goal_update_mode argument, allowing goal updates based on either desired or achieved states, and integrated logic for handling torso actions and reference frames. [1] [2] [3] [4] [5] [6]
  • Improved arm action computation to transform actions to the appropriate reference frame when required, using the new configuration parameter. [1] [2]

Demonstration Collection Improvements

  • Added goal_update_mode as a command-line argument in robosuite/scripts/collect_human_demonstrations.py, propagating it through the demonstration collection pipeline for more flexible data gathering. [1] [2] [3] [4]

These changes collectively provide more control over how actions and goals are interpreted and updated within the whole-body IK framework and demonstration collection workflows.

How it was tested

Examples:

python robosuite/scripts/collect_human_demonstrations.py --controller robosuite/controllers/config/robots/default_pandaomron_whole_body_ik.json --robot PandaOmron --goal_update_mode  achieved

Then, press b to switch between arm and base modes. Note: the controller can do both base and arm control simultaneously, currently that's not enabled in the teleop script.

else:
arm_norm_delta = np.concatenate([dpos, drotation])

if robot.torso is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like it doesnt make the most sense to keep to have this code in the device class? This code just keeps it in the same place right - doesnt look like it has anything to do with the device input?

Copy link
Contributor Author

@kevin-thankyou-lin kevin-thankyou-lin Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the function is input2action() where the output is "a valid action sequence that can be fed into an env.step() call" - where else should this code go?

Copy link
Contributor Author

@kevin-thankyou-lin kevin-thankyou-lin Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it keeps it in the same place; for delta action it's not needed because 0 implicitly keeps things in the same place, but for absolute position control the value would typically be non-zero

Copy link
Member

@Abhiram824 Abhiram824 Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel like we have added similar functionality in the collect_human_demonstrations.py script: https://github.com/ARISE-Initiative/robosuite/blob/master/robosuite/scripts/collect_human_demonstrations.py#L46 and. While its not the best place to have this type of code (which keeps joints in the same state) at least its in one place.

This is how I feel, but if you disagree, I will defer to your opinion on this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point we should update the control function in robot.py to be more flexible, so that we dont always need to specify a no-op explicity when its not delta control, but this can be a separate PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see; prev_gripper code assumes the hand uses absolute position control (which is true in all? the configs we have).

I'll move things to collect_human_demonstrations, the cons are mainly:
i) it'd need to be duplicated across multiple repos that have their own collect_human_demonstrations (in this case, it'll just be robocasa and robosuite).
ii) the collect demos script will look more bloated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That said, I just realized we don't have a torso action in device.py. I'll think about where to add that and then we can decide where to put things

update the control function in robot.py to be more flexible, so that we dont always need to specify a no-op explicity

agreed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seem like the arm has 'prev_target' inside the device i.e. there's an inconsistency between gripper and arm. For the torso height, I've followed arm conventions w/ a new get_torso_action() method

@kevin-thankyou-lin kevin-thankyou-lin merged commit d1cab0b into master Oct 23, 2025
0 of 2 checks passed
ShahRutav pushed a commit to ShahRutav/robosuite that referenced this pull request Dec 31, 2025
…E-Initiative#754)

* Add input_ref_frame = base option for whole body ik and devices

* Correct goal_update_name: desired -> target

* Add more finegrained input_ref_frame for ik controller

* Update function name to controller_base_pose

* Check robot has torso

* Allow torso action as part of base actions

* Enable torso action for joint position delta controller

* Add assert for WHOLE_BODY_IK has 1 robot only

* Format

* Update default goal update mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants