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

WIP: FeatureBranch: adding basic arm services #66

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
28 changes: 28 additions & 0 deletions spot_driver/spot_driver/spot_ros2.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,21 @@ def _get_manipulation_command_feedback(self, goal_id):
self.spot_wrapper.get_manipulation_command_feedback(goal_id), feedback)
return feedback

def handle_arm_stow(self, request, response):
"""ROS service handler for the arm_stow service"""
response.success, response.message = self.spot_wrapper.arm_stow()
return response

def handle_arm_unstow(self, request, response):
"""ROS service handler for the arm_unstow service"""
response.success, response.message = self.spot_wrapper.arm_unstow()
return response

def handle_arm_carry(self, request, response):
"""ROS service handler for the arm_carry service"""
response.success, response.message = self.spot_wrapper.arm_carry()
return response

def handle_manipulation_command(self, goal_handle):
# Most of the logic here copied from handle_robot_command
self.node.get_logger().debug("I'm a function that handles request to the manipulation api!")
Expand Down Expand Up @@ -1406,6 +1421,19 @@ def main(args=None):
spot_ros.handle_robot_command,
callback_group=spot_ros.group)
if has_arm:
node.create_service(
Trigger, "arm_stow",
lambda request, response: spot_ros.service_wrapper('arm_stow', spot_ros.handle_arm_stow, request, response),
callback_group=spot_ros.group)
node.create_service(
Trigger, "arm_unstow",
lambda request, response: spot_ros.service_wrapper('arm_unstow', spot_ros.handle_arm_unstow, request, response),
callback_group=spot_ros.group)
node.create_service(
Trigger, "arm_carry",
lambda request, response: spot_ros.service_wrapper('arm_carry', spot_ros.handle_arm_carry, request, response),
callback_group=spot_ros.group)

spot_ros.manipulation_server = ActionServer(node, Manipulation, 'manipulation',
spot_ros.handle_manipulation_command,
callback_group=spot_ros.group)
Expand Down