After the GUI has been designed as already exposed, it's time to make it really useful.
In the demo to the right, unlike the previous one, the values for the gauge are not updated by the client but all of them come from Aria G25 board through a web socket. The video is a real M-JPEG streamer one taken with a LifeCam HD-3000 web cam.
I know, you have to to trust on me that's true, but you can test the latest version of the software by yourself getting it on Google code repository and also check the differences with the previous versions.
First of all, I want to thank my friend Raffaello for all of his suggestions and support. Then Marcello Gesmundo for his Node.js installation tutorial on Aria G25, so prompt on replies.
The latest version of
the whole project
is available as an open source at
Some are dummy data (like temperature, GPS position, battery voltage, etc...) because the hardware has not yet been connected. The date-time values come from Aria G25 board Real Time Clock and not from GPS. The speed, orientation and artificial horizon gauge are updated with the values from joysticks. Through a bidirectional socket the joysticks position is sent from web client to node.js server, they are normalized and sent back to the presentation layer as a JSON packet at a 10Hz refresh rate. So the whole protocol is working fine, with just the adding of a loop-back function that simulates real values.
To achieve the goal we need at first an application framework on the server side.
Searching the Net for some examples on how to exchange data real time between client and server, I've found again a well known open source evangelist and co-founder of Arduino: Tom Igoe. His description of exactly what I need is clear and simple also for beginners: how to setup a node.js server to send data received via serial port to a web client through a web socket with the minimum latency. Because node.js is available for every platform I've installed it on my Mac to speed up the learning phase. The porting on Aria G25 is a piece of cake, just a matter of copying the source code on the right directories. After node.js is installed you need npm to install the modules express for using node as a web server, socket.io to manage web sockets and node-serialport to communicate via serial ports. JSON format facilitates even more the data exchange. That's all.
Another useful node module is forever. It solves the problem of node.js running on terminal better than the standard Unix sequence "nohup node app.js &". Using forever you can manage many different apps in background and it takes also care of possible node crash, restarting all the previously running apps.
Eventually nodejitsu blog for the forever, very useful, module for (guess who?) node.js.