Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Opening and closing the gripper of PR2

I am using this moveit python tutorial to move the end effector to particular pose. Since the code in in python, I am struggling to find a good way of opening and closing the gripper. Somebody can help? All I need is opening and closing the gripper functionality, I do not need pick and place. It seems like there is absolutely no way to do it in python.

Opening and closing the gripper of PR2

I am using this moveit python tutorial to move the end effector to particular pose. Since the code in in python, I am struggling to find a good way of opening and closing the gripper. Somebody can help? All I need is opening and closing the gripper functionality, I do not need pick and place. It seems like there is absolutely no way to do it in python.

Opening How to call the openGripper functon from python

I need to open and closing close the gripper of PR2

I am using PR2. I did not find any option to do that in python. From this moveit python tutorial to move tutorial, I found these functions:

void openGripper(trajectory_msgs::JointTrajectory& posture)
{
  // BEGIN_SUB_TUTORIAL open_gripper
  /* Add both finger joints of panda robot. */
  posture.joint_names.resize(2);
  posture.joint_names[0] = "panda_finger_joint1";
  posture.joint_names[1] = "panda_finger_joint2";

  /* Set them as open, wide enough for the end effector to particular pose. Since the code in in python, I am struggling to find object to fit. */
  posture.points.resize(1);
  posture.points[0].positions.resize(2);
  posture.points[0].positions[0] = 0.04;
  posture.points[0].positions[1] = 0.04;
  posture.points[0].time_from_start = ros::Duration(0.5);
  // END_SUB_TUTORIAL
}


void closedGripper(trajectory_msgs::JointTrajectory& posture)
{
  // BEGIN_SUB_TUTORIAL closed_gripper
  /* Add both finger joints of panda robot. */
  posture.joint_names.resize(2);
  posture.joint_names[0] = "panda_finger_joint1";
  posture.joint_names[1] = "panda_finger_joint2";

  /* Set them as closed. */
  posture.points.resize(1);
  posture.points[0].positions.resize(2);
  posture.points[0].positions[0] = 0.00;
  posture.points[0].positions[1] = 0.00;
  posture.points[0].time_from_start = ros::Duration(0.5);
  // END_SUB_TUTORIAL
}

Could anyone provide a good way of opening and closing the gripper. Somebody can help? All I need is opening and closing the gripper functionality, simple example of how to call these functions from python? I do not need pick how to wrap python with C++ and place. It seems like there I did not find any straightforward tutorial for ROS. The panda_finger_joint1 should be replaced by PR2's joint though which I think is absolutely no way to do it in python._gripper_joint.