Skip to content

Commit

Permalink
Merge branch 'v1.5.0' of https://github.com/ARISE-Initiative/robosuite
Browse files Browse the repository at this point in the history
…into update-readme
  • Loading branch information
kevin-thankyou-lin committed Oct 29, 2024
2 parents 321375c + 785c5da commit 7e5c234
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 15 deletions.
5 changes: 5 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ Josiah Wong <[email protected]>
Ajay Mandlekar <[email protected]>
Roberto Martín-Martín <[email protected]>
Abhishek Joshi <[email protected]>
Kevin Lin <[email protected]>
Soroush Nasiriany <[email protected]>
Yifeng Zhu <[email protected]>

Past Contributors
Zhenyu Jiang <[email protected]>
Yuqi Xie <[email protected]>
Abhiram Maddukuri <[email protected]>
You Liang Tan <[email protected]>
Jiren Zhu <[email protected]>
Jim (Linxi) Fan <[email protected]>
Orien Zeng <[email protected]>
Expand Down
3 changes: 3 additions & 0 deletions robosuite/controllers/composite/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .composite_controller import CompositeController, HybridMobileBase, WholeBodyIK
from robosuite.examples.third_party_controller.mink_controller import WholeBodyMinkIK
from .composite_controller import COMPOSITE_CONTROLLERS_DICT

ALL_COMPOSITE_CONTROLLERS = COMPOSITE_CONTROLLERS_DICT.keys()
Expand All @@ -15,5 +16,7 @@ def composite_controller_factory(type, sim, robot_model, grippers):
return HybridMobileBase(sim, robot_model, grippers)
elif type == "WHOLE_BODY_IK":
return WholeBodyIK(sim, robot_model, grippers)
elif type == "WHOLE_BODY_MINK_IK":
return WholeBodyMinkIK(sim, robot_model, grippers)
else:
return COMPOSITE_CONTROLLERS_DICT[type](sim, robot_model, grippers)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "WHOLE_BODY_IK",
"type": "WHOLE_BODY_MINK_IK",
"composite_controller_specific_configs": {
"ref_name": ["gripper0_right_grip_site", "gripper0_left_grip_site"],
"interpolation": null,
Expand Down
2 changes: 1 addition & 1 deletion robosuite/devices/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def get_arm_action(self, robot, arm, norm_delta, goal_update_mode="target"):
] # update next target either based on achieved pose or current target pose

