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

[N/A] blocking sit command #122

Merged
merged 1 commit into from
Jun 26, 2024
Merged
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
17 changes: 16 additions & 1 deletion spot_wrapper/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from bosdyn.client.payload_registration import PayloadNotAuthorizedError
from bosdyn.client.power import PowerClient, power_on, safe_power_off
from bosdyn.client.robot import Robot, UnregisteredServiceError
from bosdyn.client.robot_command import RobotCommandBuilder, RobotCommandClient
from bosdyn.client.robot_command import RobotCommandBuilder, RobotCommandClient, blocking_sit
from bosdyn.client.robot_state import RobotStateClient
from bosdyn.client.spot_check import SpotCheckClient
from bosdyn.client.time_sync import TimeSyncEndpoint
Expand Down Expand Up @@ -1135,6 +1135,21 @@ def sit(self) -> typing.Tuple[bool, str]:
self.last_sit_command = response[2]
return response[0], response[1]

def sit_blocking(self) -> typing.Tuple[bool, str]:
"""
Stop the robot's motion and sit down if able, and block until this function returns.

Returns:
Tuple of bool success and a string message

"""
try:
blocking_sit(command_client=self._robot_command_client, timeout_sec=10, update_frequency=1.0)
return True, "Success"
except Exception as e:
self._logger.error(f"Unable to execute blocking sit: {e}")
return False, str(e)

def simple_stand(self, monitor_command: bool = True) -> typing.Tuple[bool, str]:
"""
If the e-stop is enabled, and the motor power is enabled, stand the robot up.
Expand Down