ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
In theory, this should be doable. In practice, there will be lots of caveats that make annoying to non-ros users.
If you compile your project with cmake, you should be able to compile against roscpp and sensor_msgs by doing something like this in your CMakeLists.txt:
find_package(roscpp REQUIRED)
find_package(sensor_msgs REQUIRED)
include_directories(${roscpp_INCLUDE_DIRS} ${sensor_msgs_INCLUDE_DIRS})
add_executable(my_program my_program.cpp)
target_link_libraries(my_program ${roscpp_LIBRARIES} ${sensor_msgs_LIBRARIES})
If you compile with something other than CMake, you can probably use pkgconfig to find the compile and link flags for roscpp. This is mostly beyond the scope of my experience, and is probably not well tested.
Caveats include, but may not be limited to:
You may be able to get around these with static linking, or by detecting when ROS is not found, and compiling without it.