[Documentation] [TitleIndex] [WordIndex

Goal

This is for the control roboticists who love working in linux and get flustered when asked to build windows apps for the rest of the world (namely users/test engineers). It also allows a write once, compile in linux and windows approach to developing gui programs when used with qt.

Installation

Prep

If you haven't already, install the ros build environment python packages:

> sudo apt-get install python-pip
# If on lucid, get the latest pip
> sudo pip install --upgrade pip
> sudo pip install --upgrade rospkg rosdep vcstools rosinstall
# If you haven't initialised rosdep yet
> sudo rosdep init
# Finally cache it
> rosdep update

Sources

The following rosinstalls a known working set of sources for electric. Use it directly or as a reference:

> rosinstall ~/mingwros/src --nobuild https://raw.github.com/stonier/win_ros/electric/mingw_electric.rosinstall

Note that we're rosbuild2'ing now - which is essentially a purely cmake solution that will utilise a src and parallel build directory.

Also note that the above rosinstall will have done the defunctory native compile on your source directory. This is useful as it means you can utilise the existing setup.sh to help you traverse the source tree.

Final touches:

> cp ~/mingwros/src/cmake/CMakeLists.txt ~/mingwros/src
# We're using rosdep2 now (installed above), move rosdep1 so it doesn't collide
> mv ~/mingwros/src/ros/bin/rosdep ~/mingwros/src/ros/bin/rosdep_one

/!\ It will fail on rosdeps for ubuntu precise and later. Pass --nobuild if you want to avoid the error caused by changed rosdeps. If you manually install the appropriate rosdeps it should still work.

Toolchain

Installing the mingw_cross toolchain to ~/mingw (you can modify installation location by setting MINGW_INSTALL_PREFIX):

> . ~/mingwros/src/setup.bash
> rosdep install mingw_cross
> cd ~/mingwros/src/win_ros/mingw/mingw_cross
> make install

This will also add some MINGW_XXX variables to your .bashrc. If you have previous settings, make sure these are updated as required.

RosBuild2

Compilation

# In case you forgot to do earlier
> cp ~/mingwros/src/cmake/CMakeLists.txt ~/mingwros/src
# Proceed with the build
> . ~/mingwros/src/setup.bash
> mkdir ~/mingwros/build
> cd ~/mingwros/build
> cmake 
    -DCMAKE_TOOLCHAIN_FILE=${MINGW_CMAKE_TOOLCHAIN_FILE}
    -C ${MINGW_CMAKE_ROS_CONFIG_FILE}
    ../src
> cd roscpp_tutorials; make -j5; cd ..
> cd qt_tutorials; make -j5; cd ..

The MINGW_CMAKE_XXX variables correspond to those configured in your .bashrc as described above.

Modifying the Build

> . ~/mingwros/src/setup.bash
> cd ~/mingwros/build
> ccmake .

You can then change variables such as the build type (actually, that's probably the only one you really want to modify.

Running

All the binaries are built statically. That means they are entirely self-sufficient and standalone. It also means they're big, but as we're primarily using these just for monitoring and debugging purposes, optimisation isn't a big deal.

Simply copy the binaries in ~/mingw/build/bin to your windows machine. Fire up a roscore on a linux machine and then run the qt tutorials - make sure you enter the correct variables for the ROS_MASTER_URI and ROS_IP. Alternatively you can just start a windows shell and set the environment variables before running any of the roscpp/qt tutorials.


2024-11-02 14:33