7 from std_msgs.msg
import String
8 from std_msgs.msg
import Float64
9 from std_msgs.msg
import Empty
13 from numpy.linalg
import inv
14 import lp_filter
as lp
15 import med_filter
as mdf
45 self.
pubMcmd_Arm = rospy.Publisher(
'/quori/arm_' + self.
st +
'/cmd_pos_dir', Vector3, queue_size=1)
49 self.
pubJointState = rospy.Publisher(
'/quori/arm_' + self.
st +
'/shoulder_pos', Vector3, queue_size=1)
53 self.
pubJointSpeed = rospy.Publisher(
'/quori/arm_' + self.
st +
'/shoulder_speed', Vector3, queue_size=1)
113 rospy.Subscriber(
'/quori/arm_' + self.
st +
'/pos_status',Vector3,self.
armJ_callback)
117 rospy.Subscriber(
'/quori/arm_' + self.
st +
'/motor_status',Vector3,self.
armM_callback)
121 rospy.Subscriber(
'/quori/arm_' + self.
st +
'/joint_goal',Vector3,self.
goal_callback)
150 rospy.logwarn(
'error-reasonable value received for y:'+self.
st)
154 rospy.logwarn(
'error-reasonable speed sensed for y:'+self.
st)
174 rospy.loginfo(
'arm sensor read. init arm J')
198 rospy.loginfo(
'motors sensed on.')
202 rospy.loginfo(
"inited arm motor pos filter")
218 rospy.logwarn(
'Joint speed limit x for ' +self.
st +
' reached')
223 rospy.logwarn(
'Joint speed limit y for ' + self.
st +
' reached')
276 if abs(diff)> math.pi:
295 if __name__ ==
'__main__':
296 rospy.init_node(
'Arm_Controller_node')
297 rospy.loginfo(
'Arm Controller node started')
300 controller_right.subscribe2topics()
301 controller_left.subscribe2topics()
305 while not rospy.is_shutdown():
307 if controller_right.mode == 1:
308 controller_right.setMotorGoalFromArm()
309 elif controller_right.mode == 0:
311 controller_right.coast_msg()
313 if controller_left.mode == 1:
314 controller_left.setMotorGoalFromArm()
315 elif controller_left.mode == 0:
317 controller_left.coast_msg()
320 controller_left.pubMcmd_Arm.publish(controller_left.motor_cmd)
321 controller_left.pubJointState.publish(controller_left.pubJointState_msg)
322 controller_left.pubJointSpeed.publish(controller_left.pubJointSpeed_msg)
325 controller_right.pubMcmd_Arm.publish(controller_right.motor_cmd)
326 controller_right.pubJointState.publish(controller_right.pubJointState_msg)
327 controller_right.pubJointSpeed.publish(controller_right.pubJointSpeed_msg)
329 if (rospy.get_time()-controller_right.last_sync)>controller_right.sync_time
and 1:
330 controller_right.sync_pos()
331 controller_left.sync_pos()
332 controller_right.last_sync = rospy.get_time()
333 controller_right.rate.sleep()