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

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.

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 close merge delete

Sort by » oldest newest most voted

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)


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!

more

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

( 2014-11-25 00:43:19 -0600 )edit