Skip to main content
Version: 7

Defining a Grasp Pose

You can detect an object in many ways using MoveIt Pro. The tutorial on Perception and Advanced Motion Planning has more on this, but when it comes time to grasp the object you have to know an appropriate gripper pose relative to the detection. Table scene

One method is to define a grasp pose relative to the detected pose. We'll go over how to do that manually by using the Grasp Pose Tuning With April Tag Objective in the example workspace. Pick April Tagged Cube

Launch MoveIt Pro​

We'll use the lab_sim example workspace for this guide.

moveit_pro run -c lab_sim

What's the Issue?​

While it may be common when doing a pick and place task to think of the detected pose of an object to be where the gripper picks, the location of this pose is dependent on the kind of detection algorithm and the geometry of the gripper. Instead, a different "gripper pose" can be defined relative to the detection which will be used to plan the motion of the grasp. Detected Pose vs Gripper Pose

Manual Definition​

A common pattern is to use the TransformPose Behavior in MoveIt Pro to manually define an {offset_pose} between the {detection_pose} and the target frame of the gripper.
Picture of Objective

To find the values for the offset, you can teleoperate the gripper around the object and then use tf2_echo between your detected frame and your grasp frame. With MoveIt Pro running, enter moveit_pro shell

$ moveit_pro shell 
Launching an interactive Shell...
Sourcing Overlay workspace.
Sourcing User workspace.

user@πŸ™MoveIt ProπŸ™:~/user_ws$ ros2 run tf2_ros tf2_echo apriltag_36h11_0 grasp_link
At time 1740788818.110537220
- Translation: [-0.023, 0.120, 0.221]
- Rotation: in Quaternion [0.998, 0.005, 0.060, 0.009]
- Rotation: in RPY (radian) [3.122, -0.120, 0.011]
- Rotation: in RPY (degree) [178.899, -6.897, 0.642]
- Matrix:
0.993 0.009 0.120 -0.023
0.011 -1.000 -0.018 0.120
0.120 0.019 -0.993 0.221
0.000 0.000 0.000 1.000

Teleoperating gripper around object

Then you can write that to the TransformPose Behavior.

Grasp Pose Tuning With April Tag​

To bring this workflow into MoveIt Pro, we made an example Objective you can use in the example workspace called Grasp Pose Tuning With April Tag that does a lot of this work for you. It will look at an April Tagged object, ask you to teleoperate, then save the offset to a yaml. A complementary Objective called Grasp Pose Using Yaml shows how to load that yaml file and use it to grasp an April Tagged object. You should use these as templates to define your own helper Objectives if you're not using April Tags.

How to​

Under "Advanced Examples" you can find the Grasp Pose Tuning With April Tag Objective. Find Grasp Pose Turning With April Tag under Advanced Examples

Running it will cause the robot to

  • Take a snapshot of the scene
  • Find an April Tagged object
  • Move closer to that object and take another snapshot
  • Visualize the location of the detected frame
  • Ask you to teleoperate the arm to a grasp pose

Look at table and ask for teleop

Then, teleoperate the robot to an acceptable grasp pose. Confirming using the "Success" button will save the offset pose to objectives/relative_grasp_pose.yaml.

Teleoperate to grasp pose

relative_grasp_pose.yaml​

The yaml file contains only a few fields. RelativePose is the namespace of the pose, which is given by position and orientation in quaternion. In other configuration files, the namespace allows you to store multiple poses in the same file.

RelativePose:
position:
x: 0.0044731459359205195
y: -0.0072400335791177328
z: 0.0255272511010739
orientation:
x: 0.015223000347957878
y: 0.026138350404766812
z: 0.0041893089584091612
w: 0.99953363300006781

Grasp Pose Using Yaml​

To see an example of using the offset grasp pose stored as a yaml file, the Objective Grasp Pose Using Yaml is provided. If we inspect the Objective, we can see how it

  • Loads the relative grasp pose yaml into a parameter set
  • Extracts the RelativePose namespaced pose and uses it with the {detection_pose} to make the {offset_pose}
  • Uses the {offset_pose} for grasping
    Find Grasp Pose Turning With April Tag under Advanced Examples

Running this example will cause the robot to pick the block.

Pick the block

Next Steps​

Now that you know how to define a grasp pose, try using it to pick up objects from different orientations, such as from different sides. You could use this in combination with obstacle avoidance to choose from multiple grasps for a given object.