[Documentation] [TitleIndex] [WordIndex

Goal

Demonstrate what settings are needed for linking to the ros sdk. Developing with Msvc we do not need to deal with catkin, we can simply launch Msvc, configure it and directly compile link and rund our code from within Msvc.

Prerequisites

You will need to have installed and tested the Msvc SDK. If it's your first time, install core libraries and the sdk to the default paths (C:\opt\rosdeps\groovy\x86 and C:\opt\ros\groovy\x86) so you do not need to change a host of configuration settings.

You'll also need either MS Visual Express - C++ 2010 or Visual Studio 2010. The following has been tested and verified on MS Express, but should work on Visual Studio. If it does not, contact the devs.

Demo Project

If you have the compiled SDK installed in the default location, a demo solution is installed into 'C:\work\ws\src\win_ros\tutorials'.

If you have the installed SDK, a tutorial on how to create a solution file from scratch can be found in the next section.

Creating Your Own Projects

Create A Project

Open Msvc and create a new Win32 Console Application project with the default settings. Now you can replace the content in the cpp file with the code from the talker example. Before you compile you need modify the project settings as described in the next section.

Project Settings

There are four project settings that you'll need to modify:

As an example, on my system:

Additional Include Directories:

C:\opt\rosdeps\groovy\x86\include;C:\opt\ros\groovy\x86\include;%(AdditionalIncludeDirectories)

Processor definitions (prepend the following):

ROS_BUILD_SHARED_LIBS=1;

Additional Library Directories:

C:\opt\rosdeps\groovy\x86\lib;C:\opt\ros\groovy\x86\lib;%(AdditionalLibraryDirectories)

Library Dependencies (prepend the following):

roscpp.lib;roscpp_serialization.lib;rosconsole.lib;rostime.lib;

Debugging Environment:

PATH=C:\opt\rosdeps\groovy\x86\lib;C:\opt\rosdeps\groovy\x86\bin;C:\opt\ros\groovy\x86\lib;C:\opt\ros\groovy\x86\bin;$(Path)
ROS_MASTER_URI=http://127.0.0.1:11311
ROS_IP=127.0.0.1
ROS_HOSTNAME=127.0.0.1

User property sheets are an easier way of setting these (all except for the debugging environment variables) for a whole solution rather than doing it project by project. You can see an example of this in the reference tutorials solution (look for ros.props or open up the property manager in the solution).

Running Your Application Outside Of Msvc

If you want to run yout application direcly from the command you need set the following environment variables.

You can either set these variables globally or set them with the following setup script.

ros_setup.bat

set ROS_MASTER_URI=http://127.0.0.1:11311
set ROS_IP=127.0.0.1
set ROS_HOSTNAME=127.0.0.1
set PATH=C:\opt\rosdeps\groovy\x86\lib;C:\opt\rosdeps\groovy\x86\bin;C:\opt\ros\groovy\x86\lib;C:\opt\ros\groovy\x86\bin;%PATH%

If you want to develop under windows without Msvc but using directly catkin. Continue here


2024-11-30 18:01