Events

robot.events

Asynchronous event bus and event types.

Event = Any module-attribute

__all__ = ['AnimationFinished', 'BlinkRequested', 'DisplayUpdated', 'EmotionChanged', 'EmotionName', 'Event', 'FaceDetected', 'IdleTimeout', 'InMemoryEventBus', 'LookRequested', 'PersonalityChanged', 'RobotError', 'RobotStarted', 'RobotStopped', 'ServoMoved', 'SpeechRecognized', 'StateChanged', 'WakeWordDetected'] module-attribute

AnimationFinished dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class AnimationFinished:
    name: str
    interrupted: bool = False

interrupted = False class-attribute instance-attribute

name instance-attribute

__init__(name, interrupted=False)

BlinkRequested dataclass

Either eye or both. left and right may be False for a wink.

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class BlinkRequested:
    """Either eye or both. ``left`` and ``right`` may be False for a wink."""

    left: bool = True
    right: bool = True
    speed: float = 1.0

left = True class-attribute instance-attribute

right = True class-attribute instance-attribute

speed = 1.0 class-attribute instance-attribute

__init__(left=True, right=True, speed=1.0)

DisplayUpdated dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class DisplayUpdated:
    display: str  # "left" or "right"

display instance-attribute

__init__(display)

EmotionChanged dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class EmotionChanged:
    previous: EmotionName
    current: EmotionName
    intensity: float = 1.0

current instance-attribute

intensity = 1.0 class-attribute instance-attribute

previous instance-attribute

__init__(previous, current, intensity=1.0)

EmotionName

Bases: str, Enum

High-level emotional states the face engine understands.

The minimum set requested by the project spec.

Source code in src/robot/events/events.py
class EmotionName(str, Enum):
    """High-level emotional states the face engine understands.

    The minimum set requested by the project spec.
    """

    NEUTRAL = "neutral"
    HAPPY = "happy"
    CURIOUS = "curious"
    THINKING = "thinking"
    SLEEPY = "sleepy"
    EMBARRASSED = "embarrassed"
    EXCITED = "excited"
    SAD = "sad"
    SURPRISED = "surprised"
    ANGRY = "angry"

ANGRY = 'angry' class-attribute instance-attribute

CURIOUS = 'curious' class-attribute instance-attribute

EMBARRASSED = 'embarrassed' class-attribute instance-attribute

EXCITED = 'excited' class-attribute instance-attribute

HAPPY = 'happy' class-attribute instance-attribute

NEUTRAL = 'neutral' class-attribute instance-attribute

SAD = 'sad' class-attribute instance-attribute

SLEEPY = 'sleepy' class-attribute instance-attribute

SURPRISED = 'surprised' class-attribute instance-attribute

THINKING = 'thinking' class-attribute instance-attribute

FaceDetected dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class FaceDetected:
    x: float  # normalized 0..1, face centre
    y: float
    confidence: float = 1.0
    size: float = 0.0  # normalized 0..1, approx face size as a fraction of frame height
    known: bool = False  # True when the face is recognised/remembered (see FaceRecognized)

confidence = 1.0 class-attribute instance-attribute

known = False class-attribute instance-attribute

size = 0.0 class-attribute instance-attribute

x instance-attribute

y instance-attribute

__init__(x, y, confidence=1.0, size=0.0, known=False)

IdleTimeout dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class IdleTimeout:
    seconds_idle: float

seconds_idle instance-attribute

__init__(seconds_idle)

InMemoryEventBus

An async pub/sub bus for in-process events with handler priority.

Critical handlers have their exceptions propagated; non-critical handlers have their exceptions logged and isolated.

