From 0fd40af2fb85a3c82bd7a03c0bc1fcbaad3cb7a3 Mon Sep 17 00:00:00 2001 From: runyud Date: Tue, 2 Sep 2025 10:55:46 -0700 Subject: [PATCH] [fix] fix the toque unit in joint_pos controller --- robosuite/controllers/parts/generic/joint_pos.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/robosuite/controllers/parts/generic/joint_pos.py b/robosuite/controllers/parts/generic/joint_pos.py index 7665679157..1d71a02a14 100644 --- a/robosuite/controllers/parts/generic/joint_pos.py +++ b/robosuite/controllers/parts/generic/joint_pos.py @@ -261,11 +261,11 @@ def run_controller(self): vel_pos_error = -self.joint_vel desired_torque = np.multiply(np.array(position_error), np.array(self.kp)) + np.multiply(vel_pos_error, self.kd) - # Return desired torques plus gravity compensations + # Return desired torques plus gravity compensation + # Note: the desired torques here is actually desired accelerations + self.torques = np.dot(self.mass_matrix, desired_torque) if self.use_torque_compensation: - self.torques = np.dot(self.mass_matrix, desired_torque) + self.torque_compensation - else: - self.torques = desired_torque + self.torques += self.torque_compensation # Always run superclass call for any cleanups at the end super().run_controller()