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

Fix joints and actuators #575

Merged
Merged
Show file tree
Hide file tree
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
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
7 changes: 4 additions & 3 deletions robosuite/robots/legged_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,10 @@ def control(self, action, policy_step=False):
for part_name, applied_action in applied_action_dict.items():
applied_action_low = self.sim.model.actuator_ctrlrange[self._ref_actuators_indexes_dict[part_name], 0]
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
actuator_indexes = self._ref_actuators_indexes_dict[part_name]
actuator_gears = self.sim.model.actuator_gear[actuator_indexes, 0]
applied_action = np.clip(applied_action / actuator_gears, applied_action_low, applied_action_high)
self.sim.data.ctrl[actuator_indexes] = applied_action

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