Skip to content

Commit

Permalink
Remove remaining joints and fix actuator computation
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu Fang committed Nov 22, 2024
1 parent 74c6aac commit 2445387
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ def _remove_joint_actuation(self, part_name):
parent_body = find_parent(self.actuator, motor)
parent_body.remove(motor)
self._actuators.remove(motor.get("name").replace(self.naming_prefix, ""))
for fixed in self.tendon.findall(".//fixed"):
for joint in fixed.findall(".//joint"):
if part_name in joint.get("joint"):
parent_body = find_parent(self.tendon, fixed)
parent_body.remove(fixed)
break

def _remove_free_joint(self):
# remove freejoint
Expand Down
3 changes: 2 additions & 1 deletion robosuite/robots/legged_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ def control(self, action, policy_step=False):
applied_action_high = self.sim.model.actuator_ctrlrange[self._ref_actuators_indexes_dict[part_name], 1]
applied_action = np.clip(applied_action, applied_action_low, applied_action_high)

self.sim.data.ctrl[self._ref_actuators_indexes_dict[part_name]] = applied_action
actuators_indexes = self._ref_actuators_indexes_dict[part_name]
self.sim.data.ctrl[actuators_indexes] = applied_action / self.sim.model.actuator_gear[actuators_indexes, 0]

# If this is a policy step, also update buffers holding recent values of interest
if policy_step:
Expand Down

0 comments on commit 2445387

Please sign in to comment.