[Documentation] [TitleIndex] [WordIndex

Goal

Demonstrate what settings are needed for linking to the ros sdk.

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\hydro\x86 and C:\opt\ros\hydro\x86) so you do not need to change a host of configuration settings.

You'll also need either MS Visual C++ 2010 Express or MS Visual C++ 2010.

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\hydro\x86\include;C:\opt\ros\hydro\x86\include;%(AdditionalIncludeDirectories)

Processor definitions (prepend the following):

ROS_BUILD_SHARED_LIBS=1;

Additional Library Directories:

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

Library Dependencies (prepend the following):

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

Debugging Environment:

PATH=C:\opt\rosdeps\hydro\x86\lib;C:\opt\rosdeps\hydro\x86\bin;C:\opt\ros\hydro\x86\lib;C:\opt\ros\hydro\x86\bin;$(Path)
$(LocalDebuggerEnvironment)

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

You should try to build and run your project using the same configuration (release/debug) as your ROS SDK, at least when you run it for the first time. This might save you some pain.

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\hydro\x86\lib;C:\opt\rosdeps\hydro\x86\bin;C:\opt\ros\hydro\x86\lib;C:\opt\ros\hydro\x86\bin;%PATH%

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


2024-10-12 17:13