-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/giraffe mode #47
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
448fc41
Start of changes to code so robot carries cone high up
y-veys 50cd7a6
Add moving hand to giraffe pose; need to freeze it in place
y-veys 88d1965
Add moving hand to relative pose and freezing so when the robot walks…
856bdf8
Change primary image to frontleft_fisheye_image, since the hand image…
y-veys 96f81cb
Fix make directory bug
y-veys a98a23c
Gazelle mode, freeze the arm if the spot is carrying something.
y-veys 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
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
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
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 |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ | |
|
|
||
| from spot_skills.arm_utils import ( | ||
| close_gripper, | ||
| move_hand_to_relative_pose, | ||
| open_gripper, | ||
| stow_arm, | ||
| ) | ||
|
|
@@ -113,34 +114,12 @@ def object_place(spot, semantic_class="bag", position=None): | |
| return True | ||
|
|
||
| time.sleep(0.25) | ||
| # arm_to_carry(spot) | ||
| # stow_arm(spot) | ||
| # arm_to_drop(spot) | ||
|
|
||
| # odom_T_task = get_root_T_ground_body( | ||
| # robot_state=spot.get_state(), root_frame_name=ODOM_FRAME_NAME | ||
| # ) | ||
| # wr1_T_tool = math_helpers.SE3Pose( | ||
| # 0.23589, 0, -0.03943, math_helpers.Quat.from_pitch(-np.pi / 2) | ||
| # ) | ||
| # force_dir_rt_task = math_helpers.Vec3(0, 0, -1) # adjust downward force here | ||
| # robot_cmd = apply_force_at_current_position( | ||
| # force_dir_rt_task_in=force_dir_rt_task, | ||
| # force_magnitude=8, | ||
| # robot_state=spot.get_state(), | ||
| # root_frame_name=ODOM_FRAME_NAME, | ||
| # root_T_task=odom_T_task, | ||
| # wr1_T_tool_nom=wr1_T_tool, | ||
| # ) | ||
|
|
||
| # Execute the impedance command | ||
| # cmd_id = spot.command_client.robot_command(robot_cmd) | ||
| # spot.robot.logger.info("Impedance command issued") | ||
| # block_until_arm_arrives(spot.command_client, cmd_id, 10.0) | ||
| # input("Did impedance work") | ||
|
|
||
| carry_cmd = RobotCommandBuilder.arm_carry_command() | ||
| spot.command_client.robot_command(carry_cmd) | ||
| time.sleep(1) | ||
|
|
||
| open_gripper(spot) | ||
| # drop_object(spot) | ||
| stow_arm(spot) | ||
| close_gripper(spot) | ||
| execute_recovery_action( | ||
|
|
@@ -167,6 +146,7 @@ def object_grasp( | |
| grasp_constraint=None, | ||
| debug=False, | ||
| feedback=None, | ||
| carry_high=True, | ||
| ): | ||
| debug_images = [] | ||
|
|
||
|
|
@@ -340,6 +320,19 @@ def object_grasp( | |
| ) | ||
| feedback.print("INFO", f"POST-LOOP STATE: {current_state}") | ||
|
|
||
| # If the robot was not successful, send it back to the location it started the skill at | ||
| if not success: | ||
| execute_recovery_action( | ||
| spot, | ||
| recover_arm=True, | ||
| relative_pose=math_helpers.SE2Pose( | ||
| x=np.random.uniform(-1, -0.5), y=0.0, angle=0.0 | ||
| ), | ||
| ) | ||
| if debug: | ||
| return success, debug_images | ||
| return success | ||
|
|
||
| close_cmd = RobotCommandBuilder.claw_gripper_close_command( | ||
| build_on_command=None, | ||
| max_acc=None, | ||
|
|
@@ -351,30 +344,24 @@ def object_grasp( | |
| time.sleep(0.25) | ||
|
|
||
| # Move the arm to a carry position. | ||
| print("") | ||
| print("Grasp finished, search for a person...") | ||
| print("Grasp finished, carrying object.") | ||
| carry_cmd = RobotCommandBuilder.arm_carry_command() | ||
| spot.command_client.robot_command(carry_cmd) | ||
|
|
||
| # Wait for the carry command to finish | ||
| time.sleep(0.75) | ||
| time.sleep(1) | ||
|
|
||
| print("Force stowing arm!") | ||
| # stow_arm(spot) | ||
| force_stow_arm(manipulation_api_client, robot_state_client, spot.command_client) | ||
| time.sleep(1) | ||
|
|
||
| print("Finished grasp.") | ||
|
|
||
| # If the robot was not successful, send it back to the location it started the skill at | ||
| if not success: | ||
| execute_recovery_action( | ||
| spot, | ||
| recover_arm=False, | ||
| relative_pose=math_helpers.SE2Pose( | ||
| x=np.random.uniform(-1, -0.5), y=0.0, angle=0.0 | ||
| ), | ||
| if carry_high: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fine for now but in the future it's probably better to make a data class for this and then have a dictonary of possible poses so we can select different ones depending on the object. |
||
| print("Carrying high") | ||
| body_tform_goal = math_helpers.SE3Pose( | ||
| x=0.6, y=0.0, z=0.6, rot=math_helpers.Quat() | ||
| ) | ||
| move_hand_to_relative_pose(spot, body_tform_goal) | ||
| time.sleep(1) | ||
|
|
||
| print("Finished grasp.") | ||
|
|
||
| if debug: | ||
| return success, debug_images | ||
|
|
||
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the fisheye image instead of the hand for the object?