[Documentation] [TitleIndex] [WordIndex

Note: This tutorial assumes that you have completed the previous tutorials: Mingw Build Environment, Mingw Packages.

Mingw Qt-Ros Packages

Description: How to create qt-ros packages that can also be compiled by the mingw_cross compiler.

Tutorial Level: INTERMEDIATE

New in electric


Set up a single ros package that can compile both native linux and mingw qt applications from the one source base.


Make sure you have followed the instructions in the previous tutorial for setting up a Mingw Build Environment that also includes qt_ros.

Design Considerations

Typically you'll be wanting to simply create a monitoring/debugging package with dependencies that rely only on roscpp and the various comms (msg/srv packages - either official ros packages or your own.

This separation of code from comms is quite important when it comes to creating mingw applications as you typically do not need the code (which may not be ported to mingw) for a dependant package, simply its comms. When designing your own packages, keep this in mind - keep code packages and comms packages separate!


The qt_ros stack provides a handy helper to set up a template that works much like the roscreate-pkg script.

rosrun qt_create roscreate-qt-pkg qfoo

That should be immediately compilable in the source tree (native) and via rosbuild2 (mingw).


Native Linux Binaries

You can make in the source tree via rosbuidl1 to generate a native linux qt app.

Mingw Binaries

Use the mingw build environment to rosbuild2 your mingw app. For ease of reference, a quick rundown of the commands for a rosbuild2 is below (assumes your source tree is in ~/ros and parallel build tree is in ~/build/mingw):

> mkdir ~/build/mingw # note: your parallel build tree can actually be anywhere
> cmake ~/ros
> cd foo
> make -j5            # -jx for number of parallel jobs

Finally copy the resulting rosbuild2 .exe's to windows and run.

Extending the App

The roscreate-qt-pkg script is recommended even if you don't eventually build a similar template as it will generally be less effort to modify this than to construct it all manually.

Adding Dependencies

Do this in the usual way in the manifest.xml, but make sure you add them to the rosbuild2 element as well.

Adding Sources

If you ensure you add all headers in include/qfoo/*.hpp and sources in src/*.cpp, then the app will continue to build fine without any cmake changes.

User Interface

You can use designer to modify ui/main_window.ui. Changes can then be picked up and acted on via main_window.hpp and main_window.cpp.

More Details

For a more detailed explanation of the cmake api and its usage for qt, refer to qt_build.


These snapshots are from qt_ros' qt_tutorials package.


Old Releases

The experimental diamondback release is no longer supported. The old instructions can be found here.

2011-11-19 12:27