Skip to content
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

Add OSC_POSITION option in spacemouse input_utils #209

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion robosuite/utils/input_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ def input2action(device, robot, active_arm="right", env_configuration=None):
# Scale rotation for teleoperation (tuned for OSC) -- gains tuned for each device
drotation = drotation * 1.5 if isinstance(device, Keyboard) else drotation * 50
dpos = dpos * 75 if isinstance(device, Keyboard) else dpos * 125
elif controller.name == 'OSC_POSITION':
dpos = dpos * 75 if isinstance(device, Keyboard) else dpos * 125
else:
# No other controllers currently supported
print("Error: Unsupported controller specified -- Robot must have either an IK or OSC-based controller!")
Expand All @@ -253,7 +255,10 @@ def input2action(device, robot, active_arm="right", env_configuration=None):
grasp = 1 if grasp else -1

# Create action based on action space of individual robot
action = np.concatenate([dpos, drotation, [grasp] * gripper_dof])
if controller.name == "OSC_POSITION":
action = np.concatenate([dpos, [grasp] * gripper_dof])
else:
action = np.concatenate([dpos, drotation, [grasp] * gripper_dof])

# Return the action and grasp
return action, grasp