Skip to main content

subscribe_fall_down_state

Signature:

BoosterRobot.subscribe_fall_down_state(
callback: Callable[[FallDownState], None],
*,
queue_size: int = 0,
overflow: OverflowPolicy = "drop_oldest",
) -> SensorSubscription

Description:

Subscribe to fall detection state updates. When data arrives, the callback function receives a FallDownState object.

Parameters:

Parameter

Type

Default

Description

callback

Callable[[FallDownState], None]

Required

Fall detection state callback function.

queue_size

int

0

Pending callback queue size; 0 means unlimited.

overflow

OverflowPolicy

"drop_oldest"

Overflow policy when queue is full, see "Tasks and Subscriptions / OverflowPolicy".

Returns:

SensorSubscription, see "Tasks and Subscriptions / SensorSubscription"

Raises:

None.

Example:

import time
from boosteros.robots.booster import BoosterRobot, FallDownState

robot = BoosterRobot()

def on_state(data: FallDownState) -> None:
print(data.state, data.recoverable)
# Example output: normal False

sub = robot.subscribe_fall_down_state(on_state)
try:
time.sleep(2.0)
finally:
sub.unsubscribe()