Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to call functions defined in an external C file from a ROS package?

Hi,

I have a C file(cluster.c) and a header file(cluster.h) which are not a part of any ROS package. I want to call functions in that C file from my already existing ROS package's source file(detect.cpp). Note that "cluster.c" is just a collection of some C functions without a main(). So, it can't be compiled separately.

I thought of creating a library out of "cluster.c" and "cluster.h" and link that library to my ROS package? How do I do this? What changes should I make to my existing package's CMakeLists.txt and package.xml?

This may be a silly and repeated question as I found similar questions being answered. As I am very new to ROS I couldn't understand much from those answers. If someone could explain me in simple terms, it would be great.

Thanks, Raj