ros::spinOnce and timeout
Hello all,
I have a problem about ros::spinOnce. My main algorithm's frequency is 25 Hz. So, each iteration should last for 40 ms at most. But when I search the logs, I realized that the program spends for 30~40 ms to just passed the ros::spinOnce. I have only 4 callbacks/subscriptions and we don't make any expensive things in them. I didn't understand why we wait queries for that much? Is there any timeout parameter for preventing such situation.
[DEBUG] [ 01:47:10 .790449152]: New iteration
[DEBUG] [ 01:47:10 .830653549]: [Roboteq] The code is in imu_callback//IT PASSED 40 MS. WHY?
[DEBUG] [ 01:47:10 .830864840]: [MotorDriver] cmd_vel.x = -0.300000
[DEBUG] [ 01:47:10 .830896443]: [MotorDriver] cmd_vel.th= -0.000000
[ INFO] [ 01:47:10 .841152961]: ser.avaliable() = 20
[ INFO] [ 01:47:10 .841399266]: ResultEncoder = C=47447:47386
As you can see, I spend 40 ms here before I start doing my actual stuff in the rest of the iteration. UBUNTU 16.04 - Kinetic - Ros1
Thanks in advance.
You have not provided enough information. I suggest you show us the code for your ros node.
Hi Mike, thanks for the comment. Let me try to make it more clear: