Quote:
Originally Posted by mikegrundvig
For my own understanding then would you run a web server on the computer and make HTTP calls from the cRIO? And if so, what is the code on the cRIO to do that? I see minimal WPI documentation on socket and nothing on HTTP. Even a link to the right documentation would be enough to get me started. Thanks!
-Mike
|
Java Doc:
http://k.thekks.net/frcdoc/javax/mic...onnection.html
Yeah, you're right. I initially planned to use a purely standard compliant restful server. However, I think I might just go with
flask as it will be super easy to program for and I already have a LOT of experience with it.
On top of flask, I'll probably have code to pull off the camera image from its HTTP stream, and use OpenCV to process them. Those results returned by the processor will be added to a queue (by POSTing to the flask server), which then the cRIO could pull off from a GET request to a specific address. Since flask's dev server is not the ideal choice for high traffic concurrent application (not exactly it, but it'll be more than 20 req per second.. for sure), I'll probably setup a gevent wsgi server to wrap that around the flask app, which I already have code for that I've written for other applications.
The only
non-problem I have with this is the overhead of message delivery.. but those are really nothing since everything is either local or over an ethernet cable.. transferring some simple JSON data, and gevent is fully equipped to handle those.
I feel like someone is going to call this setup too complicated.. but it's fool proof, there will be little to no errors in the server/client code as the only ones that has a chance of occurring is some sort of connection error (or a bug in the library.. but i doubt that).. which will occur with socket anyway.
If someone is going for the same approach, I'll be happy to share my client and server code.