ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

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
4

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 image fromandto  ( 2014-11-25 00:43:19 -0500 )edit

Hi,

I have a similar question, https://answers.ros.org/question/4032...

I did what you said, however, new error happened:

lumenera_camera/lucam-sdk_2.4.3.94/api/include/lucommon.h:137:10: fatal error: windows.h: No such file or directory
 #include <windows.h>
          ^~~~~~~~~~~
compilation terminated.
farhad-bat gravatar image farhad-bat  ( 2022-06-30 17:55:31 -0500 )edit

I have a problem that is similar: https://stackoverflow.com/questions/7...

farhad-bat gravatar image farhad-bat  ( 2022-06-30 20:51:55 -0500 )edit

Question Tools

2 followers

Stats

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

Seen: 955 times

Last updated: Jun 30 '22