how to open pr2 gripper with moveit_commander

asked 2017-03-04 18:52:56 -0500

iakinola gravatar image

updated 2017-03-05 02:26:59 -0500

gvdhoorn gravatar image

Hi, I cannot get move group to open gripper of pr2 eventhough I can successfully move the head torso and other parts of pr2 using the MoveGroupCommander. See the code below with two basic functions: move_head and open_gripper. This does not work when I try to open the gripper's hand. Note that the gripper's hand closes when it is opened and I set all the joint values to zero. But I can't get it to open when the gripper's hands are closed.

# coding: utf-8
import sys

import moveit_commander
import rospy
import roscpp

def home_head():
    mgc = moveit_commander.MoveGroupCommander("head")
    jv = mgc.get_current_joint_values()
    jv[0] = 0.0
    jv[1] = 0.5
    p = mgc.plan()

def open_right_hand():
    mgc = moveit_commander.MoveGroupCommander("right_gripper")
    jv = mgc.get_current_joint_values()    
    jv = [1.0, 1.0, 0.477, 0.477, 0.477, 0.477, 0.04]
    p = mgc.plan()

if __name__ == "__main__":

    node_name = "ready_pr2"

    rospy.loginfo(node_name + ": is initialized")

    rc = moveit_commander.RobotCommander()
    rospy.loginfo("robot commander is initialized")

    rospy.loginfo("head homed")  

    rospy.loginfo("right_gripper opened")  

edit retag flag offensive close merge delete


Hi, did you resolved your issue ? I am also trying to move the gripper with moveit at a joint level. I can control the gripper with GripperCommand value (position, max effort) but can't manage to control it with joint. Joint control of gripper is necessary to be able to use Pick place pipeline but also move it task constructor which make grasping easier.

Madcreator gravatar image Madcreator  ( 2020-02-07 02:51:02 -0500 )edit