Source code in src/robot/events/bus.py
class InMemoryEventBus:
    """An async pub/sub bus for in-process events with handler priority.

    Critical handlers have their exceptions propagated; non-critical
    handlers have their exceptions logged and isolated.
    """

    def __init__(self) -> None:
        self._subscribers: dict[type, list[_Subscription]] = defaultdict(list)
        self._lock = asyncio.Lock()
        self._sync_lock = threading.Lock()
        self._closed = False

    async def publish(self, event: object) -> None:
        """Publish an event to all subscribers."""
        if self._closed:
            return
        event_type = type(event)
        async with self._lock:
            subs = list(self._subscribers.get(event_type, []))
            if event_type is not object:
                subs.extend(self._subscribers.get(object, []))

        critical_subs = [s for s in subs if s.critical]
        non_critical_subs = [s for s in subs if not s.critical]

        critical_failures: list[HandlerFailedError] = []
        for sub in critical_subs:
            handler = sub.handler
            try:
                result = handler(event)
                if asyncio.iscoroutine(result):
                    await result
            except Exception as exc:
                hf = HandlerFailedError(
                    event_type=event_type.__name__,
                    handler=getattr(handler, "__qualname__", repr(handler)),
                    original=exc,
                )
                critical_failures.append(hf)
                _log.exception(
                    "events.critical_handler_failed",
                    event_type=event_type.__name__,
                    handler=hf.handler,
                )

        for sub in non_critical_subs:
            handler = sub.handler
            try:
                result = handler(event)
                if asyncio.iscoroutine(result):
                    await result
            except Exception:
                _log.exception(
                    "events.handler_failed",
                    event_type=event_type.__name__,
                    handler=getattr(handler, "__qualname__", repr(handler)),
                )

        if critical_failures:
            if len(critical_failures) > 1:
                _log.warning(
                    "events.suppressed_critical_failures",
                    count=len(critical_failures) - 1,
                )
            raise critical_failures[0]

    def subscribe(self, event_type: type, handler: EventHandler) -> None:
        """Subscribe a non-critical handler for events of ``event_type``."""
        sub = _Subscription(handler=handler, critical=False)
        with self._sync_lock:
            if sub in self._subscribers[event_type]:
                return
            self._subscribers[event_type].append(sub)
        _log.debug("events.subscribed", event_type=event_type.__name__, handler=handler.__name__)

    def subscribe_critical(self, event_type: type, handler: EventHandler) -> None:
        """Subscribe a critical handler for events of ``event_type``."""
        sub = _Subscription(handler=handler, critical=True)
        with self._sync_lock:
            self._subscribers[event_type].append(sub)
        _log.debug(
            "events.subscribed_critical",
            event_type=event_type.__name__,
            handler=handler.__name__,
        )

    def unsubscribe(self, event_type: type, handler: EventHandler) -> None:
        """Unsubscribe a previously-registered handler."""
        with self._sync_lock:
            self._subscribers[event_type] = [
                s for s in self._subscribers[event_type] if s.handler != handler
            ]

    async def close(self) -> None:
        self._closed = True
        self._subscribers.clear()

    def __repr__(self) -> str:
        total = sum(len(v) for v in self._subscribers.values())
        return f"InMemoryEventBus(subscribers={total}, closed={self._closed})"

__init__()

Source code in src/robot/events/bus.py
def __init__(self) -> None:
    self._subscribers: dict[type, list[_Subscription]] = defaultdict(list)
    self._lock = asyncio.Lock()
    self._sync_lock = threading.Lock()
    self._closed = False

__repr__()

Source code in src/robot/events/bus.py
def __repr__(self) -> str:
    total = sum(len(v) for v in self._subscribers.values())
    return f"InMemoryEventBus(subscribers={total}, closed={self._closed})"

close() async

Source code in src/robot/events/bus.py
async def close(self) -> None:
    self._closed = True
    self._subscribers.clear()

publish(event) async

Publish an event to all subscribers.

Source code in src/robot/events/bus.py
async def publish(self, event: object) -> None:
    """Publish an event to all subscribers."""
    if self._closed:
        return
    event_type = type(event)
    async with self._lock:
        subs = list(self._subscribers.get(event_type, []))
        if event_type is not object:
            subs.extend(self._subscribers.get(object, []))

    critical_subs = [s for s in subs if s.critical]
    non_critical_subs = [s for s in subs if not s.critical]

    critical_failures: list[HandlerFailedError] = []
    for sub in critical_subs:
        handler = sub.handler
        try:
            result = handler(event)
            if asyncio.iscoroutine(result):
                await result
        except Exception as exc:
            hf = HandlerFailedError(
                event_type=event_type.__name__,
                handler=getattr(handler, "__qualname__", repr(handler)),
                original=exc,
            )
            critical_failures.append(hf)
            _log.exception(
                "events.critical_handler_failed",
                event_type=event_type.__name__,
                handler=hf.handler,
            )

    for sub in non_critical_subs:
        handler = sub.handler
        try:
            result = handler(event)
            if asyncio.iscoroutine(result):
                await result
        except Exception:
            _log.exception(
                "events.handler_failed",
                event_type=event_type.__name__,
                handler=getattr(handler, "__qualname__", repr(handler)),
            )

    if critical_failures:
        if len(critical_failures) > 1:
            _log.warning(
                "events.suppressed_critical_failures",
                count=len(critical_failures) - 1,
            )
        raise critical_failures[0]

