zero latency publishing of sensor data
Hi !
I have a sensor producing data at high but variable frequency, i.e. random times between two incoming data point. I have a callback function (independent from ROS) that gets called when there is incoming sensor data. I'd like that function to publish the data into a a ROS topic immediately as it receives with no latency.
I found no example for this, the available examples are using some Node with fixed "spin" rate, that gets called by rclcpp.spin() and checking for already received data that they publish then. However this solution introduces latency on the receiver side, since data could have arrived before the spin()'s callback is called.
Is there an easy way to implement the above functionality in C++ ROS2 Eloquent ?
thanks, G
Have you tried calling the ROS
publish
function from within your callback?I found no examples for that for ROS2. Old examples using ros/ros.h like https://raw.githubusercontent.com/ros... seems not working under ros2.