Coder Social home page Coder Social logo

trikset / trikruntime Goto Github PK

View Code? Open in Web Editor NEW
15.0 9.0 55.0 11.44 MB

Runtime for TRIK controller

License: Apache License 2.0

QMake 4.60% C++ 89.81% C 2.00% Shell 0.98% JavaScript 0.42% Tcl 1.71% Batchfile 0.01% Python 0.15% Qt Script 0.33%
qt5 trik-controller trik c-plus-plus firmware

trikruntime's Introduction

Runtime for TRIK controller.

Build Status Build status

Join the chat at https://gitter.im/trikset/trikRuntime codecov.io CoverityScan Mergify

===========

Pre-build step

git submodule update --init --recursive

Build

PythonQt should be built with corresponding version of Python in mind. One can install libpython3-dev from destribution package manager, or use pyenv, and there is a helper script for this.

  qmake -r
  make -j 4

Add translations

Details here

Out-of-source-tree build (split-build) is supported

=========== Consists of following subprojects:

  • trikControl: library for interacting with robot hardware, provides interface for hardware as Qt classes with signals and slots, that can be used from other Qt programs or Qt Script.
  • trikScriptRunner: library providing Qt Script interpreter that uses trikControl to enable interaction with hardware from scripts.
  • trikCommunicator: library that provides network interface to run programs on a robot.
  • trikRun: command-line utility to execute Qt Script files.
  • trikServer: command-line server for network communications, uses trikCommunicator library.
  • trikGui: user interface that can show various settings (like IP address), file system, run scripts, act as a server with trikCommunicator and so on.
  • trikHAL: library with hardware abstraction layer.
  • trikKernel: library with common code for all other projects.

Special thanks to:

trikruntime's People

Contributors

anastasiia-kornilova avatar anna- avatar annaak avatar ashatta avatar danilaml avatar dependabot-preview[bot] avatar dependabot[bot] avatar dinafunt avatar dmitry42nd avatar dours avatar dvvrd avatar fefaleksey avatar iakov avatar ikhonakhbeeva avatar ivantyulyandin avatar jzuken avatar khodand avatar kseniya-gonta avatar lahmatbiy avatar maktoff avatar mbryksin avatar mergify[bot] avatar romanbelkov avatar romankurbatov avatar sharganov avatar smirnov-mikhail avatar vkutuev avatar vrxfile avatar wowaster avatar yurii-litvinov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trikruntime's Issues

"SyntaxError: Parse error" при исполнении JS [Qt 5.5]

При выполнении сценария scripts/test-fifo.js trikRun выдаёт следующее:

bin/x86-release$ ./trikRun-x86 scripts/test-fifo.js 
"ERROR 2017-02-17T00:20:31.713 src/trik/trikMspI2c.cpp @ 115 Failed to open I2C device file  \"/dev/i2c-2\" "
"ERROR 2017-02-17T00:20:33.816 src/trik/trikEventFile.cpp @ 61 Cannot open event file \"/dev/input/by-path/platform-gpio-keys-event\" "
FIFO anywalker exists
stabv:        2        servov:  stabv:        3        servov:        3
"ERROR 2017-02-17T00:20:34.760 src/scriptThread.cpp @ 49 Uncaught exception at line 10 : \"SyntaxError: Parse error\" "
QThread::wait: Thread tried to wait on itself

Сам сценарий:
scripts/test-fifo.js:

var main = function()
{
 var __fifo=brick.fifo("anywalker");
 if(__fifo)
 {
  print("FIFO anywalker exists");
  while(true){
   if(__fifo.hasData()){
     var __data = __fifo.read();
    print(__data);
   }
  }
 }
};

Однако, если в trikScriptRunner/src/scriptEngineWorker.cpp закомментировать 111 строку, сценарий выполняется без ошибок.

Система:
ОС: Ubuntu Linux 16.04 LTS

