Developing in ROS Indigo using QtCreator

The following is a guide on how to start using QtCreator in order to build projects in ROS Indigo (Ubuntu 14.04) with the new Catkin Tools.

1) Install Qt Creator:

sudo apt-get install qtcreator

2) Install the new Catkin Tools

sudo apt-get install python-catkin-tools

3)  Create a catkin workspace with catkin init. It will be assumed that the workspace is configured in ~/catkin_ws

3.1) Before adding your project to qtcreator it is recommended to first clean your workspace a build everything using Catkin tools

catkin clean
catkin build

4) Start QtCreator from a new terminal with the ROS environment already configured in its .bashrc.

qtcreator

5) Select the menu File -> “Open File or Project…”, then select ~/catkin_ws/src/YOUR_PACKAGE_NAME/CMakeLists.txt

6) Set the build dir to your catkin workspace location:
~/catkin_ws/build/YOUR_PACKAGE_NAME

7) Press Configure

8) Now in the Menu on the left of QtCreator select Projects -> Build Settings and add the following CMake arguments:

-DCMAKE_INSTALL_PREFIX=~/catkin_ws/install -DCATKIN_DEVEL_PREFIX=~/catkin_ws/devel

9) Save all an close QtCreator

10) In a new terminal start Qtcreator again
qtcreator

10) Now your project should be available and ready to navigate and build.

I also add some lines to my CMakeLists.txt file for Qtcreator to detected the proper location of my header files:

##################
# FOR QT CREATOR
##################
FILE(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/YOUR_PACKAGE_NAME/*.hpp)
FILE(GLOB_RECURSE INC_ALL "include/YOUR_PACKAGE_NAME/*.hpp")
FILE(GLOB_RECURSE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS src/*.cpp)

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.