Server on /status
.
- layout (immediately after connect)
- robot
-
x
-
y
-
direction: north/east/south/west
-
drinks: number
-
action: rotate/move/sleep
-
value: -90/90/180 (for rotate) distance (for move)
-
- delivered
- x
- y
- count
- done
Whenever the robot is doing nothing it will send an HTTP request to the server /command
.
That will returns JSON such as:
- {"command": "rotate", "value: -90/90/180, "audio": "file1.mp3"}
- {"command": "move"} // til the next point
- {"command": "sleep", "value": timeInSeconds}
When the robot detects an obstacle within 20cm, it stops and retrieves new instructions using /command?obstruction=true
.
let plan = alg.schedule(layout, orders)
plan = [
- {"command": "move", "direction": "north"},
- {"command": "deliver", "count": numberOfDrinks}
- {"command": "move", "direction": "south"},
- {"command": "pickUp", "count": numberOfDrinks} ]