How to combine a Qt-GUI with ROS? - qt

I'm currently working on a Qt-GUI with which I plan to remote control a robot. The robot is ros-controlled and equipped with multiple cameras. The topic is completely new to me and I just started learning both Qt and ROS and have some basic questions. I didn't make any progress googling around so I finally decided to post it here:
How can I connect data from ROS with Qt? So let's say I kind of want to live-stream the recordings of the cameras into my GUI. How is the general procedure there?
I've seen this ROS Qt Creator Plug-in. Is that something I want to use for this project?
Thanks a lot to everyone answering.
This is my first post here so I hope I didn't mess anything up or flouted forum regulations.
Edit 1: I am working with C++.
Edit 2: In case it helps you giving me advice; the rostopic type of the camera topic is sensor_msgs/Image.

For question 1, since the images are coming over the sensor_msgs/Image topic, using ROS with OpenCV's cv_bridge in the Qt application to receive the the incoming image stream from ROS into the Qt-GUI is a good start. There are several tutorials that cover integrating OpenCV into a Qt project. An important advice is to keep track of the image properties (size, color format, etc.), which will help in displaying the image properly in the GUI. Disclaimer: I have worked with Qt libraries on the Python side, not with C++.
As for question 2, the information for setting up, building, and running the code within the Qt-Creator can be very convenient. There are times where it is prudent to use an IDE to build, run, and debug code (to deal with memory management, segmentation faults, etc.), while other for other times running "catkin_make" or "catkin build" in the root directory when the hardware is minimal.

Related

Running QT5 in an embedded device with 64 MB RAM

I have been working with QML for a couple of weeks now. But now a new requirement has risen where I have to check whether I can run QT5 in an embedded device for my project. I need this for my GUI related operations. The device has an ARM processor (Intel ARM920T-PXA27x processor to be exact) with 64 MB RAM. 32 MB will be taken up for the OS and the rest will be available for application and QT.
I have to check whether this is possible. I have googled for some references and unable to find a suitable answer to my requirement with QT5. I need the GUI libraries but my project does not have advanced graphical requirements like swiping or animations. It contains basic controls like texts, buttons and lists/grids. Since I am new to QT especially to this part, I would like to hear whether
1) Is this a viable option and should I keep digging more into this? Any feedback would be welcome to know if it's worthy to spend time to attempt this or if it's a lost cause.
2) If there are options, could you point me in the right direction to look more into this?
It depends on the OS you are running on your SOC.
It's definitely possible when running Linux. You can e.g. use Qt Lite for configuring a minimal static build of Qt. Then you deploy your statically linked application to the device. You can check this blog post for experiences with Qt Lite.
One possibility is to go with Qt for Device Creation for the whole embedded Linux based software stack which boots to a UI implemented with Qt technologies.

Best way to make a project with multiple files

I am developing Arduino based system that will enlarge over time. At the moment it has only the humidity and temperature read functionality. But soon a door control, sound recording and gsm web client support will be added. I want all these to be included as libraries and used in the main part. I'm thinking of one ino file that includes all other modules and calls their functions. My question is what is the best and most clean way to do it?
I recommend sticking with libraries and library directories with examples. A library for each component to be interfaced with. This will help in many ways. Such as debugging and reuse.
C:\Users\myself\Google Drive\Arduino\libraries\componentX\componentX.h
C:\Users\myself\Google Drive\Arduino\libraries\componentX\componentX.cpp
C:\Users\myself\Google Drive\Arduino\libraries\componentY\componentY.h
C:\Users\myself\Google Drive\Arduino\libraries\componentY\componentY.cpp
etc...
This keeps it modular and compartmentalized.
Notice I have changed the Arduino's IDE preferences to Google Drive. (Cloud backup and portability)
Then rather than one BIG INO file in your sketch folder
C:\Users\myself\Google Drive\Arduino\somethingBIG\somethingBIG.ino
implement INO files in the
C:\Users\mflaga\Google Drive\Arduino\libraries\component\examples.
directories. This makes it quick to publish the components on GITHUB or Google Drive to share between systems.
Then you can have a sketch file that ties all the components together into your main project.
C:\Users\myself\Google Drive\Arduino\somethingTOPlevel\somethingTOPlevel.ino
You might want to take a look at the Bare Arduino Project.
For my own project Moti, I felt the need to leave the Arduino IDE and use better tools to develop my project. Having to symlink or move every libraries soon felt deeply cumbersome and I looked for another solution. At the same time I was discovering the power of Makefile and stumbled upon Sudar's incredible project: Arduino-Makefile.
I spent time organizing my folders and thought it could be useful for others.
You can think about the Bare Arduino Project as a framework for starting your own project.
I've taken the time to write a lot of documentation. You can learn more about the framework with the README.md and the Installation Instructions.
If you like it or feels like some stuff are missing, I'd love to hear your feedbacks and improvements.
Hope it helps! :)

Gstreamer support for Qt5 on Raspberry Pi

