8 from control_msgs.msg
import (
26 self.
_clientR.wait_for_server(rospy.Duration(5.0))
27 if not self.
_clientR.wait_for_server(rospy.Duration(5.0)):
28 rospy.logerr(
"Exiting - Gripper R Action Server Not Found")
29 rospy.signal_shutdown(
"Action Server not found")
34 self.
_clientL.wait_for_server(rospy.Duration(5.0))
35 if not self.
_clientL.wait_for_server(rospy.Duration(5.0)):
36 rospy.logerr(
"Exiting - Gripper L Action Server Not Found")
37 rospy.signal_shutdown(
"Action Server not found")
42 def command(self, position, effort, type):
44 self.
_goalL.command.position = position
45 self.
_goalL.command.max_effort = effort
48 self.
_goalR.command.position = position
49 self.
_goalR.command.max_effort = effort
64 def wait(self, type, timeout=0.1 ):
66 self.
_clientL.wait_for_result(timeout=rospy.Duration(timeout))
69 self.
_clientR.wait_for_result(timeout=rospy.Duration(timeout))
73 self.
_goalL = GripperCommandGoal()
74 self.
_goalR = GripperCommandGoal()
77 arg_fmt = argparse.RawDescriptionHelpFormatter
78 parser = argparse.ArgumentParser(formatter_class=arg_fmt,
79 description=main.__doc__)
81 print(
"Initializing node... ")
82 rospy.init_node(
"gipper_action_client")
87 print(
"Test - Open Grippers")
89 gc.command(math.radians(gripper),0.1,CONTROL_R)
91 gc.command(math.radians(gripper),0.1,CONTROL_L)
92 result = gc.wait(1.0,CONTROL_R)
94 result = gc.wait(1.0,CONTROL_L)
99 print(
"Test - Close Grippers")
101 gc.command(math.radians(gripper),0.5,CONTROL_R)
103 gc.command(math.radians(gripper),0.5,CONTROL_L)
104 result = gc.wait(CONTROL_R,1.0)
106 result = gc.wait(CONTROL_L,1.0)
110 print(
"Exiting - Gripper Action Test Example Complete")
112 if __name__ ==
"__main__":
def command(self, position, effort, type)
def wait(self, type, timeout=0.1)