Skip to content

Commit

Permalink
[N/A] Add crouching stand service (#562)
Browse files Browse the repository at this point in the history
Signed-off-by: Laura Lee <[email protected]>
  • Loading branch information
llee-bdai authored Jan 23, 2025
1 parent 24e2886 commit 0528141
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions spot_driver/spot_driver/spot_ros2.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,12 @@ def __init__(self, parameter_list: Optional[typing.List[Parameter]] = None, **kw
lambda request, response: self.service_wrapper("stand", self.handle_stand, request, response),
callback_group=self.group,
)
self.create_service(
Trigger,
"crouch",
lambda request, response: self.service_wrapper("crouch", self.handle_crouch, request, response),
callback_group=self.group,
)
self.create_service(
Trigger,
"rollover",
Expand Down Expand Up @@ -1158,6 +1164,15 @@ def handle_stand(self, request: Trigger.Request, response: Trigger.Response) ->
response.success, response.message = self.spot_wrapper.stand()
return response

def handle_crouch(self, request: Trigger.Request, response: Trigger.Response) -> Trigger.Response:
"""ROS service handler for the crouch service (standing as low as possible)"""
if self.spot_wrapper is None:
response.success = False
response.message = "Spot wrapper is undefined"
return response
response.success, response.message = self.spot_wrapper.stand(body_height=-0.15)
return response

def handle_rollover(self, request: Trigger.Request, response: Trigger.Response) -> Trigger.Response:
"""ROS service handler for the rollover service"""
if self.spot_wrapper is None:
Expand Down

0 comments on commit 0528141

Please sign in to comment.