subscribe(event_type, handler)

Subscribe a non-critical handler for events of event_type.

Source code in src/robot/events/bus.py
def subscribe(self, event_type: type, handler: EventHandler) -> None:
    """Subscribe a non-critical handler for events of ``event_type``."""
    sub = _Subscription(handler=handler, critical=False)
    with self._sync_lock:
        if sub in self._subscribers[event_type]:
            return
        self._subscribers[event_type].append(sub)
    _log.debug("events.subscribed", event_type=event_type.__name__, handler=handler.__name__)

subscribe_critical(event_type, handler)

Subscribe a critical handler for events of event_type.

Source code in src/robot/events/bus.py
def subscribe_critical(self, event_type: type, handler: EventHandler) -> None:
    """Subscribe a critical handler for events of ``event_type``."""
    sub = _Subscription(handler=handler, critical=True)
    with self._sync_lock:
        self._subscribers[event_type].append(sub)
    _log.debug(
        "events.subscribed_critical",
        event_type=event_type.__name__,
        handler=handler.__name__,
    )

unsubscribe(event_type, handler)

Unsubscribe a previously-registered handler.

Source code in src/robot/events/bus.py
def unsubscribe(self, event_type: type, handler: EventHandler) -> None:
    """Unsubscribe a previously-registered handler."""
    with self._sync_lock:
        self._subscribers[event_type] = [
            s for s in self._subscribers[event_type] if s.handler != handler
        ]

LookRequested dataclass

Request a glance in a direction (normalized -1..1).

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class LookRequested:
    """Request a glance in a direction (normalized -1..1)."""

    x: float = 0.0
    y: float = 0.0
    duration_s: float = 0.3

duration_s = 0.3 class-attribute instance-attribute

x = 0.0 class-attribute instance-attribute

y = 0.0 class-attribute instance-attribute

__init__(x=0.0, y=0.0, duration_s=0.3)

PersonalityChanged dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class PersonalityChanged:
    trait: str
    value: float

trait instance-attribute

value instance-attribute

__init__(trait, value)

RobotError dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class RobotError:
    message: str
    component: str = "unknown"
    recoverable: bool = True

component = 'unknown' class-attribute instance-attribute

message instance-attribute

recoverable = True class-attribute instance-attribute

__init__(message, component='unknown', recoverable=True)

RobotStarted dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class RobotStarted:
    when: datetime = field(default_factory=lambda: datetime.now(tz=UTC))

when = field(default_factory=lambda: datetime.now(tz=UTC)) class-attribute instance-attribute

__init__(when=(lambda: datetime.now(tz=UTC))())

RobotStopped dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class RobotStopped:
    when: datetime = field(default_factory=lambda: datetime.now(tz=UTC))
    reason: str = "shutdown"

reason = 'shutdown' class-attribute instance-attribute

when = field(default_factory=lambda: datetime.now(tz=UTC)) class-attribute instance-attribute

__init__(when=(lambda: datetime.now(tz=UTC))(), reason='shutdown')

ServoMoved dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class ServoMoved:
    name: str
    angle: float

angle instance-attribute

name instance-attribute

__init__(name, angle)

SpeechRecognized dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class SpeechRecognized:
    text: str
    confidence: float = 1.0
    language: str = "en"

confidence = 1.0 class-attribute instance-attribute

language = 'en' class-attribute instance-attribute

text instance-attribute

__init__(text, confidence=1.0, language='en')

StateChanged dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class StateChanged:
    previous: RobotState
    current: RobotState

current instance-attribute

previous instance-attribute