$ uname -a
Linux DLPC 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

trikRuntime собран с использованием Qt 5.5

Модифицирован trikHal/trikHal.pro:

$ git diff
diff --git a/trikHal/trikHal.pro b/trikHal/trikHal.pro
index bdc0935..9bf0fbf 100644
--- a/trikHal/trikHal.pro
+++ b/trikHal/trikHal.pro
@@ -73,11 +73,11 @@ SOURCES += \
        $$PWD/src/stub/stubOutputDeviceFile.cpp \
        $$PWD/src/stub/stubFifo.cpp \
 
-equals(ARCHITECTURE, arm) {
+#equals(ARCHITECTURE, arm) {
        SOURCES += $$PWD/src/trik/hardwareAbstractionFactory.cpp
-} else {
-       SOURCES += $$PWD/src/stub/hardwareAbstractionFactory.cpp
-}
+#} else {
+#      SOURCES += $$PWD/src/stub/hardwareAbstractionFactory.cpp
+#}
 
 TEMPLATE = lib

К компьютеру подключена STM32F407G-DISC1 через адаптер UART-USB, которая посылает данные с периодичность 10 секунд.
Адаптер настроен на скорость 500 кбод, 8N1 RAW:

stty -F /dev/ttyUSB0 500000 raw

Пользователь добавлен в группу dialout.
system-config.xml:

<config version="model-2015" >
	<!-- Initialization sh script, will be executed when runtime is launched. -->
	<initScript/>

	<!-- A list of known devices. -->
	<deviceClasses>
		<fifo />
		<!-- Device files for LED on a brick. -->
		<led green="/dev/null" red="/dev/null" />

		<!--Device file for keys on a brick -->
		<keys deviceFile="/dev/input/by-path/platform-gpio-keys-event" />
	</deviceClasses>

	<devicePorts>
		<fifo port="anywalker" file="/dev/ttyUSB0" />
	</devicePorts>

	<deviceTypes>
	</deviceTypes>

	<!-- Format for playSound command, used to play .wav files. %1 designates file name to be played. -->
	<playWavFile command="/bin/true" />

	<!-- Format for playSound command, used to play .mp3 files. %1 designates file name to be played. -->
	<playMp3File command="/bin/true" />

	<!-- I2C device for communication with power motor drivers. Parameters are path to device file and device id. -->
	<i2c path="/dev/i2c-2" deviceId="0x48" />
</config>

model-config.xml:

<config>
	<!-- Initialization sh script, will be executed when runtime is launched, but after system initialization script. -->
	<initScript>
	</initScript>
	<anywalker>
		<fifo />
	</anywalker>
</config>

UI: reload network

When wi-fi client cann't be connected, the only way to reconnect -- is to switch to wifi access point or to reboot controller. It's better to design another way to reload interface.

Focus in Listbox

current behavior:
When app is starting, first line of listbox is marked, but isn't focused.
Affter using any keys listbox become highlighted(focused).

It should be highlighted(focused) on the list item every time when we get on te screen with listbox.

Missing tests for drawing primitives

Надо научиться сохранять скриншот и сверять его с образцом. При правильных настройках должно получиться просто сравнивать картинки по пикселям или даже как файлы.
Примеры ошибок, которые может отлавливать такой тест: #291 и #285
То есть в тесте надо нарисовать все примитивы и написать алфавиты. Если тест можно будет запускать как JS -- пусть скрипт рисует и вызывает какой-то printscreen (есть консольная fbgrab). Это не про тест контроллера, это про тестирование билда прошивки.

Add writing of 4 bytes to register

At the moment runtime supports writing of byte or word to the register of i2c device. For simultaneous stop of motors it is necessary to write 4-byte data to the register.

Status bar with icon of device statuses

Add single icon to status bar which shows summary state of sensors. It will be useful to detect some problems with gyroscope and other hardware. Then in "Testing" menu more detailed description of statuses will be shown.

