|
import numpy as np |
|
import pyarrow as pa |
|
from dora import DoraStatus |
|
from utils import ask_vlm, speak |
|
from time import sleep |
|
|
|
LIVING_ROOM = np.array([[1.0, 0.0]]).ravel() |
|
KITCHEN = np.array([[0.0, -0.2], [-1.0, -0.3], [-2.0, -0.5]]).ravel() |
|
|
|
|
|
|
|
class Operator: |
|
def speak(self, text: str): |
|
speak(text) |
|
|
|
def ask_model(self, image, text: str) -> bool: |
|
text = ask_vlm(image, text) |
|
return "Yes, " in text |
|
|
|
def on_event(self, event: dict, send_output) -> DoraStatus: |
|
if event["type"] == "INPUT": |
|
id = event["id"] |
|
if id == "init": |
|
send_output("go_to", pa.array([])) |
|
elif id == "reached_living_room": |
|
image = event["value"].to_numpy().reshape((540, 960, 3)) |
|
pass |
|
elif id == "reached_kitchen": |
|
image = event["value"].to_numpy().reshape((540, 960, 3)) |
|
pass |
|
return DoraStatus.CONTINUE |
|
|