31 from control_msgs.msg
import GripperCommandAction, GripperCommandGoal, GripperCommand
33 import moveit_commander
41 self.
ns =
'/' + tool_name +
'/' 44 self.
_offset = rospy.get_param(self.
ns +
'tool/offset', [0, 0, 0, 0, 0, 0])
45 self.
_action_ns = rospy.get_param(self.
ns +
'tool/action_ns',
None)
63 ee_link = self._move_group.get_end_effector_link()
64 pose = self._geometry_util.get_current_pose(self.
_origin_link, ee_link)
65 tool_pos = map(
lambda x: x * 1000.0, pose[0])
66 tool_ori = map(
lambda x: math.degrees(x),tf.transformations.euler_from_quaternion(pose[1], axes=
'rzyx'))
67 self.
_offset = tool_pos + tool_ori
69 self.
_offset = [0, 0, 0, 0, 0, 0]
72 if self.
_client and self._client.wait_for_server(rospy.Duration(5)):
73 goal = GripperCommandGoal()
76 self._client.send_goal(goal)
78 return self._client.wait_for_result(rospy.Duration(5))
86 if self.
_client and self._client.wait_for_server(rospy.Duration(5)):
87 goal = GripperCommandGoal()
90 self._client.send_goal(goal)
92 return self._client.wait_for_result(rospy.Duration(5))
102 if __name__ ==
'__main__':
103 rospy.init_node(
'test', anonymous=
True)
107 print(tool.get_offset())