23 from control_msgs.msg
import (
41 self.
_clientR.wait_for_server(rospy.Duration(5.0))
42 if not self.
_clientR.wait_for_server(rospy.Duration(5.0)):
43 rospy.logerr(
"Exiting - Gripper R Action Server Not Found")
44 rospy.signal_shutdown(
"Action Server not found")
49 self.
_clientL.wait_for_server(rospy.Duration(5.0))
50 if not self.
_clientL.wait_for_server(rospy.Duration(5.0)):
51 rospy.logerr(
"Exiting - Gripper L Action Server Not Found")
52 rospy.signal_shutdown(
"Action Server not found")
57 def command(self, position, effort, type):
59 self.
_goalR.command.position = position
60 self.
_goalR.command.max_effort = effort
63 self.
_goalL.command.position = position
64 self.
_goalL.command.max_effort = effort
79 def wait(self, type, timeout=0.1 ):
81 self.
_clientR.wait_for_result(timeout=rospy.Duration(timeout))
84 self.
_clientL.wait_for_result(timeout=rospy.Duration(timeout))
88 self.
_goalR = GripperCommandGoal()
89 self.
_goalL = GripperCommandGoal()
92 arg_fmt = argparse.RawDescriptionHelpFormatter
93 parser = argparse.ArgumentParser(formatter_class=arg_fmt,
94 description=main.__doc__)
96 print(
"Initializing node... ")
97 rospy.init_node(
"gipper_action_client")
102 print(
"Test - Open Grippers")
104 gc.command(math.radians(gripper),0.1,CONTROL_R)
106 gc.command(math.radians(gripper),0.1,CONTROL_L)
107 result = gc.wait(CONTROL_R,1.0)
109 result = gc.wait(CONTROL_L,1.0)
114 print(
"Test - Close Grippers")
116 gc.command(math.radians(gripper),0.5,CONTROL_R)
118 gc.command(math.radians(gripper),0.5,CONTROL_L)
119 result = gc.wait(CONTROL_R,1.0)
121 result = gc.wait(CONTROL_L,1.0)
125 print(
"Exiting - Gripper Action Test Example Complete")
127 if __name__ ==
"__main__":