Configure object alerts
Object alerts fire when an object matching a filter appears (FOUND) or is lost (LOST).
Before you begin
You need an authenticated channel — see Authenticate.
SetObjectAlerts replaces the whole setThe call is not additive. Send the full set of alerts you want active each time; an empty set disables all alerts. Alert ids must be unique.
object_alerts.py
from greenroom.perception.v1 import (
perception_service_pb2,
perception_service_pb2_grpc,
alert_pb2,
filter_pb2,
classification_pb2,
)
client = perception_service_pb2_grpc.PerceptionServiceStub(channel)
whale_alert = alert_pb2.ObjectAlert(
id="whales",
name="Whale detected",
enabled=True,
type=alert_pb2.OBJECT_ALERT_TYPE_FOUND,
level=alert_pb2.OBJECT_ALERT_LEVEL_WARNING,
filter=filter_pb2.ObjectsFilter(
category_types=[classification_pb2.OBJECT_CATEGORY_ANIMAL],
classification_probability=0.6,
),
duration=2.0,
)
client.SetObjectAlerts(
perception_service_pb2.SetObjectAlertsRequest(
vessel_id="vessel_1", alerts=[whale_alert]
)
)
Use StreamObjectAlerts to observe the active configuration (for example, to reflect it in a UI).
What's next
- Stream tracks — the live track set the filters run against.
- Error handling — status codes and failures.