From 1a28c9a3407555faf1fd7a7891cdee98af43a10c Mon Sep 17 00:00:00 2001 From: "Diosdado Borrego, Jorge (Digital, Pullenvale)" Date: Wed, 14 Oct 2015 10:16:32 +1000 Subject: [PATCH] fixed bug torque_controller --- .../src/dynamixel_controllers/joint_torque_controller.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dynamixel_controllers/src/dynamixel_controllers/joint_torque_controller.py b/dynamixel_controllers/src/dynamixel_controllers/joint_torque_controller.py index 076bf0f..03d78dc 100644 --- a/dynamixel_controllers/src/dynamixel_controllers/joint_torque_controller.py +++ b/dynamixel_controllers/src/dynamixel_controllers/joint_torque_controller.py @@ -116,12 +116,16 @@ def spd_rad_to_raw(self, spd_rad): def set_torque_enable(self, torque_enable): mcv = (self.motor_id, torque_enable) - self.dxl_io.set_multi_torque_enabled([mcv]) + self.dxl_io.set_multi_torque_enabled([mcv]) def set_speed(self, speed): mcv = (self.motor_id, self.spd_rad_to_raw(speed)) self.dxl_io.set_multi_speed([mcv]) + def set_goal_torque(self,torque): + print torque + self.dxl_io.set_goal_torque(self.motor_id, int(torque)) + def set_compliance_slope(self, slope): if slope < DXL_MIN_COMPLIANCE_SLOPE: slope = DXL_MIN_COMPLIANCE_SLOPE elif slope > DXL_MAX_COMPLIANCE_SLOPE: slope = DXL_MAX_COMPLIANCE_SLOPE @@ -166,5 +170,5 @@ def process_motor_states(self, state_list): self.joint_state_pub.publish(self.joint_state) def process_command(self, msg): - self.set_speed(msg.data) + self.set_goal_torque(msg.data)