Muscat app — Automatically finds our robots on the same network so you can connect and control them right away. PC · Mac · MobileGet the app
Muscat PK
Log in
Development

Backend — handling UI requests

py/main.py
from rainbow.rb_sdk import RBPluginCall

plugin = RBPluginCall()

@plugin.serve("grip")     # ← rb.action("grip")
def grip(payload=None):
    width = (payload or {}).get("width", 20)
    plugin.publish("state",             # → rb.sub
                   {"last_grip_width": width})
    return {"ok": True, "width": width}

@plugin.subscribe("event") # ← rb.pub("event")
def on_ui_event(payload=None):
    print("event:", payload)