Use data from C code into ROS node
Hi,
I currently have a complexe C code that provide data (in the form of float) at each time step. I'm new with ROS (I have done all the tutorial of ROS Melodic on Ubuntu) and I try to make a node that publish the data of my C code on a topics in real-time (so at each time step of my C code).
How is it possible to link a C code with ROS ?
Thanks for your help !
Have you see this tutorial - writing a Simple Publisher and Subscriber (C++) ?
Yes of course. But here what I want to do : I have a "for loop" in a function of my C code who provide some data and inside this for loop in infomatique language C I want to have a ROS publisher wich publish this data on a topics.
When you create ros::Publisher and invoke publish() in your for look it does not work ?
I tkink I can't do that because my code is in C (and compile in C) and the ROS publisher is in C++. Moreover initialise a ROS node is very costly in time and I need something very quick wich publish on the topics every 0.001 second.
and because of the form of my C code (wich I can't change) it's not possible to initialise a Node outside the for loop (because in fact it's no realy a "for loop" but a function (inside wich I need to publish) wich is called at every step time)