Note: This tutorial assumes that you have completed the previous tutorials: Mingw Build Environment - Diamondback. |
![]() |
Qt-Ros on Windows
Description: Shows how to build qt-ros packages for win/lin.Keywords: qt windows mingw
Tutorial Level: INTERMEDIATE
Contents
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
Diamondback Bare Bones
Ros Install - we'll use the bare-bones for illustration.
rosinstall /opt/ros "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=diamondback&variant=ros-base&overlay=no" cd /opt/ros . ./setup.bash
Eros
Eros Installation - provides tools for cross-compiling setup/use.
rosinstall /opt/ros https://code.ros.org/gf/project/eros/scmsvn/?action=browse&path=%2F*checkout*%2Ftrunk%2Feros_diamondback.rosinstall echo "export PATH=`rospack find eros_python_tools`/scripts:$PATH" >> /opt/ros/setup.sh cd /opt/ros . ./setup.bash
Mingw Cross
mingw_cross - eros build script for mingw cross environment.
roscd mingw_cross make # installs mingw-cross in /opt/mingw and builds gcc, boost, qt make links # installs links in /usr/local/bin for i686-pc-mingw32 tools
Note, the build step above takes a long time.
Toolchain Bridge
Toolchain Bridge - need apr, apr-util, log4cxx.
rostoolchain select mingw_cross/i686-pc-mingw32 # supplies ros configuration for mingw toolchain roscd eros_apr; make; make install roscd eros_apr_util; make; make install roscd eros_log4cxx; make; make install
Full Cross
Cross-Compile Ros - need to cross-compile ros comms for windows.
rosmake --pre-clean roscpp
Note that this uses the mingw_cross/i686-pc-mingw32 configuration selected earlier for the global ros environment, so all packages will now be cross-compiled as mingw32 packages.
Tests
Qt Tutorials - sample ros programs written with qt.
roscd eros_qt_tutorials make
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!
Linux Versions
The lovely thing about this is the same code, and environment can be used to build your packages for 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 rosmake --pre-clean roscpp roscd eros_qt_tutorials make
and presto - they will run just as well in linux! Note that on linux, you can/usually will probably just tick the checkbox in the qt guis to use the environment variables.