Ask Your Question
1

How to use a sdk (non-ros header/lib/binaries) in ros package?

asked 2014-11-24 10:23:22 -0500

fromandto gravatar image

updated 2014-11-24 10:42:32 -0500

I am trying to use a camera sdk to write a camera stream publisher in ros.

It's not a uvc camera, so I cannot use usb_cam or other similar nodes to access the camera stream.

I've already had the camera sdk consisting of ASICamera.h/libASICamera.a/libASICamera.so, and I've successfully got it running.

But now I don't know how to use it in a ros node.

After I add the header files into the package/include directory

and #include "ASICamera.h" into the publisher node,

I type catkin_make. it reports:

make[2]: * [asi_converter_real/CMakeFiles/asi_converter_real.dir/src/asi_converter_real.cpp.o] Error 1 make[1]: * [asi_converter_real/CMakeFiles/asi_converter_real.dir/all] Error 2

I think the reason is that I have not add the .a and .so into the publisher node.

But I don't know how to do this

In the package.xml, it seems that

build_depend and run_depend tags can only access ros-inbuilt static/dynamic libraries, how could I use my own .a and .so in a ros node ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2014-11-24 10:44:41 -0500

The package.xml file only describes what the node depends on, so that catkin can figure out what packages to add during compilation. The real heart of the compiling system is CMakeLists.txt. There you'll list both the catkin packages and the non-catkin (system) packages. Your ASICamera.h falls in the second category.

Say you're building a node called ros_asicamera, and the asicamera library is called asicamera.so. Then your CMakeLists.txt will have something like:

add_executable( ros_asicamera src/ros_asicamera.cpp)
target_link_libraries(ros_asicamera asicamera)

Bare in mind that if asicamera header and libraries files are not installed in the default system paths (e.g. /usr/lib, /usr/local, /usr/include etc) then you have to tell CMake how to find them. This is done in several ways, depending on your asicamera package. The most portable ways are pkg-config or findAsicamera.cmake (the second is preferable). If these files are not provided then you can use:

include_directories(path_to_asicamera.h)

for the header files. Finding libraries is more tricky, and you can find additional information at http://www.cmake.org/Wiki/CMake:How_T... .

Last but not least, since the error message you posted is not very informative, try doing:

make VERBOSE=1

to get additional information on the error. That also helps when posting on the Q/A.

Hope this helps!

edit flag offensive delete link more

Comments

1

make VERBOSE=1 is very useful!!!!!! thx so much, Now I know that Makefile is in the ws/build, with VERBOSE I can find which header/library is missed and How the final -I/-l lines look like. thx again, lorenzo

fromandto gravatar imagefromandto ( 2014-11-25 00:43:19 -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

2 followers

Stats

Asked: 2014-11-24 10:23:22 -0500

Seen: 523 times

Last updated: Nov 24 '14