So, in trying to figure out how I would get the main program (written in c++) to communicate with the web, I stumbled across the following: http://www.html5rocks.com/en/tutorials/websockets/basics/
Looks like there are many options, and libwebsockets might allow us to keep everything inside a single c++ program.
Comments (13)
-
reporter -
reporter Another option might be to make the c++ part of the code a Node.js addon: http://nodejs.org/api/addons.html
-
reporter The OpenROV and the WolfTracker 2014 accomplish the same end goal. Not sure if I want to follow in their footsteps though (I know this can be done without an Arduino, not sure about Node.js and socket.io).
-
reporter -
It is completely possible to perform all tasks from the BBB without the use of an Arduino as I have seen demonstrated from several projects using either C++ or Node.js. Many of these project include Arduino since it is the standard for robots and the massive amount of sample code and support base that the Arduino community has.
There is one very successful Node.js library for robotics Johnny-Five. The basis of this library is to write your code in node on the host computer and then control motors and sensors through a highjacked Arduino via Firmata Protocol. This does not seem to be what you are wanting, to also have an Arduino in the mix.
One project has taken this one step further, beaglebone-io demonstrates how we could write a client and server app in Node.js that will use socket.io to communicate between the client and server and then using Johnny-Five to perform all of the robot control on the BeagleBone Black.
-
reporter Thanks for the post on Johnny-Five. I keep coming back to c++ for two reasons.
- Performance
- It plays nice with OpenCV
If we use something besides c++ to talk to the web page, we're going to have to figure out a way to pass numbers between the two languages. I haven't seen a good way to pass info between Node.js and c++ yet. Any ideas?
-
reporter Sadly, this might all be a moot point without a solid way to connect to the Beaglebone wirelessly. See issue 6 for details.
As for which direction to take with respect to this issue, I have come to the realization that trying to integrate a c++ websocket into the main program violates the KISS principal. Even if we get it working, it looks like it's going to be complex, and consequently difficult to convey to students. Let's see what we can do with socket.io.
-
reporter -
reporter -
reporter A Node.js c++ addon might be the way to go: http://code.tutsplus.com/tutorials/writing-nodejs-addons--cms-21771
Of the various ways to pass info from c++ to a web page, I suspect using this approach with socket.io will have the most documentation and example code on the net.
-
reporter I got the hellow Wt example working: https://sites.google.com/site/mbbackus/robotics/robobeaglebot/wt
-
reporter I modified the Wt hello example to show frames generated by cv. Checkout the Wt branch.
-
reporter Orion suggested mongoose
- Log in to comment
Here's a link to an example that might get us started: http://ahoj.io/libwebsockets-simple-websocket-server