Ask Your Question

Revision history [back]

There are a few steps in to sync/resync:

  1. On your Arduino, in setup(), you define what topics you want to publish/subscribe. This data is stored on the Arduino.

  2. When the python node (re)connects, it requests the topics to be published/subscribed from the Arduino.

  3. Once synced, both sides exchange data. The python node keeps track of when the last communication was, and if no communication has happened recently, it announces "Lost sync..." and attempts step 2 again to get the Arduino/PC back into a consistent state.

Even if you weren't publishing any information, the calls to spinOnce() will cause a timestamp update every 5s (which will keep the Arduino "synced" as far as the python node is concerned).

If you frequently see "Lost sync..." then you probably aren't calling spinOnce() frequently enough. You want to be careful, because this can also cause lots of data loss on subscribers (since your serial input buffers will only be processed when you call spinOnce()).