Keepalive
Client implementation of the Keepalive service.
- exception bosdyn.client.keepalive.KeepaliveResponseError(response, error_message=None)[source]
Bases:
ResponseError
Error in Keepalive RPC
- exception bosdyn.client.keepalive.InvalidLeaseError(response, error_message=None)[source]
Bases:
KeepaliveResponseError
A policy’s associated lease was not the same, super, or sub lease of the active lease.
- exception bosdyn.client.keepalive.InvalidPolicyError(response, error_message=None)[source]
Bases:
KeepaliveResponseError
The specified policy ID was not valid.
- class bosdyn.client.keepalive.Policy(proto: None | Policy = None)[source]
Bases:
object
Helper class for API Policy.
- property name: str
Get or set the name of the Policy
- add_associated_lease(lease: bosdyn.client.lease.Lease | lease_pb2.Lease)[source]
- add_controlled_motors_off_action(after: float)[source]
Add a ‘controlled motors off’ action that triggers after specified time (seconds).
- add_immediate_robot_off_action(after: float)[source]
Add an ‘immediate robot off’ action that triggers after specified time (seconds).
- add_record_event_action(events: List[bosdyn.api.Event], after: float)[source]
Add a ‘record event’ action that triggers after specified time (seconds).
- add_auto_return_action(leases: List[bosdyn.client.lease.Lease], params: bosdyn.api.auto_return.Params, after: float)[source]
Add an ‘auto return’ action that triggers after specified time (seconds).
- class bosdyn.client.keepalive.KeepaliveClient[source]
Bases:
BaseClient
A client for the Keepalive service.
This client is in BETA and may undergo changes in future releases.
- default_service_name = 'keepalive'
- service_type = 'bosdyn.api.keepalive.KeepaliveService'
- modify_policy(to_add: Policy | Policy | None = None, policy_ids_to_remove: List[int] | None = None, **kwargs)[source]
Add given policy and remove policies with given ids.
- modify_policy_async(to_add: Policy | Policy | None = None, policy_ids_to_remove: List[int] | None = None, **kwargs)[source]
Async version of the modify_policy() RPC.
- class bosdyn.client.keepalive.PolicyKeepalive(client: KeepaliveClient, policy: Policy, rpc_timeout_seconds: float | None = None, rpc_interval_seconds: float | None = None, logger: Logger | None = None, remove_policy_on_exit: bool = False)[source]
Bases:
object
Specify a keepalive Policy that should be held to.
Meant to be used as a context manager. For example:
client = robot.ensure_client(KeepaliveClient.default_service_name) pol = Policy() # After 30 seconds of not hearing from this process, turn the robot motors off. pol.add_controlled_motors_off_action(30) with PolicyKeepalive(client, pol, rpc_interval_seconds=3) as policy_keepalive:
# A thread will attempt a CheckIn every 3 seconds. run_my_code()