I need to play audio from my Qt project deployed on Raspberry Pi. Everything works fine except that I don't get any audio out, instead I get the following error message
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
After googling around I have come to the conclusion that the problem is that Gstreamer is not installed and recognized by Qt (more precisely gst-omx). Also, I have tried for many days to proper install gst-omx on Raspberry Pi without much luck.
Can anyone guide me to how I solve this issue???
One hack would of course just to use an external application to play the audio like mpeg321 and just start it up by QProcess, but I need to control volume and be able to start, stop, and pause, so such a solution is not really feasible...
Short answer: Well man, you found what many people find. Qt won't work with the Raspberry Pi just like that. You might get it to work, but without accelerated decoding it will just run as slow as it can get, and crash every few seconds. Sorry.
Long Answer #1: Qt needs to be compiled with special routines in order to get access to the omx stuff. This is, accessing the dedicated hardware embedded into the board which handles accelerated decoding of the h.264 (an a few others) files.
You have two choices, one is to build a special module from here: Carlon Luca's Github or you get a baked in Raspbian image with everything compiled in place from here: The Bugfree Blog. If you are a newbie on this, building it might give you a very hard time but you will get rather stable code and your choice of Qt and an up to date raspbian. The precompiled image on the other hand is just a matter of download, burn and run, very easy!, but it has some older code, so it has some rough edges and it's a bit unstable (almost every video i've tried shows garbled for the first 2-3 seconds and had crashes from time to time), also you will get Qt 5.1.2 without some of the speedups Qt guys added at 5.2.x.
Long answer #2: There are indeed gst-omx libraries which supposedly work with Qt and supposedly are way more stable, I've never tested them. But you can check for yourself Google: Qt Bellagio, I tried to post the links for them, but had not enough rep. You will have to build your own Qt btw.
Update:
If what you need is video playback, i forgot to mention Boot2Qt for the Pi, but you have to pay Digia for the license. It's called Qt Enterprise Embedded, google it.

SQLite+ Embedded linux + Pygtk or QT/c++

I'm trying to build an application in my ARM9 (Freindly ARM) board that will get data via serial port and update the database.
Now I need to port SQLite in my embedded linux and write an application to store my values.
How to port SQLite to Embedded linux
Pygtk or Qt? Which is easy for a newbie ?
P.S: I know I'm asking a lot of questions in a single post, but I just thought giving the complete picture will help to give a better suggestion. If not personalized opinions, I'll be grateful if you guys can give me pointers to good links/tutorials. :) Thanks.
1.
You don't need to port sqlite to the your Freindly ARM ARMv9 board.(as Mat has already mentioned)
I am going to assume that you have a mini2440 or
a micro2440.
Either way it is a Samsung S3C2440 chip.
sqlite works on this board as per the following thread.
Sumeet's post has cross compliation instructions.
Qt cross compliation works as per the following thread
So does Python and Gtk.
You have 2 options when it comes to cross-compliation,
Cross compile yourself
Use a tool like buildroot or openembedded's bitbake
For further resources on cross-compliation and building packages for this board
see the following resources.
mini2440 Google Code Project, specifically see the wiki and download sections
FriendlyArm Forum
FriendlyArm Downloads
linuxmce mini2440 wiki page
HOWTO-Getting-Started-With-OpenEmbedded for mini2440
Further HOWTOs
2.
PyGTK and PyQt are both relatively easy to learn in comparison to learning and debugging cross compilation on embedded architectures. If by Qt you didn't mean PyQt but instead meant C++ and Qt, then it not only becomes a choice of GUI toolkit, but also of language. I don't know your familiarity with Python or with C++, so I don't know which would be easier for you.
Which one you want to use is up to you.
Resources for both are linked to below
PyQt4 Tutorial
PyGTK Tutorial

Need help in learning Qt for Nokia phones

I'm trying to learn how to program qt. I know c++ very well, and have been able to do the standard hellow world program. I cannot find any books or documention on qt. I did find a tutriol,at
http://www.digitalfanatics.org/projects/qt_tutorial/chapter01.html but the project would not compile, said it could not find include file #include .
Does anubofy know of a book or anything that will tell you how to program the qt frame work?
There is a comprehensive list of books over at Qt Developer Network.
And the documentation for Qt is quite good, with several tutorials as a great place to start.
The link you are directing to above is referring to an old version of Qt, I would guess. The page at least seems to be dated back to 2004. Qt has gone a long way since then, especially when it comes to tools.
Using Qt Creator is probably the best way to start working with Qt applications, as it handles most of the setup needed to get started with a Qt project without having to resort too often to the command line (unless that is how you prefer to do it, of course.)
For Nokia phones you should check out the QML framework for any GUI you're making. Qt Creator has a simple designer for QML and you'll probably find some good help in the QML Getting Started tutorial.
It is easily connected to anything you make in C++, but gives you more ease and freedom in making user interfaces. But if you prefer to do everything in C++, all the things you can do in QML can be done using only C++ end as well.
The book C++ GUI Programming with Qt 4 is the definitive guide to programming Qt, I think. But you can also learn much from the Qt documentation itself, if you know where to start. The Qt documentation is really good and extensive, a perfect reference. And as Qt is also very intuitive, the doc can also help you find new functionality (If you have an idea, how some feature could be realized in Qt, it is often realized just that way).

Resources