35 from __future__
import division
38 __author__ =
'Antons Rebguns' 39 __copyright__ =
'Copyright (c) 2010-2011 Antons Rebguns' 40 __credits__ =
'Cara Slutter' 43 __maintainer__ =
'Antons Rebguns' 44 __email__ =
'anton@email.arizona.edu' 52 from dynamixel_msgs.msg
import JointState
55 def __init__(self, dxl_io, controller_namespace, port_namespace):
56 JointController.__init__(self, dxl_io, controller_namespace, port_namespace)
73 available_ids = rospy.get_param(
'dynamixel/%s/connected_ids' % self.
port_namespace, [])
74 if not self.
motor_id in available_ids:
75 rospy.logwarn(
'The specified motor id is not connected and responding.')
76 rospy.logwarn(
'Available ids: %s' % str(available_ids))
77 rospy.logwarn(
'Specified id: %d' % self.
motor_id)
128 mcv = (self.
motor_id, torque_enable)
129 self.dxl_io.set_multi_torque_enabled([mcv])
133 self.dxl_io.set_multi_speed([mcv])
136 if slope < DXL_MIN_COMPLIANCE_SLOPE: slope = DXL_MIN_COMPLIANCE_SLOPE
137 elif slope > DXL_MAX_COMPLIANCE_SLOPE: slope = DXL_MAX_COMPLIANCE_SLOPE
139 self.dxl_io.set_multi_compliance_slopes([mcv])
142 if margin < DXL_MIN_COMPLIANCE_MARGIN: margin = DXL_MIN_COMPLIANCE_MARGIN
143 elif margin > DXL_MAX_COMPLIANCE_MARGIN: margin = DXL_MAX_COMPLIANCE_MARGIN
144 else: margin = int(margin)
145 mcv = (self.
motor_id, margin, margin)
146 self.dxl_io.set_multi_compliance_margins([mcv])
149 if punch < DXL_MIN_PUNCH: punch = DXL_MIN_PUNCH
150 elif punch > DXL_MAX_PUNCH: punch = DXL_MAX_PUNCH
151 else: punch = int(punch)
153 self.dxl_io.set_multi_punch([mcv])
156 if max_torque > 1: max_torque = 1.0
157 elif max_torque < 0: max_torque = 0.0
158 raw_torque_val = int(DXL_MAX_TORQUE_TICK * max_torque)
159 mcv = (self.
motor_id, raw_torque_val)
160 self.dxl_io.set_multi_torque_limit([mcv])
164 elif acc > 254: acc = 254
165 self.dxl_io.set_acceleration(self.
motor_id, acc)
169 state = filter(
lambda state: state.id == self.
motor_id, state_list.motor_states)
172 self.joint_state.motor_temps = [state.temperature]
177 self.joint_state.load = state.load
178 self.joint_state.is_moving = state.moving
179 self.joint_state.header.stamp = rospy.Time.from_sec(state.timestamp)
186 self.dxl_io.set_multi_position([mcv])
def process_command(self, msg)
def raw_to_rad(self, raw, initial_position_raw, flipped, radians_per_encoder_tick)
def set_acceleration_raw(self, acc)
def set_compliance_slope(self, slope)
def __init__(self, dxl_io, controller_namespace, port_namespace)
def set_torque_enable(self, torque_enable)
def set_compliance_slope(self, slope)
def set_compliance_punch(self, punch)
def set_compliance_margin(self, margin)
def set_compliance_margin(self, margin)
def process_motor_states(self, state_list)
def set_torque_limit(self, max_torque)
def spd_rad_to_raw(self, spd_rad)
def pos_rad_to_raw(self, pos_rad)
def set_speed(self, speed)
def set_speed(self, speed)
def rad_to_raw(self, angle, initial_position_raw, flipped, encoder_ticks_per_radian)
def set_compliance_punch(self, punch)
def set_torque_limit(self, max_torque)