[ROS2] How to signal the end of a callback

asked 2022-01-27 07:05:45 -0500

goksankobe gravatar image

updated 2022-01-28 06:36:50 -0500

My use case is very similar to having a simulator like Gazebo providing the clock topic so that the ros nodes execute with respect to the simulated clock. However, an additional capability that I'm looking for is to be able to put a breakpoint in one of the callback functions (whether a timed callback or a subscriber callback), and have the simulator respect that breakpoint so that it does not iterate the simulation, and wait for the callback to finish.

Therefore, I wonder if there is a way to get a signal at the end of the callback execution so that I can use that signal to forward it to the simulator, which can in turn iterate the simulated clock.

At least for timed callbacks, I can see that there is a TRACEPOINT after executing the callback, but its only for profiling purposes I believe:

https://github.com/ros2/rclcpp/blob/d...

I can see the Executor class has functions like spin_once and spin_node_once, so once could use these and increment the clock after they return, but I'm not sure if this is the optimal way. Also this requires some re-writing of the existgin applications that just call spin()

Thanks in advance

edit retag flag offensive close merge delete