-
Notifications
You must be signed in to change notification settings - Fork 12
Test/grasp heights #1013
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
Open
jlunenburg
wants to merge
10
commits into
master
Choose a base branch
from
test/grasp-heights
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Test/grasp heights #1013
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8deacea
example: grasping height test
jlunenburg 952fcfe
refactor(benchmarks)Moved all grasp benchmarks together in examples
jlunenburg 0645e51
fix(smach)Grasp point determination also works without convex hull
jlunenburg 3b6ee2d
test(smach)Improved info print and preempting of grasp height testscript
jlunenburg 7702914
doc(smach)Added docstring to grasping height test
jlunenburg 9e12e56
fix(smach)Grasppointdetermination: added check on frame ids
jlunenburg 575f91f
Revert "fix(smach)Grasp point determination also works without convex…
09de516
example(smach)Patch 'get_grasp_pose' from grasping height test script
e46ac0b
example(smach)Fixed import in test grasp heights
4c6f072
Merge remote-tracking branch 'origin/master' into test/grasp-heights
LarsJanssenTUe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
77 changes: 77 additions & 0 deletions
77
robot_smach_states/examples/manipulation/grasp_benchmark/grasping_height_test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| #! /usr/bin/env python | ||
|
|
||
| # System | ||
| from collections import namedtuple | ||
|
|
||
| # ROS | ||
| import PyKDL as kdl | ||
| import rospy | ||
|
|
||
| # TU/e Robotics | ||
| from robot_smach_states.manipulation import Grab | ||
| from robot_smach_states.navigation import NavigateToSymbolic | ||
| from robot_smach_states.util.designators import EntityByIdDesignator, UnoccupiedArmDesignator | ||
|
|
||
| # Robot Skills | ||
| from robot_skills import arms | ||
| from robot_skills.hero_parts.hero_arm import HeroArm | ||
| from robot_skills.get_robot import get_robot_from_argv | ||
| from robot_skills.util.kdl_conversions import FrameStamped | ||
|
|
||
| DZ = 0.1 | ||
| Z_MAX = 1.2 | ||
|
|
||
| X_ENTITY = 3.2 | ||
| Y_ENTITY = 1.55 | ||
|
|
||
| Result = namedtuple("Result", ["height", "result", "duration"]) | ||
|
|
||
| if __name__ == "__main__": | ||
|
|
||
| rospy.init_node("test_grasping") | ||
|
|
||
| robot = get_robot_from_argv(1) | ||
|
|
||
| # Navigate to the couch table | ||
| nav_designator = EntityByIdDesignator(robot=robot, id="couch_table") | ||
PetervDooren marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| nav_state = NavigateToSymbolic(robot, {nav_designator: "in_front_of"}, nav_designator) | ||
| nav_state.execute() | ||
|
|
||
| # Setup the test | ||
| z_values = [DZ] | ||
| while z_values[-1] < Z_MAX: | ||
| z_values.append(z_values[-1] + DZ) | ||
|
|
||
| results = [] | ||
| for z in z_values: | ||
jlunenburg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # Add an entity to ed | ||
| grasp_entity_id = "test_entity" | ||
| entity_pose = FrameStamped(kdl.Frame(kdl.Vector(X_ENTITY, Y_ENTITY, z)), "map") | ||
| robot.ed.update_entity(id=grasp_entity_id, frame_stamped=entity_pose) | ||
jlunenburg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Try to grasp the entity | ||
| item_designator = EntityByIdDesignator(robot=robot, id=grasp_entity_id) | ||
| t_start = rospy.Time.now() | ||
| grasp_state = Grab( | ||
| robot, | ||
| item_designator, | ||
| UnoccupiedArmDesignator(robot, { | ||
| "required_goals": ["reset", "carrying_pose"], | ||
| "required_trajectories": ["prepare_grasp"], | ||
| "required_gripper_types": [arms.GripperTypes.GRASPING] | ||
| })) | ||
| grasp_result = grasp_state.execute() | ||
| grasp_duration = (rospy.Time.now() - t_start).to_sec() | ||
| results.append(Result(z, grasp_result, grasp_duration)) | ||
|
|
||
| # Lose the entity | ||
| # noinspection PyProtectedMember | ||
| arm = robot._arms.values()[0] # type: HeroArm | ||
| arm.send_gripper_goal(state=arms.GripperState.OPEN) | ||
|
|
||
| # Print the results | ||
| print("\n ---------- \n") | ||
| for result in results: | ||
| print "Height: {} --> {} (duration: {})".format(result.height, result.result, result.duration) | ||
| print("\n ---------- \n") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.