# TODO: ideally separate kinematics from controller to unify frame conversion logic
if robot.composite_controller_config["type"] == "WHOLE_BODY_IK":
if robot.composite_controller_config["type"] == "WHOLE_BODY_MINK_IK":
site_names: List[str] = self.env.robots[0].composite_controller.joint_action_policy.site_names
for site_name in site_names:
target_name_prefix = "right" if "right" in site_name else "left" # hardcoded for now
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "WHOLE_BODY_IK",
"type": "WHOLE_BODY_MINK_IK",
"composite_controller_specific_configs": {
"ref_name": ["gripper0_right_grip_site", "gripper0_left_grip_site"],
"interpolation": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def _get_task_errors(self) -> List[float]:

@register_composite_controller
class WholeBodyMinkIK(WholeBody):
name = "WHOLE_BODY_IK"
name = "WHOLE_BODY_MINK_IK"

def __init__(self, sim: MjSim, robot_model: RobotModel, grippers: Dict[str, GripperModel]):
super().__init__(sim, robot_model, grippers)
Expand Down
1 change: 1 addition & 0 deletions robosuite/models/assets/robots/gr1/robot.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<camera mode="fixed" name="obs_hands" pos="0.3 0.000 1.535" xyaxes="0.000 1.000 0.000 -0.707 0.000 0.707" />
<geom name="floor" pos="0 0 -0.97" size="1 1 0.02" type="plane" material="grid" />
<body name="base">
<freejoint/>
<inertial pos="-0.0508888 0.000109183 -0.0455794" quat="0.706855 0.707166 0.0123661 -0.0109307" mass="6.45117" diaginertia="0.0149302 0.0127972 0.00640923" />
<body name="whole_body">
<site name="pelvis" pos="0 0 0" size="0.06 0.06 0.06" rgba="1 0 0 0" type="sphere" group="1" />
Expand Down
11 changes: 6 additions & 5 deletions robosuite/models/grippers/inspire_hands.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ def format_action(self, action):
# the more correct way is to add <equality> tag in the xml
# however the tag makes finger movement laggy, so manually copy the value for finger joints
# 0 is thumb rot, no copying. Thumb bend has 3 joints, so copy 3 times. Other fingers has 2 joints, so copy 2 times.
# TODO(YL): verify the correctness of the copied values
assert len(action) == self.dof
action = np.array(action)
indices = np.array([0, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5])
return action[indices]

@property
def init_qpos(self):
return np.array([0.0] * self.dof)
return np.array([0.0] * 12)

@property
def speed(self):
return 0.15

@property
def dof(self):
return 12
return 6

@property
def _important_geoms(self):
Expand Down Expand Up @@ -92,21 +92,22 @@ def format_action(self, action):
# the more correct way is to add <equality> tag in the xml
# however the tag makes finger movement laggy, so manually copy the value for finger joints
# 0 is thumb rot, no copying. Thumb bend has 3 joints, so copy 3 times. Other fingers has 2 joints, so copy 2 times.
assert len(action) == self.dof
action = np.array(action)
indices = np.array([0, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5])
return action[indices]

@property
def init_qpos(self):
return np.array([0.0] * self.dof)
return np.array([0.0] * 12)

@property
def speed(self):
return 0.15

@property
def dof(self):
return 12
return 6

@property
def _important_geoms(self):
Expand Down
4 changes: 2 additions & 2 deletions robosuite/models/robots/manipulators/manipulator_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def add_gripper(self, gripper: GripperModel, arm_name: Optional[str] = None):
# Update cameras in this model
self.cameras = self.get_element_names(self.worldbody, "camera")

def _update_joints(self):
def update_joints(self):
"""internal function to update joint lists"""
for joint in self.all_joints:
if "torso" in joint:
Expand All @@ -113,7 +113,7 @@ def _update_joints(self):
):
self._arms_joints.append(joint)

def _update_actuators(self):
def update_actuators(self):
"""internal function to update actuator lists"""
for actuator in self.all_actuators:
if "torso" in actuator:
Expand Down
4 changes: 2 additions & 2 deletions robosuite/robots/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ def load_model(self):
else:
self.robot_model.add_base(base=robot_base_factory(self.base_type, idn=self.idn))

self.robot_model._update_joints()
self.robot_model._update_actuators()
self.robot_model.update_joints()
self.robot_model.update_actuators()
# Use default from robot model for initial joint positions if not specified
if self.init_qpos is None:
self.init_qpos = self.robot_model.init_qpos
Expand Down
4 changes: 2 additions & 2 deletions robosuite/scripts/collect_human_demonstrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def gather_demonstrations_as_hdf5(directory, out_dir, env_info):
"--controller",
type=str,
default=None,
help="Choice of controller. Can be generic (eg. 'BASIC' or 'WHOLE_BODY_IK') or json file (see robosuite/controllers/config for examples)",
help="Choice of controller. Can be generic (eg. 'BASIC' or 'WHOLE_BODY_MINK_IK') or json file (see robosuite/controllers/config for examples)",
)
parser.add_argument("--device", type=str, default="keyboard")
parser.add_argument("--pos-sensitivity", type=float, default=1.0, help="How much to scale position user inputs")
Expand All @@ -234,7 +234,7 @@ def gather_demonstrations_as_hdf5(directory, out_dir, env_info):
robot=args.robots[0],
)

if controller_config["type"] == "WHOLE_BODY_IK":
if controller_config["type"] == "WHOLE_BODY_MINK_IK":
# mink-speicific import. requires installing mink
from robosuite.examples.third_party_controller.mink_controller import WholeBodyMinkIK

Expand Down
1 change: 1 addition & 0 deletions tests/test_grippers/test_all_grippers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def _test_gripper(gripper):
assert action is not None

assert gripper.init_qpos is not None
assert len(gripper.init_qpos) == len(gripper.joints)


if __name__ == "__main__":
Expand Down

0 comments on commit 7e5c234

Please sign in to comment.