SoftwareArchitecture

__NOTITLE__

Architectural Overview
The main architecture for the OpenROV control software is that of the client-server model, where the ROV hosts the server and your computer is the client. The connection to the client is managed through WebSockets using Socket.io.

The two main technologies we’re using for the OpenROV control software Node.js and Arduino. Node.js is sort of like the “brain” of the ROV - it bridges the connection between the ROV and the user, and Arduino connect the “brain” to the physical word (motors and sensors).



Expanding on the image, the system is made by 4 components:
 * The Cockpit app, running inside the browser, developed in HTML5/JavaScript, interacts with keyboard or gamepad and shows values to the ROV operator.
 * The Cockpit server, running on the BeagleBone board, developed with Node.js, receives the commands from the client, and forwards them to the Arduino
 * The MJPEG streamer, running on the BeagleBone board, streams directly the images from the webcam to the browser.
 * The Arduino code, running on the ATMega chip that is on the OpenROV Cape, developed in C++ and Arduino, receives the command from the server, and interfaces with the actual physical world (motors, servo, sensors, etc...)

The Cockpit app
The cockpit app is build with standard technologies, HTML, JavaScript and CSS. This way it can run on any computer, even small netbooks, without the need for installing anything "strange" on the computer.

The ROV operator can control the ROV either via the keyboard or by using a standard gamepad, like the XBox 360 controller.

The cockpit, in addition to the live video feed from the ROV, show also the status of the battery, the time since the ROV has been turned on, and the current position of the camera and the current brightness of the front LEDs.

All the communications with the server, in both directions (direction commands sent from the client to the server and status updates sent from the server to the client), happen via string-formatted messages sent with JavaScript via socket.io

The Cockpit server
The cockpit server runs on the BeagleBone, an embedded linux board, and is built using Node.js, a server-side engine that can be programmed with JavaScript.

The server receives the string-formatted messages sent by the client and pass them to the Arduino via serial port communication. It also takes care of sending the status updates to the client and allows the operator to upload new code inside the arduino directly from the browser. Finally the server also stores all user preferences and in the future will also keep a log of all your explorations.

The MJPEG streamer
This is an external process, fired up by the server as soon as a client connects to it. It sends a MJPEG stream to the browser, the same format used by IP-Cameras. The software that takes care of the stream is the popular linux-based mjpg-streamer.

The Arduino
The part that is closer to the physical world is the "Arduino" installed on the OpenROV cape (actually not a real arduino, just the ATMega chip). At the moment it doesn't do a lot: just takes the commands sent by the cockpit server, and actuates motors, servos and leds. Periodically it also sends back the readings of the sensors and the run time of the board.