Add command line parameter

"Config path" or "full path to config file" command line parameter needs to be supported.
Example,
if we run application "./trikGui -qws", it opens file config.xml in working directory.
if we run application "./trikGui -qws -c /home/root/ , it opens /home/root/config.xml .

brick.playTone() breaks brick.say()

Sound interruption and other strange behaviour is observed with the following code

brick.playTone(1000,500);
script.wait(1000);
brick.say("Hello");
script.wait(3000);

Сети из wpa-config.xml долго прописываются в wpa_supplicant.conf

Это, видимо, особенность wpa_supplicant, но наличие сетей в wpa-config подвешивает появление виджета "Сети" на пару секунд, что пугает. Даже если эти сети в wpa_supplicant.conf уже есть, то есть всегда, если в wpa-config.xml написано хоть что-то содержательное, а не только в первый раз.

Желательно проверять, есть ли сети из wpa-config.xml в нынешней конфигурации wpa_supplicant, и если есть (с теми же параметрами), то пропускать их. Если это будет работать быстрее. Не исключено, что опрос конфигурации wpa_supplicant тоже тормозит. Если да, надо сделать отдельную кнопку в GUI --- "добавить сети из wpa-config.xml".

Some letters are displaying incorrectly on TRIK Controller

Баг появляется только на роботе. При запуске trikGui под виндой все отображалось корректно.
Например при выполнении такого скрипта:

var __interpretation_started_timestamp__;
var pi = 3.1415926535897931;
var SYMBOL_WIDTH = 10;
var SYMBOL_HEIGHT = 20;
var SCREEN_WIDTH = 240;
var SCREEN_HEIGHT = 279;


var main = function()
{
	__interpretation_started_timestamp__ = Date.now();
	
	var map = {a: "a", b: "b", c: "c", d: "d", e: "e", f: "f", g: "g", h: "h", i: "i", j: "j", k: "k", l: "l",
		m: "m", n: "n", o: "o",	p: "p", q: "q", r: "r", s: "s", t: "t", u: "u", v: "v", w: "w", x: "x", y: "y", z: "z",
		K: "ackd", V: "opeva", W: "word", X: "poxl", Ke: "acdk", Ve: "opeav", We: "wordw", Xe: "pox"};
// все буквы алфавита
// слова с "проблемными" буквами в середине
// слова с "проблемными" буквами на конце

	while (true) {
		var checkStr = "kvwx";
		for (var i = 0; i < 4; i++) {
			brick.display().addLabel(checkStr.charAt(i), 1 + 2 * SYMBOL_WIDTH * i, 1);
			//brick.display().addLabel("k", 1 + , 1);
		}
		var numberOfLines = 1;
		var counter = 0;
		var wordStartX = 1 + (SCREEN_WIDTH / 4) * counter;
		for (var key in map) {
			wordStartX = 1 + (SCREEN_WIDTH / 4) * counter;
			brick.display().addLabel(key + ": " + map[key], wordStartX, SYMBOL_HEIGHT * numberOfLines);
			numberOfLines++;
			if (numberOfLines > (SCREEN_HEIGHT - SYMBOL_HEIGHT) / SYMBOL_HEIGHT) {
				counter++;
				numberOfLines = 1;
			}
		}
		brick.display().redraw();
		script.wait(200);
	}
	return;
}

Мы получим такую картинку на роботе:
image
При запуске из сборки на пк:
image

Current directory on execute

On external file execute current working directory must be set according to browser. Or even when browsing on every directory change current directory must be changed too.

Add French language option

Нужно только обносить переводы. Но может оказаться, что в прошивке нет нужной локали, тогда надо отдельнов meta-trik это делать.

Unable to build on Ubuntu 16.04

Hello,

I am unable to build trikRuntime on my Ubuntu 16.04 LTS (currently latest available version) due to

