How to call node publisher from C function
Hello, guys!
I'm using ROS2 Foxy with Ubuntu 18.04. I successfully integrated my C application code into ROS2 node but there is one single thing left to be done. Namely, I have an asynchronous C callback function that is called every time I receive new data over USB. I need to use Node publisher to publish those data through the topic to other subscriber nodes.
How can I do it from my callback function located in C file? How can I call my node's publisher from there? Is this a question of mixing C and C++? Any experience to share with me?
Thanks in advance for your time and efforts. Sincerely, Bojan.
You might want to look into using
rclc
instead ofrclcpp
: https://github.com/ros2/rclc