9 servo_cart = rospy.ServiceProxy(
'/xarm/move_servo_cart', Move)
15 loop_num = time_secs*float(freq)
16 sleep_sec = 1.0/float(freq)
20 for i
in range(int(loop_num)):
23 print(
"Something Wrong happened calling servo_cart service, index is %d, ret = %d"%(i, res.ret))
29 except rospy.ServiceException
as e:
30 print(
"servo_cartesian (tool) Service call failed: %s"%e)
34 if __name__ ==
"__main__":
36 rospy.wait_for_service(
'/xarm/move_servo_cart')
37 rospy.set_param(
'/xarm/wait_for_finish',
True)
39 motion_en = rospy.ServiceProxy(
'/xarm/motion_ctrl', SetAxis)
40 set_mode = rospy.ServiceProxy(
'/xarm/set_mode', SetInt16)
41 set_state = rospy.ServiceProxy(
'/xarm/set_state', SetInt16)
42 home = rospy.ServiceProxy(
'/xarm/go_home', Move)
54 except rospy.ServiceException
as e:
55 print(
"Before servo_cartesian, service call failed: %s"%e)
63 step = [0.3, 0, 0, 0, 0, 0]
71 print(
"execution finished successfully!")
def servo_cartesian_tool(step, freq, time_secs)