make[1]: Entering directory '/home/natasha/trikRuntime/trikControl'
g++ -c -include .build/x86-release/.obj/trikControl-x86 -m64 -pipe -std=c++1y -Wextra -Wcast-qual -Wwrite-strings -Wredundant-decls -Wunreachable-code -Wnon-virtual-dtor -Woverloaded-virtual -fno-omit-frame-pointer -O2 -Wall -W -D_REENTRANT -fPIC -DTRIKCONTROL_LIBRARY -DQT_NO_DEBUG -DQT_MULTIMEDIA_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtMultimedia -I/usr/include/qt4 -I. -Iinclude/trikControl -I../qslog -I../trikKernel/include -I../trikHal/include -I.build/x86-release/.moc -o .build/x86-release/.obj/brick.o src/brick.cpp
In file included from src/tonePlayer.h:17:0,
                 from src/brick.cpp:47:
src/audioSynthDevices.h:19:37: fatal error: QtMultimedia/QAudioFormat: No such file or directory
compilation terminated.
Makefile:729: recipe for target '.build/x86-release/.obj/brick.o' failed
make[1]: *** [.build/x86-release/.obj/brick.o] Error 1
make[1]: Leaving directory '/home/natasha/trikRuntime/trikControl'
Makefile:166: recipe for target 'sub-trikControl-make_default' failed
make: *** [sub-trikControl-make_default] Error 2

I tried adding package qtmultimedia5-dev which is obviously not the one I need (compilation uses qt4, right?). Some say that issue can be resolved by adding qtmobility-dev package, but it was removed for some reason

What should I do?

trikGui must create lock-file with pid

Для упрощения скриптования полезно иметь lock файл с текстовым pid внутри.
По всем правилам (в правильном месте, блокировать до конца работы на запись, не запускаться, если он уже есть, и т.д.).
Нужно для апгрейда и прочего скриптования.

Display graphics drawing problem

anigif
Shape-ы на одинаковой позиции, но разного цвета не перерисовываются.

anigif (1)
Текст пишется последним установленным цветом, следовательно нельзя создать label-ы разных цветов.

UI: delete file menu must be fixed

  1. Default action|focused button is Yes, but it is safer to have No.
  2. Focused button style should be improved, because it is no obvious what exact button has focus.

Script crashes after 10-20 minutes

var __interpretation_started_timestamp__;
var pi = 3.1415926535897931;

var main = function()
{
	__interpretation_started_timestamp__ = Date.now();
	
	while (true) {
		brick.display().clear();
		brick.display().redraw();
		
		brick.display().addLabel("Акселерометр:", 1, 1);
		brick.display().redraw();
		
		brick.display().addLabel(brick.accelerometer().read()[0], 1, 20);
		brick.display().redraw();
		
		brick.display().addLabel(brick.accelerometer().read()[1], 50, 20);
		brick.display().redraw();
		
		brick.display().addLabel(brick.accelerometer().read()[2], 100, 20);
		brick.display().redraw();
		
		brick.display().addLabel("Гироскоп:", 1, 40);
		brick.display().redraw();
		
		brick.display().addLabel(brick.gyroscope().read()[0], 1, 60);
		brick.display().redraw();
		
		brick.display().addLabel(brick.gyroscope().read()[1], 50, 60);
		brick.display().redraw();
		
		brick.display().addLabel(brick.gyroscope().read()[2], 100, 60);
		brick.display().redraw();
		
		brick.display().addLabel("Для выхода нажать ESC", 1, 100);
		brick.display().redraw();
		
		if (brick.keys().wasPressed(KeysEnum.Esc) != 0) {
			break;
		}
		script.wait(200);
		
	}
	return;
}

Add keepalive packet support for gamepad

keepalive <unsignedinteger-delay-millis> message.

  • Skip it, it is safe
  • after any message start keepalive wait timer for delay, if no message, disconnect (emit disconnected). For any late message initiate connection protocol and emit connected.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.