|
- """Module for implementing robot control policies.
-
- This module provides functionality for implementing and managing robot control policies,
- including action selection and state management.
- """
-
- from dora import DoraStatus
-
-
- class Operator:
- """A class for implementing robot control policies.
-
- This class handles the selection and execution of robot actions based on
- input events and current state.
- """
-
- def __init__(self):
- """Initialize the operator with available actions."""
- self.actions = ["get_food", "get_hat"]
-
- def on_event(self, event: dict, send_output) -> DoraStatus:
- """Handle incoming events and generate appropriate actions.
-
- Args:
- event: Dictionary containing event information
- send_output: Function to send output to the dataflow
-
- Returns:
- DoraStatus: Status indicating whether to continue processing
-
- """
- if event["type"] == "INPUT":
- id = event["id"]
- # On initialization
- if id == "speech":
- text: str = event["value"][0].as_py().lower()
- # send_output("action", pa.array([""]))
-
- return DoraStatus.CONTINUE
|