icub-tech-iit / ventilator-FI5

FI5: Rapidly Manufactured Ventilator System
BSD 3-Clause "New" or "Revised" License
31 stars 4 forks source link

Discussion about what use for the GUI of the ventilator #36

Closed Nicogene closed 4 years ago

Nicogene commented 4 years ago

The purpose of this issue is to examine the available tools for programming GUIs on micro.

@marcoaccame managed to draw some simple shapes using the native gui library (see https://github.com/icub-tech-iit/ventilator/issues/3#issuecomment-605447816) , please correct me if I am wrong.

For now the alternatives are the Qt library, that it supports also the deployment on microcontroller(see https://www.qt.io/qt-for-mcus), and the Embedded Wizard library.

I'd use these criteria:

Nicogene commented 4 years ago

As expected, qt mcu is part of the commercial qt. For now I have installed a 10-days trial, but in case it show as valuable tool we might ask some licenses, I think that under these circumstances they can give us for free.

cc @maggia80 @pattacini @vtikha @marcoaccame

marcoaccame commented 4 years ago

there is also: https://www.embedded-wizard.de/ i dont know it, but our reference for arm compilers, and very good developers as well, have suggested it.

La libreria grafica di cui le ho parlato, (a mio giudizio) la migliore sul mercato nonche' la piu' completa, e' la Embedded Wizard di Tara. https://www.embedded-wizard.de/

It comes free of use w/ a watermark. the distributor is however very keen to help.

but first let's see if it any good.

Nicogene commented 4 years ago

Qt for Microcontrollers

License

Qt is for free for research purpose, but it has some components available only under the commercial license. I've installed a 10-days trial, but I think that we could try to contact them through this link and given the nature of our project they might give us some free licenses(cc @maggia80).

Deployabiliy on our board

I am quite optimistic that our board is supported, since their examples on the stm32 board are

    STM32F769i-DISCO
    STM32F7508-DK

(cc @marcoaccame @MrAndrea)

Installing the 10days trial I have also some precompiled binaries of the examples, I can upload them in the code branch, in this way who has the board(@marcoaccame) can try to deploy it on our board.

Performances

This is just a preliminary analysis since I don't have the board, and I cannot test it, but following what they say, this framework it is lightweight, and it works also on bare-metal, i.e. in absence of a OS.

Btw it supports RTOS.

:warning: This section will be updated.

Is it easy to use?

After watching this webinar, specific for deployment on stm32 boards, I'd say yes.

All the development is done through qt-creator and simply you have to specify different target toolchains once compiling. It is supported the debugger through gdb. In the webinar the gui is done with qml, that is a qt scripting language, that is a sort of json with some javascript logic. I am not sure that also not-qml based guis are supported(I'd say yes). The workflows seems to be the same of the standard gui programming with qt, with the signals and slots logic.

They provide a framework just for front-end, all the back-end logic, the communication with the hardware has to be done using the vendor APIs(stm32 for example).

Conclusion

:warning: It is a preliminary analysis.

It seems pretty easy to use, and pretty fast to give it a try in order to see if it fits our need

cc @pattacini @vtikha

vtikha commented 4 years ago

@Nicogene great! let's organise and work on this together.

marcoaccame commented 4 years ago

i like this approach. let's investigate it.

marcoaccame commented 4 years ago

just to summarize a brief chat we have justa had w/ @Nicogene:

marcoaccame commented 4 years ago

just talked w/ mr marx from qt and explained to him our interest in their technology and the limit of the 10-days evaluation period in our agile working method.

he said that for the building of the prototype they can help us to extend the period. also, an italian representative fro northen italy will call me to explain details of how to collaborate in teh short term (i read: building the prototype) and in the long term (i read: how much we should pay for license fees when the product becomes commercial).

Antoine Marx
Customer Success Executive
+33 7 89 37 91 51
marcoaccame commented 4 years ago

Qt MCU solution

Hi, just some more info on the Qt MCU solution.

In short

Qt MCU is a GUI centric solution which produces an executable where the GUI engine is run in bare metal mode and there are hooks to actions towards the HW. They are working on a solution which integrates Free RTOS but the main program will be driven by the GUI in the same way as now.

I am looking forward to talk w/ a person from Qt to verify this understanding of mine.

After I carefully watched the webinar

I followed the webinar and I paid attention on how to interface the GUI to the MPU platform, then I listened carefully the Q&A at the end. Here is what I understood.

image-20200414163932428

from the video:

I did not see any use of the GUI inserted into a main() program which init HW, starts control loop, init the GUI, ticks the GUI with the rate and scheduling policy the user chooses. So I listen carefully the Q&A, turned the subtitles on and:

marcoaccame commented 4 years ago

Update on Qt MCU

I have talked to a Senior Account Manager for Italy. They can surely give us an evaluation licence longer than 10 days. He however says that the Qt MCU is a paying product. The costs are some thousands (i recall 5000 EURO) per year per developer plus there is a royalty fee per device. They start numbers > 30K. He didn't say how much.

I also had a contact w/ a Pre-Sales Engineer for technical aspects. It comes out that the development on Qt MCU is Qt-centric. You cannot call the GUI library from your application but you must do the other way round: you develop the GUI and then from it you can call some functions which customise and run your application.

Questions to Qt

  1. Is the support for the board 32f746-discovery ready to use?
  2. Is it possible to use the Qt GUI as a library to be statically linked to a custom main.cpp or the application must be Qt-centric as I have seen on webinar https://www.youtube.com/watch?v=lVCbQZIfCIk&feature=youtu.be?
  3. If the above is possible, which are the API which makes it possible? I would think of an init() done at startup and of a tick() called inside a thread in a periodic manner (or with similar scheduling policy).
  4. I have seen that Qt MCU uses arm gcc. We would like to link the library using armclang. Do you think is it possible?

Answers from Qt I got response for your questions from our MCU product team and a question for ‘ticks’ refresh implementation:

  1. We don't support the stm32f746-disco out of the box. We can either port it as a service, or you can do the port yourself from the source code we provide in the commercial version. Doing the port based on our existing STM32F7 references (STM32F769i and STM32F7508) should be fairly straightforward.
  2. LEFT EMPTY BY QT
  3. Starting from Qt for MCUs 1.1, it is possible to define your own C++ entry point and manually start the Qt event loop. See https://doc-snapshots.qt.io/qtformcus-dev/qtul-define-custom-entry-point.html. There isn't at this point an API to manually control the update 'ticks' though. Screen updates are synced with the display refresh rate. Would an API to manually define the update rate be acceptable?
  4. It is definitely possible and as a matter of fact we are planning to support it in future versions. It is also possible to enable it yourself in the meantime by defining a CMake toolchain file (https://cmake.org/cmake/help/v3.6/manual/cmake-toolchains.7.html) using our ARM GCC toolchain file as reference. FYI, we plan to support IAR compiler as well in the future.

Conclusions

It is better explore alternatives

marcoaccame commented 4 years ago

Embedded Wizard solution

From https://www.embedded-wizard.de/ I have downloaded what we need to develop on our board together with some examples.

I has an editing program which allows generate the GUI and then to link it to the ARM keil compiler we are using.

I have used a ready GUI which I have executed on the board.

The working mode is easy: from the main.c there are initialisation functions and there is one function that is regularly called. I have tried to execute the tick less frequently and at 10 Hz the GUI still works fine.

int main( void )
{
  /* initialize system */
  EwBspSystemInit();

  /* initialize console interface for debug messages */
  EwBspConsoleInit();

  /* initialize Embedded Wizard application */
  if ( EwInit() == 0 )
    return 0;

  EwPrintSystemInfo();

  /* process the Embedded Wizard main loop */
  #define MARCO_CHANGES
#if defined(MARCO_CHANGES)
  for(;;)
  {
     EwProcess();
     HAL_Delay(100);    
  }
#else  
  while( EwProcess())
    ;
#endif

  /* de-initialize Embedded Wizard application */
  EwDone();

  /* terminate the system */
  EwBspSystemDone();

  return 0;
}
maggia80 commented 4 years ago

great! Let's go for Embedded Wizard.

Is there a way to start working on a prototype development IDE? where designing the GUI and generate the code for the STM32?

cc: @vtikha , @Nicogene

Nicogene commented 4 years ago

Embedded Wizard

License

Embedded Wizard is free only for education/evaluation/prototyping purposes.

The free version has the watermark and a limit on the complexity of the project (The used number of bitmaps, fonts, classes, etc. define the complexity).

See their pricing section for further information.

Deployabiliy on our board

It is possible to deploy on the laptop (target WIN32) and on our board. It has also a sort of "dry-run" mode implemented with the variant classes, in order to fast prototype and test the UI without having to interface to the board every time.

Performances

@marcoaccame checked here that it is possible to define with which period refresh the gui and then reserve the right amount of the memory

Is it easy to use?

I followed all their "Quick tour" tutorial and I managed to create a gui for a coffe machine 😅 .

I'd say that it is not difficult to use, it is only a little bit strange for me for the user experience. But we can train or ask help to learn how to use it properly.

The code of the logic that you write inside the Embedded Wizard Studio is chora. It seems pretty similar to c#, with some new directives like native.

In particular native is used to specify a part of the code that has to remain as it is in the generation phase(usually it includes the function calls to the hardware, aka the back-end). E.g. this was the code to be executed pressing the brewing button:

native ( aCoffeeStrength )
{
  /* Implement here your C code to start the brewing process in
     the device. If necessary predeclare the C functions intended
     to be used here. For example: */
  extern void YourDevice_StartBrewing( int aStrength );

  YourDevice_StartBrewing( aCoffeeStrength );
}

It generates c code that can be imported in keil, @marcoaccame tested one of their examples successfully on the board.

Conclusion

It seems pretty easy to use, and pretty fast to give it a try in order to see if it fits our need.

@vtikha and me will try to check their oscilloscope example, modify it in order to have a first prototype of our gui.

cc @maggia80

Nicogene commented 4 years ago

We decided to proceed with Embedded Wizard for now, closing.