Synchronizing RoboRio and Raspberry Pi Clocks

Hello,

I’m looking to synchronize the system clocks between my raspberry pi 3 and roborio in python for vision processing to determine latency. I’m not really sure where to start so any help would be great.

Thanks

Hm, why do you need to synchronize the clocks? Latency is about measuring time durations after all.

We accomplished what I think you’re looking for by sending a “hearthbeat” message with the roborio’s timestamp to the pi every 10ms. The pi then included the most-recently-received timestamp with the vision tracking information sent back to the roborio. The roborio code then used this to estimate the time since the image was taken (we just figured half of the full round-trip time). This gets you the approximate image time without having to deal with clock synchronization.

This has been rattling around in my brain for a while too. We’ve yet to come up with a great way to do it but we’re working on some ideas with tunneling NTP traffic among other things.

Also, I’m gonna leave this here because it’s summer CD and I enjoy poking bears:

https://evola.fr/en/breakout-boards/813-real-time-clock-module-bq32000.html

It can be wired up to a raspberry pi pretty easily:

There are more DIY options available too:
https://oshpark.com/shared_projects/VAdOI0eA

Man, I love the FRC rules. They are superbly fun. Word of warning, be weary of RTC modules advertised with supercaps… some of them are actually using CMOS batteries and not real supercaps despite being sold as such (the one I linked is legitimately using a supercap). As for why we can’t use CMOS batteries on robots… only Woodie seems to know.

But…

If the battery is part of the computing device it is powering, it should be OK. I don’t see why an RTC would not count as a computing device; it does not move anything big enough to be considered an actuator on an FRC robot. However, you cannot use that CMOS battery to power other devices except through USB (or, reading more liberally, in parallel with a USB connection).

I don’t think so… Those RTC add-ons for raspberry pis don’t meet the definition of “integral to” for FRC purposes - which after a long look at the dictionary (Yes, I’m still angry about that) - the Q&A folks determined integral to mean the battery had to be sold with the product.

I SUPPOSE you could argue that the RTC module is an integrated COTS computing device with an included battery but that might be tough for some LRIs to swallow. Raspberry Pis do not come with RTCs as standard.

If any LRIs wants to clarify that they’ll allow a board with an IC and a battery on it to be plugged into a COTS computing device for the purposes of keeping power then PLEASE let me know. You’ll be opening up a whole new world for me explore.

Side note that is relevant to this thread: anyone interested in an RTC module for the RoboRIO (if it was deemed legal)? Maybe with breakout board/gyro functionality? It’s something we’ve lent thought to making and posting schematics/selling/etc.

Anybody looked at IEEE-1588 or PTP for the RoboRIO as of yet?

I found this note from NI which isn’t promising but I’m not sure if it is an issue given the length of time our robots stay on for:

http://digital.ni.com/public.nsf/allkb/12A4D90BB9C7AEFE86257DF900770DB7

PTP seems like it solves some of the issues with NTP on realtime or near-realtime systems.

Here’s a brief presentation of the topic that offers some comparisons: