Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grasp generation tools #44

Merged
merged 15 commits into from
Jan 5, 2023
Merged

Grasp generation tools #44

merged 15 commits into from
Jan 5, 2023

Conversation

sea-bass
Copy link
Owner

@sea-bass sea-bass commented Dec 25, 2022

This PR creates a grasp generation pipeline that takes in the gripper / object dimensions, plus the robot pose relative to the object, and generates a set of feasible grasps.

For now, we'll assume all grasps will point towards the center and axis-aligned with a cuboid object.

The goal for this PR is:

  • Given an object's geometry (2D polygon footprint + height), fit a minimum-area cuboid to it
  • Given the cuboid and the robot's pose, return a set of valid grasps

In a follow-on PR, this pipeline will be linked to an example showing a next level of TAMP fidelity, where the planner can only pick up objects given feasible grasp locations sampled from this pipeline.

Here is a visualization of the grasp generation. You can run this with:

cd /path/to/pyrobosim
python pyrobosim/examples/demo_grasping.py

image

  • The light gray cuboid is fit from the darker gray object footprint, plus is given a height. This is how pyrobosim objects are parameterized
  • The black dashed line shows where the robot is facing the object from. So, for example, if the robot is approaching the cuboid from the back, a front grasp will be flipped around accordingly
  • The colored brackets are grasp candidates, based on the gripper dimensions specified

Begins addressing #45.

@sea-bass sea-bass requested a review from AndyZe December 25, 2022 20:39
@sea-bass sea-bass marked this pull request as ready for review December 31, 2022 18:48
@sea-bass sea-bass requested a review from AndyZe December 31, 2022 18:48
Comment on lines +33 to +51
class GraspDirection(Enum):
""" Enumerates grasp direction types. """
UNKNOWN = 0
X_POS = 1
X_NEG = 2
Y_POS = 3
Y_NEG = 4
Z_POS = 5
Z_NEG = 6

vec_from_direction = {
GraspDirection.UNKNOWN: None,
GraspDirection.X_POS: np.array([1.0, 0.0, 0.0]),
GraspDirection.X_NEG: np.array([-1.0, 0.0, 0.0]),
GraspDirection.Y_POS: np.array([0.0, 1.0, 0.0]),
GraspDirection.Y_NEG: np.array([0.0, -1.0, 0.0]),
GraspDirection.Z_POS: np.array([0.0, 0.0, 1.0]),
GraspDirection.Z_NEG: np.array([0.0, 0.0, -1.0]),
}
Copy link
Owner Author

@sea-bass sea-bass Dec 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how this will then morph into supporting grasps at other angles. Maybe the direction should just be a unit vector, but the enum can help look up some common directions?

Actually, the "pose" portion of the grasp should already capture this as the +Z axis should point towards the gripper from the grasp point.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fitting a cylinder to the object would make this easier but I could imagine some objects (like a banana) where a cylinder doesn't work well...

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In an ideal world, we'd provide the option of doing cuboid, cylinder, sphere, etc.

While implementation was tough with the cuboid, I mostly picked it because it makes the number of samples for TAMP pretty small, assuming we're just targeting the center of each face as we do in this PR.

I know the MoveIt grasps package, for example, adds more complexity to this by

  • Allowing corner grasps
  • Sampling offsets from the center

pyrobosim/examples/demo_grasping.py Outdated Show resolved Hide resolved
pyrobosim/pyrobosim/core/objects.py Outdated Show resolved Hide resolved
pyrobosim/pyrobosim/core/robot.py Show resolved Hide resolved
pyrobosim/pyrobosim/manipulation/grasping.py Show resolved Hide resolved
pyrobosim/pyrobosim/manipulation/grasping.py Outdated Show resolved Hide resolved
pyrobosim/pyrobosim/manipulation/grasping.py Show resolved Hide resolved
pyrobosim/pyrobosim/manipulation/grasping.py Show resolved Hide resolved
pyrobosim/pyrobosim/manipulation/grasping.py Outdated Show resolved Hide resolved
pyrobosim/pyrobosim/manipulation/grasping.py Show resolved Hide resolved
@sea-bass sea-bass requested a review from AndyZe January 5, 2023 19:38
@sea-bass sea-bass merged commit 2e3d3c8 into main Jan 5, 2023
@sea-bass sea-bass deleted the grasp-generator branch January 9, 2023 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants