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

Revision history [back]

click to hide/show revision 1
initial version

Probably the best example of integration between a 3rd-party program and ROS is Gazebo. The situation depends on your external library though.

If your C program provides a communication API, you could write a ROS node that will interface with that API. Essentially, it would be a bridge between ROS and your C program. In this case, it would be very similar to writing a ROS driver for devices and very similar to Gazebo.

If your C program does not expose any methods of communication, you're going to have to modify the source code such that it does. For that, you can see this question for some help.

Probably the best example of integration between a 3rd-party program and ROS is Gazebo. The situation depends on your external library though.

If your C program provides a communication API, you could write a ROS node that will interface with that API. Essentially, it would be a bridge between ROS and your C program. In this case, it would be very similar to writing a ROS driver for devices and very similar to Gazebo.

If your C program does not expose any methods of communication, you're going to have to modify the source code such that it does. For that, you can see this question for some help.

EDIT:

You cannot include ROS's libraries in your C program because ROS is written in C++ and depends heavily on other C++ libraries (Boost, Eigen, etc.). What you need to do is expose the functions of your C program and wrap them in C++. This would allow you to use ROS with your application easily. Essentially, you would write a C++ application that instantiates and instance of your C application and collects and sends data via function calls.

Here is a quick, and very simplified example:

// My ROS application
#include "C_application_header.h"

class My_New_App
{
    My_New_App()
    {
        C_Application my_c_application;
        my_c_application->start();
    }
}