-
Notifications
You must be signed in to change notification settings - Fork 64
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
Fb set arm velocity #366
Open
MGBla
wants to merge
3
commits into
bdaiinstitute:main
Choose a base branch
from
MGBla:fb_set_arm_velocity
base: main
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
Fb set arm velocity #366
Changes from all commits
Commits
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 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 @@ | |||||
SingleGoalMultipleActionServers, | ||||||
) | ||||||
from bosdyn.api import ( | ||||||
arm_command_pb2, | ||||||
geometry_pb2, | ||||||
gripper_camera_param_pb2, | ||||||
image_pb2, | ||||||
|
@@ -44,6 +45,7 @@ | |||||
from bosdyn_msgs.conversions import convert | ||||||
from bosdyn_msgs.msg import ( | ||||||
ArmCommandFeedback, | ||||||
ArmVelocityCommandRequest, | ||||||
Camera, | ||||||
FullBodyCommandFeedback, | ||||||
GripperCommandFeedback, | ||||||
|
@@ -495,6 +497,14 @@ def __init__(self, parameter_list: Optional[typing.List[Parameter]] = None, **kw | |||||
|
||||||
self.create_subscription(Twist, "cmd_vel", self.cmd_velocity_callback, 1, callback_group=self.group) | ||||||
self.create_subscription(Pose, "body_pose", self.body_pose_callback, 1, callback_group=self.group) | ||||||
if has_arm: | ||||||
self.create_subscription( | ||||||
ArmVelocityCommandRequest, | ||||||
"arm_velocity", | ||||||
self.handle_arm_velocity_command, | ||||||
1, | ||||||
callback_group=self.group, | ||||||
) | ||||||
self.create_service( | ||||||
Trigger, | ||||||
"claim", | ||||||
|
@@ -2919,6 +2929,43 @@ def handle_set_gripper_camera_parameters( | |||||
|
||||||
return response | ||||||
|
||||||
def handle_arm_velocity_command(self, arm_velocity_command: ArmVelocityCommandRequest) -> None: | ||||||
if self.spot_wrapper is None: | ||||||
return | ||||||
|
||||||
cylindrical_velocity = arm_command_pb2.ArmVelocityCommand.CylindricalVelocity() | ||||||
cylindrical_velocity.linear_velocity.r = arm_velocity_command.command.cylindrical_velocity.linear_velocity.r | ||||||
cylindrical_velocity.linear_velocity.theta = ( | ||||||
arm_velocity_command.command.cylindrical_velocity.linear_velocity.theta | ||||||
) | ||||||
cylindrical_velocity.linear_velocity.z = arm_velocity_command.command.cylindrical_velocity.linear_velocity.z | ||||||
|
||||||
angular_velocity = geometry_pb2.Vec3( | ||||||
x=arm_velocity_command.angular_velocity_of_hand_rt_odom_in_hand.x, | ||||||
y=arm_velocity_command.angular_velocity_of_hand_rt_odom_in_hand.y, | ||||||
z=arm_velocity_command.angular_velocity_of_hand_rt_odom_in_hand.z, | ||||||
) | ||||||
|
||||||
cartesian_velocity = arm_command_pb2.ArmVelocityCommand.CartesianVelocity() | ||||||
cartesian_velocity.velocity_in_frame_name.x = ( | ||||||
arm_velocity_command.command.cartesian_velocity.velocity_in_frame_name.x | ||||||
) | ||||||
cartesian_velocity.velocity_in_frame_name.y = ( | ||||||
arm_velocity_command.command.cartesian_velocity.velocity_in_frame_name.y | ||||||
) | ||||||
cartesian_velocity.velocity_in_frame_name.z = ( | ||||||
arm_velocity_command.command.cartesian_velocity.velocity_in_frame_name.z | ||||||
) | ||||||
cartesian_velocity.frame_name = arm_velocity_command.command.cartesian_velocity.frame_name | ||||||
|
||||||
proto_command = arm_command_pb2.ArmVelocityCommand.Request( | ||||||
cylindrical_velocity=cylindrical_velocity, | ||||||
angular_velocity_of_hand_rt_odom_in_hand=angular_velocity, | ||||||
cartesian_velocity=cartesian_velocity, | ||||||
) | ||||||
|
||||||
return self.spot_wrapper.spot_arm.handle_arm_velocity(proto_command) | ||||||
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.
Suggested change
If we want this to mimic the |
||||||
|
||||||
def populate_camera_static_transforms(self, image_data: image_pb2.Image) -> None: | ||||||
"""Check data received from one of the image tasks and use the transform snapshot to extract the camera frame | ||||||
transforms. This is the transforms from body->frontleft->frontleft_fisheye, for example. These transforms | ||||||
|
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.
You should be able to replace this with the following, using some built in proto to ros conversion:
Can you verify that this still works with your example?
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.
Will test it later this afternoon on the robot :)
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.
Hello, just wondering if you had a chance to test this out?
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.
Hey, sorry didn't had the time yet and our robot is not available for the next two weeks. I will test it then