cppp-io icon indicating copy to clipboard operation
cppp-io copied to clipboard

Robot events

Open lorenwest opened this issue 10 years ago • 9 comments

In my interactions with a robot, I am able to issue it commands directly. I am also able to command it's "ears and eyes" via it's devices, and I can listen to ears and eyes for events.

A robot is a valuable abstraction of connections and devices that make an independent identity, and this abstraction could offer valuable events as that identity.

Would you be willing to entertain a pull request which adds events to the robot (a peer to commands) and adds a POST to /api/:robot/events/:event ?

lorenwest avatar Dec 09 '14 14:12 lorenwest

Hi, @lorenwest adding events to robots sounds like a great idea.

Could you please clarify what you would want to do with the POST to events?

deadprogram avatar Dec 10 '14 03:12 deadprogram

Oops - I meant GET vs. POST. My intention is to follow the same patterns for discovering events as well as listening for events.

lorenwest avatar Dec 10 '14 03:12 lorenwest

OK, now I get it. So back to your original question: yes please, we'd love a PR for that.

Thanks!

deadprogram avatar Dec 10 '14 03:12 deadprogram

Will do - thanks.

lorenwest avatar Dec 10 '14 03:12 lorenwest

While doing this work I noticed a couple things:

  • Discoverability: There's a GET for command discovery at various levels /api/robots/:robot/devices/:device/commands, but no GET for event discovery /api/robots/:robot/devices/:device/events. Implementations may find it easy to auto-discover commands, but events aren't as easily discoverable, so implementations would be required to list the events they wish to be discoverable.
  • MCP Events: Like robots, the MCP also has commands and no events. I can see helpful events such as robotStarted, robotStopped, apiStarted, etc.

Would you like me to add these to the pull request, or should I leave them alone - for another day?

-Loren

lorenwest avatar Dec 10 '14 05:12 lorenwest

These are all things we've at least partly implemented in Gobot. Seems like a great thing.

deadprogram avatar Dec 10 '14 22:12 deadprogram

Ok, I'll include in the pull request.

lorenwest avatar Dec 11 '14 00:12 lorenwest

Submitted in pull request #3

lorenwest avatar Dec 11 '14 16:12 lorenwest

Ping: Were you wanting to implement before merging? Just checking in.

lorenwest avatar Dec 20 '14 22:12 lorenwest