The paper describes the design and implementation of the client part of robot telemetry based on the TRIK controller.
Keywords: TRIK, telemetry, client part, Linux, controller, sensors.
Currently, the field of robotics is actively developing. Robots are used in many industries, the number of robotics competitions increases every year, and relevant circles are opened at schools. At the same time, the number of cybernetic designers is growing.
One of them is TRIK. TRIK is a cybernetic construction set with ARM-based CPU and Linux-based operating system. The TRIK controller is a multifunctional device allowing to program robot models assembled on the basis of the TRIK cybernetic constructor. The controller allows to process information from digital and analog sensors and to transmit data via WiFi.
Actually, one of the most important tasks in working with robots is telemetry. Analysis and processing of readings of sensors from the robot is a very important process, and to make this process as successful as possible, it is necessary to provide the user with the appropriate program and equip it with the necessary functionality and a convenient user interface.
Obtaining information about the values of variable sensor data is widespread not only in robotics, but also in many other areas.
There are all kinds of clients for different telemetry systems:
– Google Analytics, a service provided by Google to create detailed statistics of website visitors;
– WEBTLM Remote Monitoring System — technological solution created on the basis of modern technologies and designed to monitor and control distributed objects via the Internet, allowing to solve the tasks of monitoring and management of distributed objects in real time.
It is possible to note simplicity of use, contrasting design, easy-to-read text, availability of different ways of data displaying. Most of such systems are web utilities, this article describes how to adopt the concepts and create a desktop application for telemetry.
Fig. 1. Prototype of the client part of TRIK telemetry
The Composite pattern was used to support the creation of your own dependent values (expressions) in the architecture of the client (Appendix 2) part. The classes that store the sensor readings are divided into two groups: elementaryDataSource (to store the sensor readings from the robot) and compositeDataSource (to store information about those sensors whose readings are used in the expression, and, actually, the result of the expression itself).
Fig. 2. The architecture of the client part
The objects of the compositeDataSource class use a system of signals and slots to subscribe to updates of sensor readings in the objects of the elementaryDataSource classes, that is, the value of the dependent quantity is updated when new data included in the expression arrives.
For direct processing of the expression we use the scripting language QtScript with javascript syntax.
QtScript is a module of the Qt library which is an environment that provides built-in scripting support for applications written in C++ using Qt. It consists of the C++ classes which, in fact, allow Qt programs to script, and the QtScript interpreter.
All possible QtScript computations are assigned to the QScriptEngine class. The variables are QScriptValue instances, each with a set of named editable properties. To set a evaluated expression, we use the QScriptEngine::evaluate method, which accepts a string (an expression) and returns the evaluated result.
Filters are implemented in a similar way. The only difference between them and expressions is that the user does not set them; he can only enable or disable filters that already exist in the client.
When deciding which file format to export the sensor readings, I chose csv — a text format for tabular data representation. It is very simple: each line of the file is a table line, the values of individual columns are separated by a separating symbol.
Also csv was chosen due to the fact that files of this format are opened by many spreadsheet editors (for example, by the same Excel). The user can enable or disable data export. When enabled, the appropriate signal is sent to the Export class object, which begins requesting this data from Parser class, then it processes and saves them into file.
The client also implements warning prototype of critical sensor readings. When the limit values entered by the user are reached, a window appears with a corresponding message, providing more detailed information about reaching the critical readings. Also all warnings are displayed on the same pop-up window, if it has not been closed.
Thus, the client part was created (Appendix 3), which in addition to the basic functionality has the ability to set and track its own dependent values (expressions), has implemented filters, data export, warning system.
Fig. 3. The client part
References:
- TRIK project home page, URL: http://www.trikset.com/
- Google Analytics project home page, URL: http://analytics.blogspot.ru/
- WEBTLM project home page, URL: http://webtelemetry.ru/
- TrikRuntime runtime documentation, URL: https://github.com/trikset/trikRuntime/wiki
- Qt library, URL: http://qt.io
- Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, Design Patterns: Elements of Reusable ObjectOriented Software, 416 pp., Addison Wesley, 1994
- Max Schlee, «Qt 4.8. Professional C++ Programming», 2012.
- QtScript documentation, URL: http://doc.qt.io/qt5/qtscriptindex.html