File size: 857 Bytes
fe79d42
 
23f48d8
 
fe79d42
23f48d8
 
 
fe79d42
 
 
 
23f48d8
 
fe79d42
23f48d8
fe79d42
 
 
23f48d8
fe79d42
 
 
23f48d8
fe79d42
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import numpy as np
import pyarrow as pa
from dora import DoraStatus
from utils import ask_vlm, speak

COUCH = np.array([[0.5, 0], [0.5, 0.5]]).ravel()
KITCHEN = np.array([[0.5, 0.0], [1.0, -1.0]]).ravel()
HOME = np.array([[0.5, 0.0], [0.0, 0.0]]).ravel()


## Policy Operator
class Operator:
    def speak(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, dora_event: dict, send_output) -> DoraStatus:
        if dora_event["type"] == "INPUT":
            id = dora_event["id"]
            if id == "init":
                send_output("go_to", pa.array([]))
            elif id == "goal_reached":
                image = dora_event["value"].to_numpy().reshape((540, 960, 3))
                pass

        return DoraStatus.CONTINUE