Difference between revisions of "ViRHaS"

From AIRWiki
Jump to: navigation, search
(Development)
Line 52: Line 52:
 
== Development ==
 
== Development ==
  
The first part of the project I developed was User Application: written in C++, using Qt libraries, this application is multiplatform, reliable and user-friendly: Qt compiler can generate executable file from the source code for almost every device: here is a list of compatible and tested OS:
+
The first part of the project I developed was User Application: written in C++, using Qt libraries, this application is multiplatform, reliable and user-friendly: Qt compiler can generate executable file from the source code for almost every device.
  
[[File:Virhas app home.png]]
+
Meanwhile, I developed "controller", which is the software running on Raspberry Pi: this is a simple command line interface which handles both communication and video capture.
 
+
- Linux (any distribution): perfectly working
+
 
+
- MacOS: perfectly working, since this is a Unix OS
+
 
+
- Android: perfectly working
+
 
+
- iOS: theoretically, software should work, but, since this is a closed OS i could not test it
+
 
+
- Windows: unfortunally this OS has two known issues, both caused by Windows itself: the first is the incompability of the library QtGamepad with this OS, the second is a bug concerning window update immediately after stopping OpenGL.
+
 
+
Settings page may be used to edit almost every parameter, both of the view and the control; favourite settings may be stored and automatically loaded when application starts.
+
[[File:Virhas application settings.png]]
+
 
+
Then, I developed "controller", which is the software running on Raspberry Pi: this is a simple command line interface which handles both communication and video capture.
+
 
this software works in any device with a camera and v4l2 libraries installed. Also this software is written in C++, using Qt libraries.
 
this software works in any device with a camera and v4l2 libraries installed. Also this software is written in C++, using Qt libraries.
  
 
Then, I developed the physical robot, the hardware component of the project, which is composed by 3 motors, 3 omni-wheels, 2 drivers, 1 Arduino Mega, 2 Raspberry Pi 3.0, 2 Raspberry Pi Cameras (v2.1), 1 router, 1 LiPo 12V battery, 1 LiPo 5V powerbank and all necessary wires.
 
Then, I developed the physical robot, the hardware component of the project, which is composed by 3 motors, 3 omni-wheels, 2 drivers, 1 Arduino Mega, 2 Raspberry Pi 3.0, 2 Raspberry Pi Cameras (v2.1), 1 router, 1 LiPo 12V battery, 1 LiPo 5V powerbank and all necessary wires.
  
In the end, I wrote the code for Arduino: I developed library MR001004.h to interface drivers(C++), adapted library Triskar.h, to maintain compability with drivers(C++) and then I wrote the arduino code for serial communication, data parsing and ViRHaS movement.
+
In the end, I wrote the code for Arduino: I developed library MR001004.h to interface drivers(C++), I adapted library Triskar.h, to maintain compability with drivers(C++) and then I wrote the arduino code for serial communication, data parsing and ViRHaS movement.

Revision as of 22:09, 7 July 2017

ViRHaS
Image of the project ViRHaS
Short Description: Omnidirectional robot, drivable in virtual reality
Coordinator: AndreaBonarini (andrea.bonarini@polimi.it)
Tutor: AndreaBonarini (andrea.bonarini@polimi.it)
Collaborator:
Students: MicheleBertoni (michele2.bertoni@mail.polimi.it)
Research Area: Robotics
Research Topic: Robot development
Start: 2016/10/20
End: 2016/07/07
Status: Completedwarning.png"Completed" is not in the list of possible values (Active, Closed) for this property.
Level: Bs
Type: Course

ViRHaS is a ominidirectional robot, based on Triskar model, equipped with two Raspberry Pi Cameras. These cameras can be used either to watch video streaming from multiple devices, either to control robot in 3D mode: this mode is available both for smartphone (inside a VRBOX) and for PC plugged to a 3D-ready screen.

Source code: https://github.com/michele-bertoni/ViRHaS

Requirements

ViRHaS is structured into 3 parts:

- Raspberry Pis are the hub of the entire robot: they handle both video and control streaming: one raspberry, the one with local address 192.168.1.3 is the master, while the other (192.168.1.4) is a slave device and only handles video transmission;

-Arduino Mega is used to control the motors: it's a slave device, controlled by master Raspberry Pi: Raspberry sends over USB serial to the Arduino a byte vector, which contains all speed components; then Arduino computes PID and control motors over PWM;

- User device: it may be any modern electronical device, for example laptop, smartphone, desktop computer, etc... ; the device receives video streaming and sends controls.

Components

All software components may be divided into four parts:

- Video capture: performed only by Raspberry Pis, uses v4l2 libraries to get MJPG streaming from cameras; all data is stored in ByteArrays;

- Communication: performed by all the parts of the robot, in particular using WebSockets from Raspberries to user device (and viceversa) and via Usb Serial communication from Raspberry to Arduino Mega;

- Video visualization: obviously, only user device can display video streaming: once received a new ByteArray containing a frame, the device loads the JPG image and displays it in the right position of the screen (user might change settings) using OpenGL and hardware acceleration of the GPU, if present;

- Control handling: each device, except the slave Pi, handle control:

   - user device is directly connected to the controller, which can be any kind supported by user device; the gamepad is handled transparently from the user device, which combines a key to 
     a default command (for example throttle, direction, etc...); this association may be changed by the user; 
   - Master Raspberry receives default commands, and from these calculates strafe, forward and angular components of the speed vector, then simplifies each component to a single byte for  
     a simplier parsing by the Arduino;
   - Arduino receives a 4 bytes string, composed by the 3 values and the string terminator 'n'; after parsing, it computes inverse kinematics and estimates each wheel speed; finally, target 
     speed enters the PID loop and the real speed is sent to each wheel via PWM.


Development

The first part of the project I developed was User Application: written in C++, using Qt libraries, this application is multiplatform, reliable and user-friendly: Qt compiler can generate executable file from the source code for almost every device.

Meanwhile, I developed "controller", which is the software running on Raspberry Pi: this is a simple command line interface which handles both communication and video capture. this software works in any device with a camera and v4l2 libraries installed. Also this software is written in C++, using Qt libraries.

Then, I developed the physical robot, the hardware component of the project, which is composed by 3 motors, 3 omni-wheels, 2 drivers, 1 Arduino Mega, 2 Raspberry Pi 3.0, 2 Raspberry Pi Cameras (v2.1), 1 router, 1 LiPo 12V battery, 1 LiPo 5V powerbank and all necessary wires.

In the end, I wrote the code for Arduino: I developed library MR001004.h to interface drivers(C++), I adapted library Triskar.h, to maintain compability with drivers(C++) and then I wrote the arduino code for serial communication, data parsing and ViRHaS movement.