__init__(previous, current)

WakeWordDetected dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class WakeWordDetected:
    phrase: str
    confidence: float = 1.0

confidence = 1.0 class-attribute instance-attribute

phrase instance-attribute

__init__(phrase, confidence=1.0)

Event payloads

robot.events.events

All event payload types.

Events are immutable dataclasses. New payload types must be added here so subscribers and publishers share a single source of truth.

Event = Any module-attribute

__all__ = ['AnimationFinished', 'BlinkRequested', 'BotReply', 'DisplayUpdated', 'EmotionChanged', 'EmotionName', 'Event', 'FaceDetected', 'GestureDetected', 'HumanFeedback', 'IdleTimeout', 'LLMTokenReceived', 'LookRequested', 'PersonalityChanged', 'RobotError', 'RobotStarted', 'RobotStopped', 'ServoMoved', 'SoundEffectPlayed', 'SpeechRecognized', 'StateChanged', 'WakeWordDetected'] module-attribute

AnimationFinished dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class AnimationFinished:
    name: str
    interrupted: bool = False

interrupted = False class-attribute instance-attribute

name instance-attribute

__init__(name, interrupted=False)

BlinkRequested dataclass

Either eye or both. left and right may be False for a wink.

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class BlinkRequested:
    """Either eye or both. ``left`` and ``right`` may be False for a wink."""

    left: bool = True
    right: bool = True
    speed: float = 1.0

left = True class-attribute instance-attribute

right = True class-attribute instance-attribute

speed = 1.0 class-attribute instance-attribute

__init__(left=True, right=True, speed=1.0)

BotReply dataclass

The full text reply the robot is speaking/returning.

Published after the LLM finishes generating a response (both streaming and one-shot paths). Subscribers can use this to display the reply as text (terminal, display, WebSocket clients) when TTS is unavailable.

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class BotReply:
    """The full text reply the robot is speaking/returning.

    Published after the LLM finishes generating a response (both
    streaming and one-shot paths). Subscribers can use this to display
    the reply as text (terminal, display, WebSocket clients) when TTS
    is unavailable.
    """

    text: str
    user_text: str = ""

text instance-attribute

user_text = '' class-attribute instance-attribute

__init__(text, user_text='')

DisplayUpdated dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class DisplayUpdated:
    display: str  # "left" or "right"

display instance-attribute

__init__(display)

EmotionChanged dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class EmotionChanged:
    previous: EmotionName
    current: EmotionName
    intensity: float = 1.0

current instance-attribute

intensity = 1.0 class-attribute instance-attribute

previous instance-attribute

__init__(previous, current, intensity=1.0)

EmotionName

Bases: str, Enum

High-level emotional states the face engine understands.

The minimum set requested by the project spec.

Source code in src/robot/events/events.py
class EmotionName(str, Enum):
    """High-level emotional states the face engine understands.

    The minimum set requested by the project spec.
    """

    NEUTRAL = "neutral"
    HAPPY = "happy"
    CURIOUS = "curious"
    THINKING = "thinking"
    SLEEPY = "sleepy"
    EMBARRASSED = "embarrassed"
    EXCITED = "excited"
    SAD = "sad"
    SURPRISED = "surprised"
    ANGRY = "angry"

ANGRY = 'angry' class-attribute instance-attribute

CURIOUS = 'curious' class-attribute instance-attribute

EMBARRASSED = 'embarrassed' class-attribute instance-attribute

EXCITED = 'excited' class-attribute instance-attribute

HAPPY = 'happy' class-attribute instance-attribute

NEUTRAL = 'neutral' class-attribute instance-attribute

SAD = 'sad' class-attribute instance-attribute

SLEEPY = 'sleepy' class-attribute instance-attribute

SURPRISED = 'surprised' class-attribute instance-attribute

THINKING = 'thinking' class-attribute instance-attribute

FaceDetected dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class FaceDetected:
    x: float  # normalized 0..1, face centre
    y: float
    confidence: float = 1.0
    size: float = 0.0  # normalized 0..1, approx face size as a fraction of frame height
    known: bool = False  # True when the face is recognised/remembered (see FaceRecognized)

confidence = 1.0 class-attribute instance-attribute

