[ros-users] Merging Player with ROS

Brian Gerkey gerkey at willowgarage.com
Tue Feb 15 02:01:16 UTC 2011


On Sun, Feb 13, 2011 at 11:46 AM, Aslund <sebastian.aslund at gmail.com> wrote:
> While an option is to use the ROS Player driver, then I want to avoid it. I
> have already Player installed on my robot and had quite some problems with
> it, which is now solved, but it scared me from doing any changes to it, so I
> want to maintain the robot as it is.
> My idea is to have a second computer to process the algorithms, which
> communicates through Player on a local network to my robot.
> I used the Publisher example from the tutorial to create a base to work
> with, if I add the following lines to my CMakeLists.txt:
>
> include_directories(/usr/local/include/player-3.1)
> link_directories(/usr/local/lib)
>
> then I am able to compile the example including the header file of Player (
> #include "libplayerc++/playerc++.h" ), but when I add Player functions, then
> rosmake returns that there are undefined references, which could indicate
> that I need a way of adding the library files into my CMakeLists.txt list.
> My problem is that I do not know how to add  .so-library files into
> CMakeLists.txt inorder to make the compiler able to use Player functions, I
> hope someone can help me resolving this problem.

I would use pkg-config to get the build flags for Player.  Assuming
that you're trying to build a client program against libplayerc++, do
something like:

include(FindPkgConfig)
pkg_check_modules(PLAYERCPP REQUIRED playerc++)
include_directories(${PLAYERCPP_INCLUDE_DIRS})
link_directories(${PLAYERCPP_LIBRARY_DIRS})
# Assuming that you're building an executable named foo
target_link_libraries(foo ${PLAYERCPP_LIBRARIES})

Note that you may have to add /usr/local/lib/pkgconfig to your PKG_CONFIG_PATH.

	brian.



More information about the ros-users mailing list