Hey all… I was at the Minnebar coding workshop, and thought I’d offer some thoughts:
My first attempt to work with Misty was with
console.logwasn’t available (of course we learned about
misty.Debug(), but it seems unnecessary)
setIntervalaren’t available. Both myself and the person working next to me immediately wanted to use these functions, as it’s the natural way to do something that appears “autonomous”
- Someone did show us the Timer functions, but we never got them to work. This might be a limitation of
code.mistyskills.com, which doesn’t allow for JSON metadata.
- The way callbacks work is unusual. From the docs, nothing like a normal callback is in the API, only named callbacks.
I would recommend:
console.logyourselves, it’s not a protected function, and you can implement it in terms of
catchcan go a long ways.
- Use Promises for one-off asynchronous code (like
- Use an
removeListenerstyle API for pubsub-like APIs.
I would strongly recommend preferring the WebSocket client over the REST client, though currently it appears the REST client is more complete. There is a kind of simplicity to REST, sure, but a robot needs to be able to initiate events, and that can’t happen over simple HTTP. WebSockets are pretty easy to use, and with them you have a nice live message-based channel between the remote code and the robot. The only big downside I see is that it’s a lot harder to work with WebSockets from Python. Using WebSockets you can have a very similar API across remote and local development, and you can start to talk about the programming API for the robot instead of the over-the-wire API.
I think you have something that’s close, the protocols seem to expose what they need to, it just needs some hacking to make it happen.