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

Revision history [back]

You can achieve what you want here by controlling the rate at which messages are published by the first node, assuming that the time taken by the second to process each messages is relatively constant. The message passing system is fundamentally event based, so only a publisher can set the rate, the subscriber simply runs at the rate messages are received (or slower if they can't be processed fast enough)

You say your first node receives a string from a raspberry pi, does the node have any control over 'when' it receives this string or is it pushed by the hardware? This is important because this is the node which needs to publish at exactly 66.7 Hz, so if it can control when it reads from the Pi it makes it easier to achieve this.

Your second node will then be subscribing to a topic which i published at 66.7 Hz, so it's callback (CPU allowing) will be running at the same rate. This node will then be able to write to the port at the correct frequency, although there will be a phase offset between the original read on node one and the write out on node two.

Hope this makes sense.