Contents
Overview
- Uses windows sdk 7.1
- Compiles with cmake/nmake.
- Compiles in Release mode with Debug Symbols (.pdb files)
- Currently 32 bit support, 64 bit shouldn't be a big leap...
Preparation
PreRequisites
Set up win_python_build_tools (rospkg, vcstools, catkin-pkg, win-ros and dependencies).
- Install the following dependencies:
- Make sure you install Windows Headers and Libraries, Tools and Visual C++ Compilers. To choose Visual C++ Compilers, .NET Framework 4(or over) SDK or runtime should be installed first.
- Useful Utilities
- Extract the following archives to C:\opt
Rosdeps : boost 1.47.0, bzip2 1.06, log4cxx 0.10, tinyxml 2.6.2, eigen 3.2.1
These instructions use winros_init_workspace, winros_init_build and winros_make provided by win_python_build_tools.
If you want to build win_ros with MSVC2012+ or in x64 you will have to recompile all the dependencies before you can compile win_ros. Detailed instructions of what needs to be recompiled and how can be found here: win_ros with MSVC2013.
A 64 bit precompiled version of rosdeps using MSVC2010 can be downloaded from http://www.mastergunner.net/winros/rosdeps.rar right-click and save target as rosdeps.rar and extract to C:\opt
Sources
Change directory to where you would like your workspace and
> mkdir C:\work > cd C:\work > winros_init_workspace --track=hydro ws
The new 'track' option is to download sources relevant to specified version. If you want to get 'groovy', use 'groovy' instead of 'hydro'.
This simply installs the compilable sources in a workspace (under ws/src) ready for catkin building along with a setup.bat script that integrates your shell with the msvc and python environments.
You should check if setup.bat contains the following message together with incorrect paths to Visual Studio and/or the Windows SDK:
@REM Could not find windows sdk or visual studio, please @REM install and configure by hand [Windows SDK/Visual Studio]
If this is the case you should fix the paths before proceeding to the next step.
Build
> cd C:\work\ws > setup > winros_init_build --track=hydro # Parse and edit config.cmake to configure build settings # especially CMAKE_BUILD_TYPE if you want to build Debug > winros_make # Optional install step > winros_make --install
The new 'track' option for winros_init_build is to generate config.cmake suitable for specified version. In case of 'hydro', it can be omitted. If you want to get 'groovy', use 'groovy' instead of 'hydro'.
Note that you can selectively build specific package targets while developing. e.g.
# Core libraries and test programs > cd C:\work\ws\build\win_ros\tutorials\win_roscpp_tutorials > nmake # Messages > cd C:\work\ws\build\common_msgs\sensor_msgs > nmake # Runtime executables (rosmaster, rostopic etc) > cd C:\work\ws\build\win_ros\msvc\msvc_runtime > nmake
Validate
Devel Space
In three shells:
> call C:\work\ws\devel\setup.bat > roscore
> call C:\work\ws\devel\setup.bat > roslaunch msvc_runtime talker.launch
> call C:\work\ws\devel\setup.bat > roslaunch msvc_runtime listener.launch
If you have trouble with environment variables not being set after calling the bat script, try setting the following ones manually. See EnvironmentVariables for details. Ensure the directory referenced by ROS_HOME exists.
set ROS_MASTER_URI=http://127.0.0.1:11311 set ROS_ROOT=C:\opt\ros\hydro\x86 set ROS_HOME=C:\work\home set ROS_PACKAGE_PATH=C:\opt\ros\hydro\x86\share
Install Space
The install space should let you run the above three shells in the same way. Simply call C:\opt\ros\hydro\x86\setup.bat instead.
Appendix - Console
Console is not necessary, but it's alot nicer than the windows command prompt.
Create some new tabs (Edit->Settings->Tabs) with names Build, Development and Install.
In each tab, use the following command for the Shell:
cmd /k C:\work\ws\setup.bat cmd /k C:\work\ws\devel\setup.bat cmd /k C:\opt\ros\hydro\x86\setup.bat
- Create desktop shortcuts with target:
_path_to_console_\console\Console.exe -t "Build" _path_to_console_\console\Console.exe -t "Development" _path_to_console_\console\Console.exe -t "Install"
These will automatically launch you into the environment of your choice.
Appendix - Troubleshooting
Windows command prompt UTF8
If you have some issues using UTF8 in windows command prompt you can fix it using the following command :
chcp 65001
Also, you need to use Lucida console fonts.