Ask Your Question
1

using a library

asked 2012-03-22 02:04:44 -0500

anonymous user

Anonymous

Hello, I am a newbie to ROS (and to C++ as well). I need to use some fuctions and classes from a library "itpp-4.2" .Now i have successfully installed the library locally (as i dont have sudo rights) in a folder /home/abc/itpp-4.2 . I want to use these function in a ros node in a ros package. so how can i do that. what files do i need to modify.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
4

answered 2012-03-22 03:45:01 -0500

On your CMakeList.txt in your ros pkg you need to add something like this:

rosbuild_add_executable(your_node src/your_node.cpp)
target_link_libraries(your_node itpp-4.2)

Hope this helps!

edit flag offensive delete link more

Comments

Since that library isn't going to be in the standard folders to look in when linking, you'll also need to add that to the linker search path as well as the headers to the include paths. Look at the CMake docs, specifically the link_directories and include_directories commands .

Eric Perko gravatar image Eric Perko  ( 2012-03-22 16:08:32 -0500 )edit
1

answered 2012-03-22 02:49:22 -0500

dornhege gravatar image

Depending on what you want to achieve, you don't need to do anything ROS specific. You could just use normal cmake commands you would use for any other library.

This would be OK, if the library can usually be installed as a system library. In that case it is could practice to setup rosdep so the library can be found by ROS.

On the other hand, if the library can't easily be installed in general, you would need to wrap it into a ROS package.

Look here: Third Party Libraries

edit flag offensive delete link more

Comments

Hi I browsed the rosdep, but it confused me. Could you explain more to me to write a ros node with installed library?

jason gravatar image jason  ( 2017-02-08 15:29:43 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-03-22 02:04:44 -0500

Seen: 180 times

Last updated: Mar 22 '12