diff --git a/spot_driver/spot_driver/spot_ros2.py b/spot_driver/spot_driver/spot_ros2.py index 625e8bee..5a5fa724 100644 --- a/spot_driver/spot_driver/spot_ros2.py +++ b/spot_driver/spot_driver/spot_ros2.py @@ -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", @@ -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: