Ask Your Question
2

GUI Catkin Qt5 Cmake

asked 2013-05-24 11:24:43 -0500

gbd gravatar image

updated 2013-11-18 16:41:31 -0500

tfoote gravatar image

Hey folks,

I don't really know where to start with my ROS-GUI implementation. I'm on Groovy and trying to visualize some Messages. I also have a little bit experience with Qt widgets, but don't know how to modify my project for ROS. The roscreate-qt-pkg promt seems not to be known by ROS on my system. Do you maybe know a good reference, from where to start, or have a good code example?

Thanks in advance

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
0

answered 2013-05-24 15:04:35 -0500

adobke gravatar image

On groovy you'll want to use catkin instead of rosbuild. Perhaps you were following a guide based on fuerte or earlier

Check out this tutorial http://www.ros.org/wiki/qt_create/Tutorials/Qt%20App%20Templates

edit flag offensive delete link more

Comments

Thank you for that answer. I used both promts and both told me that the command is unknown. I have groovy fully installed - all my system variables work properly. I can run all other catkin prompts like creating normal pkg, but when I use catkin[TAB] it even doesn't offer catkin_create_qt_pkg

gbd gravatar image gbd  ( 2013-05-25 06:45:25 -0500 )edit

Hmm. It looks like the source (https://github.com/stonier/qt_ros) doesn't match up to whats actually being installed when ros-groovy-qt-ros is installed. Perhaps you could manually install that package and try again.

adobke gravatar image adobke  ( 2013-05-25 07:59:48 -0500 )edit

You could also grab the template files from https://github.com/stonier/qt_ros/tree/groovy-devel/qt_create/src/qt_create/templates/qt-ros

adobke gravatar image adobke  ( 2013-05-25 08:00:54 -0500 )edit
0

answered 2013-05-25 08:44:33 -0500

130s gravatar image

By ROS-GUI do you mean "general GUI for ROS" or ROS' official GUI framework rqt? The latter is (hopefully) well-documented with many code samples.

edit flag offensive delete link more

Comments

general gui would be okay :)

gbd gravatar image gbd  ( 2013-05-25 13:21:07 -0500 )edit

I see. But just advertise for your possible peace of mind, rqt makes GUI development easier for ROS. I still recommend you to take a look at documents there.

130s gravatar image 130s  ( 2013-05-26 10:51:50 -0500 )edit
0

answered 2013-05-25 13:18:33 -0500

gbd gravatar image

updated 2013-05-26 10:31:42 -0500

Thank you adobke! With your help I managed to get the Template from ttps://github.com/stonier/qt_ros/tree/groovy-devel/qt_create/src/qt_create/templates/qt-ros After a catkin_make over it, also the catkin_make_qt_pkg promt is available now.

I created a qt_pkg with name test and opened it as usual with QT. Cmake ran succesfully, but when I try to run the code without having anything added or changed, the following errors pop up.

As the template is for Qt4, this might be the problem, because I am using Qt5, but don't really know, what I have to change in cmakelists.txt to get rid of the errors.


01:09:53: Führe Schritte für Projekt test aus...
01:09:53: Starte "/usr/bin/make" 
[ 10%] Generating include/test/moc_qnode.cxx
[ 20%] Generating qrc_images.cxx
[ 30%] Generating ui_main_window.h
[ 40%] Generating include/test/moc_main_window.cxx
Scanning dependencies of target test
[ 50%] Building CXX object CMakeFiles/test.dir/src/main_window.cpp.o
In file included from /home/mmm/Qt5.0.1/5.0.1/gcc_64/include/QtCore/qnamespace.h:45:0,
                 from /home/mmm/Qt5.0.1/5.0.1/gcc_64/include/QtCore/qobjectdefs.h:45,
                 from /home/mmm/Qt5.0.1/5.0.1/gcc_64/include/QtCore/qobject.h:47,
                 from /home/mmm/Qt5.0.1/5.0.1/gcc_64/include/QtCore/qabstractanimation.h:45,
                 from /home/mmm/Qt5.0.1/5.0.1/gcc_64/include/QtCore/QtCore:4,
                 from /home/mmm/Qt5.0.1/5.0.1/gcc_64/include/QtGui/QtGui:4,
                 from /home/mmm/catkin_ws/test/src/main_window.cpp:12:
/home/mmm/Qt5.0.1/5.0.1/gcc_64/include/QtCore/qglobal.h:1079:4: error: #error "You must build your code with position independent code if Qt was built with -reduce-relocations. " "Compile your code with -fPIC or -fPIE."
/home/mmm/catkin_ws/test/src/main_window.cpp:13:23: fatal error: QMessageBox: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/test.dir/src/main_window.cpp.o] Error 1
make[1]: *** [CMakeFiles/test.dir/all] Error 2
make: *** [all] Error 2
01:09:55: Der Prozess "/usr/bin/make" wurde mit dem Rückgabewert 2 beendet.
Error while building/deploying project test (kit: Desktop Qt 5.0.1 GCC 64bit)
Bei der Ausführung von Schritt 'Make'
#
#

UPDATE:

#
#

I could fix the first error by adding "add_definitions(-fPIC)" to the cmakelists.txt.

The next error I got was about missing files like <qmessagebox> could be solved by adding the specific "path INCLUDE_DIRECTORIES( "/usr/include/qt4" )".

Now there are a lot of new errors I don't really understand:

    22:13:49: Führe Schritte für Projekt test aus...
22:13:49: Starte "/usr/bin/make" 
-- Using CATKIN_DEVEL_PREFIX: /home/mmm/Dropbox/gesture/bureau/catkin_ws/test-build/devel
-- Using CMAKE_PREFIX_PATH: /home/mmm/Dropbox/gesture/bureau/catkin_ws/devel;/home/mmm/catkin_ws/devel;/opt/ros/groovy
-- This workspace overlays: /home/mmm/Dropbox/gesture/bureau/catkin_ws/devel;/home/mmm/catkin_ws/devel;/opt/ros/groovy
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using CATKIN_TEST_RESULTS_DIR: /home ...
(more)
edit flag offensive delete link more

Comments

Please don't use "answer" section when you update your question status. Do so by modifying your original question. That's how this forum works.

130s gravatar image 130s  ( 2013-05-26 10:52:49 -0500 )edit
1

OK, sorry for that - got it :)

gbd gravatar image gbd  ( 2013-05-26 11:18:17 -0500 )edit

Hey! I have the same problem (Qt5 and Qt4 installed). Have you managed to find a solution?

NikolasEngelhard gravatar image NikolasEngelhard  ( 2014-01-09 03:59:03 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-05-24 11:24:43 -0500

Seen: 8,710 times

Last updated: May 26 '13