ROS 2 Timer have 30ms of Jitter

asked 2023-03-31 06:55:22 -0600

flash_27 gravatar image

updated 2023-03-31 14:39:02 -0600

kscottz gravatar image

Hello,

I am using ROS2 Foxy on a custom board, 6 core arms with linux. I have an executor that is running a single node. That node has 2 subsciber and one walltimer. In the timer callback I call a processing function and then send messages to a publisher.

The period should be 50ms, but using ros2 topic hz topicname I see that it has a max of 30ms of jitter:

average rate: 19.999 min: 0.018s max: 0.083s std dev: 0.00336s window: 4249

I don't know how to improve things. I have already tried:

  • Using StatiSingleThreadExecutor
  • setting SCHED_FIFO just before exec.spin
  • using a MultithreadExecutor and setting one single callback group for the 3 callbacks

I don't know what might be the cause of this issue. Does anyone has some suggestions?

EDIT: I have discovered that the function that I am calling has a variable execution time: every 200 rounds it takes 15ms to run. It is exactly the same periodicity of the high jitter that I find.

edit retag flag offensive close merge delete