Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python
- import rospy
- import actionlib
- import actionlib_tutorials.msg
- import control_msgs.msg
- def gripper_client():
- # Creates the SimpleActionClient, passing the type of the action
- # (GripperCommandAction) to the constructor.
- client = actionlib.SimpleActionClient('/gripper/goal', control_msgs.msg.GripperCommandAction)
- # Waits until the action server has started up and started
- # listening for goals.
- client.wait_for_server()
- # Creates a goal to send to the action server.
- goal = control_msgs.msg.GripperCommandActionGoal('header: {seq: 0, stamp: {secs: 0, nsecs: 0}, frame_id: ''}',
- ' goal_id: {stamp: {secs: 0, nsec: 0}, id: '' }',
- ' goal: {command: {position: 0.0, max_effort: 100 } }')
- # Sends the goal to the action server.
- client.send_goal(goal)
- # Waits for the server to finish performing the action.
- client.wait_for_result()
- # Prints out the result of executing the action
- return client.get_result()
- if __name__ == '__main__':
- # Initializes a rospy node so that the SimpleActionClient can
- # publish and subscribe over ROS.
- rospy.init_node('gripper_control')
- gripper_client()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement