Skip to content

Commit 164022c

Browse files
author
Yu Fang
committed
Fix order
1 parent 2445387 commit 164022c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

robosuite/robots/legged_robot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ def control(self, action, policy_step=False):
186186
for part_name, applied_action in applied_action_dict.items():
187187
applied_action_low = self.sim.model.actuator_ctrlrange[self._ref_actuators_indexes_dict[part_name], 0]
188188
applied_action_high = self.sim.model.actuator_ctrlrange[self._ref_actuators_indexes_dict[part_name], 1]
189-
applied_action = np.clip(applied_action, applied_action_low, applied_action_high)
190-
191-
actuators_indexes = self._ref_actuators_indexes_dict[part_name]
192-
self.sim.data.ctrl[actuators_indexes] = applied_action / self.sim.model.actuator_gear[actuators_indexes, 0]
189+
actuator_indexes = self._ref_actuators_indexes_dict[part_name]
190+
actuator_gears = self.sim.model.actuator_gear[actuator_indexes, 0]
191+
applied_action = np.clip(applied_action / actuator_gears, applied_action_low, applied_action_high)
192+
self.sim.data.ctrl[actuator_indexes] = applied_action
193193

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

0 commit comments

Comments
 (0)