known = False class-attribute instance-attribute

size = 0.0 class-attribute instance-attribute

x instance-attribute

y instance-attribute

__init__(x, y, confidence=1.0, size=0.0, known=False)

GestureDetected dataclass

A human hand gesture was observed (e.g. a wave).

This is an observation, never an action. It updates the learning state encoder (gesture one-hot) but does not create a transition. Today the robot has no built-in vision gesture detector, so this event is produced by a synthetic injection channel (teaching API, CLI, constrained speech parser, or a test) rather than a CV model.

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class GestureDetected:
    """A human hand gesture was observed (e.g. a wave).

    This is an *observation*, never an action. It updates the learning
    state encoder (gesture one-hot) but does not create a transition.
    Today the robot has no built-in vision gesture detector, so this
    event is produced by a synthetic injection channel (teaching API,
    CLI, constrained speech parser, or a test) rather than a CV model.
    """

    gesture: str  # one of: none, wave, point, open_hand, other
    confidence: float = 1.0
    x: float = 0.5  # normalized 0..1 gesture centroid, when available
    y: float = 0.5

confidence = 1.0 class-attribute instance-attribute

gesture instance-attribute

x = 0.5 class-attribute instance-attribute

y = 0.5 class-attribute instance-attribute

__init__(gesture, confidence=1.0, x=0.5, y=0.5)

HumanFeedback dataclass

Explicit human feedback on a recent robot action.

A post-hoc signal: the human reacts to what the robot just did. It is an observation that the :class:~robot.learning.feedback_service.FeedbackService attributes to the most-recent eligible transition (by recency and, when available, interaction_id). It never creates a transition by itself and never invents a reward — the attribution target must already exist in the recorder's working memory, else the feedback is dropped with a log line.

Attributes

polarity: +1 for positive ("good"), -1 for negative ("no"/"wrong"). Other integers are tolerated but the reward path clamps magnitude. magnitude: Strength of the feedback, multiplied with polarity to form the reward delta. Default 1.0. source: Origin of the feedback ("speech", "api", "cli" …) so the dashboard can show how feedback was given. interaction_id: The teaching interaction the feedback belongs to, when known. Used to preferentially attribute feedback to a transition from the same interaction. None for ambient feedback. transition_id: The transition the feedback was attributed to. Filled in by the :class:~robot.learning.feedback_service.FeedbackService at attribution time; None until then. text: The raw human utterance that produced this feedback, for auditing.

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class HumanFeedback:
    """Explicit human feedback on a recent robot action.

    A *post-hoc* signal: the human reacts to what the robot just did. It is an
    observation that the :class:`~robot.learning.feedback_service.FeedbackService`
    attributes to the most-recent eligible transition (by recency and, when
    available, ``interaction_id``). It never creates a transition by itself and
    never invents a reward — the attribution target must already exist in the
    recorder's working memory, else the feedback is dropped with a log line.

    Attributes
    ----------
    polarity:
        ``+1`` for positive ("good"), ``-1`` for negative ("no"/"wrong").
        Other integers are tolerated but the reward path clamps magnitude.
    magnitude:
        Strength of the feedback, multiplied with ``polarity`` to form the
        reward delta. Default ``1.0``.
    source:
        Origin of the feedback (``"speech"``, ``"api"``, ``"cli"`` …) so the
        dashboard can show how feedback was given.
    interaction_id:
        The teaching interaction the feedback belongs to, when known. Used to
        preferentially attribute feedback to a transition from the same
        interaction. ``None`` for ambient feedback.
    transition_id:
        The transition the feedback was attributed to. Filled in by the
        :class:`~robot.learning.feedback_service.FeedbackService` at attribution
        time; ``None`` until then.
    text:
        The raw human utterance that produced this feedback, for auditing.
    """

    polarity: int
    magnitude: float = 1.0
    source: str = "speech"
    interaction_id: str | None = None
    transition_id: str | None = None
    text: str = ""

interaction_id = None class-attribute instance-attribute

magnitude = 1.0 class-attribute instance-attribute

polarity instance-attribute

source = 'speech' class-attribute instance-attribute

text = '' class-attribute instance-attribute

transition_id = None class-attribute instance-attribute

