Grippers control - kth-ros-pkg/yumi GitHub Wiki
Index
Important note on grippers control
Currently, YuMi only allows very simple control of the grippers, by setting an effort command in the range [-20, 20].
Grippers state
If you want to check the grippers position at any moment, run the following command:
rostopic echo /yumi/gripper_states
ROS service interface
For the ROS service interface the YuMi grippers have been assigned the following IDs:
- Left gripper: 1
- Right gripper: 2
Direct rosservice calls
To open the left gripper:
rosservice call /yumi/yumi_gripper/release_grasp "gripper_id: 1"
To open the right gripper:
rosservice call /yumi/yumi_gripper/release_grasp "gripper_id: 2"
To close the left gripper:
rosservice call /yumi/yumi_gripper/do_grasp "gripper_id: 1"
To close the right gripper:
rosservice call /yumi/yumi_gripper/do_grasp "gripper_id: 2"
Python service calls
To close the right gripper:
service_proxy = rospy.ServiceProxy("/yumi/yumi_gripper/do_grasp", YumiGrasp)
resp = service_proxy(gripper_id) #gripper_id is the ID of your gripper, 1 or 2
rospy.sleep(3)
To open the right gripper:
service_proxy = rospy.ServiceProxy("/yumi/yumi_gripper/release_grasp", YumiGrasp)
resp = service_proxy(gripper_id) #gripper_id is the ID of your gripper, 1 or 2
rospy.sleep(3)
ROS topic interface
Directly publishing to each gripper topic
To send an effort command to the left gripper:
rostopic pub /yumi/gripper_l_effort_cmd std_msgs/Float64 "data: effort_command"
On the other hand, to send an effort command to the right gripper:
rostopic pub /yumi/gripper_r_effort_cmd std_msgs/Float64 "data: effort_command"
Where effort_command
can be replaced with the effort value that you want.
Python topic publishers
To send an effort command to the left gripper:
gripper_l_cmd_pub = rospy.Publisher("/yumi/gripper_l_effort_cmd", Float64, queue_size=1)
gripper_l_cmd_msg = effort_command
gripper_l_cmd_pub.publish(effort_command)
On the other hand, to send an effort command to the right gripper:
gripper_r_cmd_pub = rospy.Publisher("/yumi/gripper_r_effort_cmd", Float64, queue_size=1)
gripper_r_cmd_msg = effort_command
gripper_r_cmd_pub.publish(effort_command)