Revision 2 as of 2011-03-01 13:53:11

Clear message

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

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

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

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

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

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

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 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.