sourcebots / robot-api

(Legacy) API to interface with robotd
http://docs.sourcebots.co.uk/api/
MIT License
4 stars 1 forks source link

Add support for generic arduino commands #55

Closed PeterJCLaw closed 6 years ago

PeterJCLaw commented 6 years ago

This adds a new direct_command method which takes in a command as a list of JSON-encodable entities and passes that to robotd. It expects to immediately get back a response message (as well as the usual status blob) which contains either valid data from the arduino or a description of the failure.

This includes a novel testing approach which:

This avoids real sockets and multiprocessing, both of which incur substantial overhead during tests along with the introduction of timeouts (which is just nasty).

This relies on https://github.com/sourcebots/robotd/pull/35.

PeterJCLaw commented 6 years ago

The test failure on the CI is due to https://github.com/sourcebots/robotd/pull/35 not being available in that test environment.

RealOrangeOne commented 6 years ago

I'm liking this use of fake sockets, hopefully these changes can be backported into the remainder of the tests (separate PR) to reduce the oddness they bring

PeterJCLaw commented 6 years ago

@RealOrangeOne indeed, I've some thoughts -> #57

kierdavis commented 6 years ago

After testing on a kit last night I'm confident this works as intended. I would be grateful if the conflicts could be resolved before I approve.

PeterJCLaw commented 6 years ago

@kierdavis conflicts resolved; please could you take another look?