Note: This tutorial assumes that you have completed the previous tutorials: Mingw Build Environment - Diamondback. |
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Qt-Ros on Windows
Description: Shows how to build qt-ros packages for win/lin.Keywords: qt windows mingw
Tutorial Level: INTERMEDIATE
Notice
This documentation was maintained for diamondback - it is no longer supported and may be somewhat broken! Please move to electric and use the current documentation.
Overview
For the purposes of illustration, this tutorial will begin by installing a working build environment from scratch and then proceed to develop some simple qt-ros applications.
The working environment can just as easily be overlaid an existing tree via the rosinstall commands.
Installation
Make sure you have followed the instructions in the previous tutorial for setting up a Mingw Build Environment.
Tests
Qt Tutorials - sample ros programs written with qt.
Commands:
rosdep install eros_qt_tutorials # make sure you have the qt dev packages. roscd eros_qt_tutorials make
Validation:
roscd eros_qt_tutorials/bin ls // you should see // qadd_client.exe qadd_server.exe qlistener.exe qtalker.exe
This creates talker/listener and add_int server/client pairs written with a qt interface. You can simply copy them from the bin folder to your windows platform as is. Since they're static builds, you do not need to copy any other libs.
On your linux host, start up an roscore from a natively compiled ros tree (not this one). On windows, simply run the qt test programs making sure you configure the master ip and windows host ip correctly.
Creating a Qt-Ros Package
roscreate-qt-ros-pkg - tool that installs a template for a qt-ros package.
roscreate-qt-ros-pkg qtest cd qtest make
This provides a ready made template for a qt-ros program with hooks for quitting, shutting down the ros thread cleanly and a small panel for remote/local ip address configuration if necessary - a good place to start!
Native Versions
The lovely thing about this is the same code, and environment can be used to build your packages natively (typically linux). I usually keep both a linux and a mingw tree respectively so I don't have to keep repeating the compiles, but you can simply revert your mingw tree back to a native one as follows:
rostoolchain clear rosprotect --unprotect --comms # clears ROS_NOBUILD from the comms packages rosprotect --pre-clean --comms # rebuilds the comms packages as native roscd eros_qt_tutorials make
and presto - they will run just as well natively! Note that on linux, you can/usually will probably just tick the checkbox in the qt guis to use the environment variables.