Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Visual Studios 2017 project with ROS2 components

I'm trying to build a VS2017 application (specifically an Unreal Engine 4 app) that uses ROS2 but am having difficulty getting the ROS2 components into the project. I have downloaded and compiled ros2 from source using colcon and can run the defacto demo_nodes_cpp test apps to demonstrate it works. Now I want to pull that into a VS2017 application. I figured the libraries that were generated from colcon would be usable directly from VS but my attempts to link the VS project to the libraries hasn't worked. Alternatively, I tried using the VS File->New->Project from existing code from the top-level ros2 directory, but all those files confuse VS when it sees an xsd file and tries to "compile" that as well.

Realistically, I really only need the runtime part of ros2, but knowing what directories under ros2/src are strictly realtime code is not obvious. I've even tried the "Project from existing code" method to set up individual VS static libraries for each subdir of ros2/src but VS compilation gets confused about the include paths referenced by the code. For example, I made a standalone VS static library project for ros2/src/urdf/urdf. The new project pulls in the right includes and cpp files for urdf, but compilation gives me

c:\dev\ros2\src\ros2\urdf\urdf\src\model.cpp(42): fatal error C1083: Cannot open include file: 'urdf/model.h': No such file or directory

Bottom line, is there a known way of pulling in ros2 code into a VS2017 project either by referencing the libraries and includes generated from colcon or by compiling from source within VS? I know ros2 is only proven to work with VS2015, but I'm stuck with VS2017 due to the UE4 application I'm developing.