ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

multiple nodes with different ros::Rate ?

asked 2014-01-08 03:27:54 -0500

hvn gravatar image

updated 2014-01-08 09:07:33 -0500


Using 4 nodes, I find that some loops are executed way too many times with the result that a simulation doesn't have the desired result. Is it wise to put 1 node on a rate of 1 or less, and another on 10? The messages will be exchanged, but how about the timing ?

In addition: I have 1 sensor node for camera, 1 trajectory node, 1 kinematics node and 1 node publishing to the robot. So according to your explanation, the sensor node should have a rate of 30, which makes perfect sense since the frame rate of the camera is 30 fps. The kinematics node, having a position loop, should be different and now has a loop rate of 10. In the past I had all nodes at loop rate 1, which didn't work out. Now, checking with rosbag, I find that the kin. loop is executed at rate 10 as well of course. I had not realized this would happen and it feels like way to much...perhaps 1 would be better. Can you give any advise ?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2014-01-08 03:39:02 -0500

Tirjen gravatar image

updated 2014-01-08 04:46:47 -0500

I'm not sure to understand your question, but it depends on what you are doing. If you have to synchronize the message exchange, it would be wise to choose the rate accordingly.

In general it is normal to have different loop rates on different nodes. For example if you have a mobile robot with a depth sensor, you will probably have that the state of the robot (tf) is published at something like 100Hz, while the sensor message will be published at something like 30Hz.

Can you explain better your problem?


Ok, I think I'm still missing something, but if I get it right you are using a loop rate of 1Hz for the trajectory node and the node that publishes to the robot...

My advice is to up them to 10Hz, especially the loop rate of the node publishing commands to the robot. You should choose it depending on how you are communicating with the robot. If is for example a robotic arm, and it publishes joint positions at 10Hz, it is probable that you have to give commands to it at a similar rate, but it depends on the robot.

For the trajectory node I don't know how it works, but I suppose it must communicate with other nodes at a similar rate...

edit flag offensive delete link more


Thanks for the advise. I changed the rates, and the graphs from rxbag show a much better result.

hvn gravatar image hvn  ( 2014-01-09 21:00:02 -0500 )edit

I'm glad it works better! :) If the problem is solved, please mark the answer as correct.

Tirjen gravatar image Tirjen  ( 2014-01-10 01:12:17 -0500 )edit

It works better, but the issue isn't solved as yet. Still looking at it.

hvn gravatar image hvn  ( 2014-01-19 20:52:36 -0500 )edit

Question Tools

1 follower


Asked: 2014-01-08 03:27:54 -0500

Seen: 1,212 times

Last updated: Jan 08 '14