forked from OrebroUniversity/yumi
-
Notifications
You must be signed in to change notification settings - Fork 38
Grippers control
Yoshua Nava edited this page Dec 20, 2017
·
2 revisions
Currently, YuMi only allows very simple control of the grippers, by setting an effort command in the range [-20, 20].
If you want to check the grippers position at any moment, run the following command:
rostopic echo /yumi/gripper_states
For the ROS service interface the YuMi grippers have been assigned the following IDs:
- Left gripper: 1
- Right gripper: 2
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"
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)
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.
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)