__init__(polarity, magnitude=1.0, source='speech', interaction_id=None, transition_id=None, text='')

IdleTimeout dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class IdleTimeout:
    seconds_idle: float

seconds_idle instance-attribute

__init__(seconds_idle)

LLMTokenReceived dataclass

A single token from a streaming LLM response.

Published for each token as the LLM generates its reply, enabling real-time face animation (thinking -> speaking).

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class LLMTokenReceived:
    """A single token from a streaming LLM response.

    Published for each token as the LLM generates its reply, enabling
    real-time face animation (thinking -> speaking).
    """

    token: str
    done: bool = False

done = False class-attribute instance-attribute

token instance-attribute

__init__(token, done=False)

LookRequested dataclass

Request a glance in a direction (normalized -1..1).

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class LookRequested:
    """Request a glance in a direction (normalized -1..1)."""

    x: float = 0.0
    y: float = 0.0
    duration_s: float = 0.3

duration_s = 0.3 class-attribute instance-attribute

x = 0.0 class-attribute instance-attribute

y = 0.0 class-attribute instance-attribute

__init__(x=0.0, y=0.0, duration_s=0.3)

PersonalityChanged dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class PersonalityChanged:
    trait: str
    value: float

trait instance-attribute

value instance-attribute

__init__(trait, value)

RobotError dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class RobotError:
    message: str
    component: str = "unknown"
    recoverable: bool = True

component = 'unknown' class-attribute instance-attribute

message instance-attribute

recoverable = True class-attribute instance-attribute

__init__(message, component='unknown', recoverable=True)

RobotStarted dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class RobotStarted:
    when: datetime = field(default_factory=lambda: datetime.now(tz=UTC))

when = field(default_factory=lambda: datetime.now(tz=UTC)) class-attribute instance-attribute

__init__(when=(lambda: datetime.now(tz=UTC))())

RobotState

Bases: str, Enum

Source code in src/robot/behavior/state_machine.py
class RobotState(str, Enum):
    BOOT = "boot"
    IDLE = "idle"
    CURIOUS = "curious"
    LISTENING = "listening"
    THINKING = "thinking"
    SPEAKING = "speaking"
    SLEEPING = "sleeping"
    ERROR = "error"

BOOT = 'boot' class-attribute instance-attribute

CURIOUS = 'curious' class-attribute instance-attribute

ERROR = 'error' class-attribute instance-attribute

IDLE = 'idle' class-attribute instance-attribute

LISTENING = 'listening' class-attribute instance-attribute

SLEEPING = 'sleeping' class-attribute instance-attribute

SPEAKING = 'speaking' class-attribute instance-attribute

THINKING = 'thinking' class-attribute instance-attribute

RobotStopped dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class RobotStopped:
    when: datetime = field(default_factory=lambda: datetime.now(tz=UTC))
    reason: str = "shutdown"

reason = 'shutdown' class-attribute instance-attribute

when = field(default_factory=lambda: datetime.now(tz=UTC)) class-attribute instance-attribute

__init__(when=(lambda: datetime.now(tz=UTC))(), reason='shutdown')

ServoMoved dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class ServoMoved:
    name: str
    angle: float

angle instance-attribute

name instance-attribute

__init__(name, angle)

SoundEffectPlayed dataclass

A sound effect was sent to the configured audio output.

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class SoundEffectPlayed:
    """A sound effect was sent to the configured audio output."""

    name: str
    filename: str

filename instance-attribute

name instance-attribute

__init__(name, filename)

SpeechRecognized dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class SpeechRecognized:
    text: str
    confidence: float = 1.0
    language: str = "en"

confidence = 1.0 class-attribute instance-attribute

language = 'en' class-attribute instance-attribute

text instance-attribute

__init__(text, confidence=1.0, language='en')

StateChanged dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class StateChanged:
    previous: RobotState
    current: RobotState

current instance-attribute

previous instance-attribute

__init__(previous, current)

WakeWordDetected dataclass

Source code in src/robot/events/events.py
@dataclass(slots=True, frozen=True)
class WakeWordDetected:
    phrase: str
    confidence: float = 1.0

confidence = 1.0 class-attribute instance-attribute

phrase instance-attribute

__init__(phrase, confidence=1.0)