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

Add grasps BOTTOM and BACK #255

Merged
merged 3 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/pycram/datastructures/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class Grasp(int, Enum):
LEFT = 1
RIGHT = 2
TOP = 3
BACK = 4
BOTTOM = 5


class ObjectType(int, Enum):
Expand Down
10 changes: 6 additions & 4 deletions src/pycram/robot_descriptions/pr2_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@
pr2_description.add_kinematic_chain("neck", "head_pan_link", "head_tilt_link")

################################# Grasps ##################################
pr2_description.add_grasp_orientations({Grasp.FRONT: [0, 0, 0, 1],
Grasp.LEFT: [0, 0, -1, 1],
Grasp.RIGHT: [0, 0, 1, 1],
Grasp.TOP: [0, 1, 0, 1]})
pr2_description.add_grasp_orientations({Grasp.FRONT: [0.0, 0.0, 0.0, 1.0],
Grasp.BACK: [0.0, 0.0, 1.0, 0.0],
Grasp.LEFT: [0.0, 0.0, -0.7071067811865475, 0.7071067811865476],
Grasp.RIGHT: [0.0, 0.0, 0.7071067811865475, 0.7071067811865476],
Grasp.TOP: [0.0, 0.7071067811865475, 0.0, 0.7071067811865476],
Grasp.BOTTOM: [0.0, -0.7071067811865475, 0.0, 0.7071067811865476]})

# Add to RobotDescriptionManager
rdm = RobotDescriptionManager()
Expand Down
6 changes: 3 additions & 3 deletions test/test_designator/test_move_and_pick_up.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def setUpClass(cls):
def test_variables(self):
object_designator = ObjectDesignatorDescription(types=[Milk]).resolve()
move_and_pick = MoveAndPickUp(object_designator, arms=[Arms.LEFT, Arms.RIGHT],
grasps=[Grasp.FRONT, Grasp.LEFT, Grasp.RIGHT, Grasp.TOP])
grasps=[Grasp.FRONT, Grasp.LEFT, Grasp.RIGHT, Grasp.TOP, Grasp.BOTTOM, Grasp.BACK])
result = SortedSet([Symbolic("arm", PMArms), Symbolic("grasp", PMGrasp),
Continuous("relative_x"), Continuous("relative_y")])
all_variables = move_and_pick.all_variables()
Expand All @@ -37,7 +37,7 @@ def test_variables(self):
def test_grounding(self):
object_designator = ObjectDesignatorDescription(types=[Milk]).resolve()
move_and_pick = MoveAndPickUp(object_designator, arms=[Arms.LEFT, Arms.RIGHT],
grasps=[Grasp.FRONT, Grasp.LEFT, Grasp.RIGHT, Grasp.TOP])
grasps=[Grasp.FRONT, Grasp.LEFT, Grasp.RIGHT, Grasp.TOP, Grasp.BOTTOM, Grasp.BACK])

model = move_and_pick.ground_model()
event = move_and_pick.events_from_occupancy_and_visibility_costmap()
Expand All @@ -47,7 +47,7 @@ def test_grounding(self):
def test_move_and_pick_up_with_mode(self):
object_designator = ObjectDesignatorDescription(types=[Milk]).resolve()
move_and_pick = MoveAndPickUp(object_designator, arms=[Arms.LEFT, Arms.RIGHT],
grasps=[Grasp.FRONT, Grasp.LEFT, Grasp.RIGHT, Grasp.TOP])
grasps=[Grasp.FRONT, Grasp.LEFT, Grasp.RIGHT, Grasp.TOP, Grasp.BOTTOM, Grasp.BACK])
with simulated_robot:
for action in move_and_pick.iter_with_mode():
try:
Expand Down