LabVIEW Code Questions

cancel
Showing results for 
Search instead for 
Did you mean: 

New Network Tables -- Issue with time between systems preventing value writes

NT appears to use time to decide which values are newest. Time is different among different computers.  This isn't an issue unless multiple computers try to write to the same entry.  Only the computer with the largest time value can write.  For PC/WPILIB it appears to use microseconds since Jan 1,1970 UTC.  Raspberry PI may be similar.  For PC/LabVIEW it appears to use microseconds since Jan 1, 1904 wall time (maybe).  For the roboRIO/LabVIEW it appears to use FPGA time.  These are all quite different.  The problem also includes timezone and EST/DST offsets issues..  Attached is a zip file demonstrating the issue and providing one possible work around.  This work around may not be the best one.   See the read_me.txt file in the zip file for additional information.

0 Kudos
Message 1 of 6
(1,657 Views)

According to the network tables spec, time is supposed to be synchronized between server and clients. https://github.com/wpilibsuite/allwpilib/blob/main/ntcore/doc/networktables4.adoc#timestamps

0 Kudos
Message 2 of 6
(1,625 Views)

I did get a chance to read (skim) the NT4 specification.  Each client is supposed to maintain a time offset so it can send with timestamps that match the time on the NT server (robot).  It appears that the base time should be the FPGA time.  This makes sense because that is the time that is used most often in dealing with time.  The symptoms of the problem remain, but perhaps the source of the issue is the creation, maintenance, and application of this time offset.  I'll try and do some more debugging to track the source of the problem, but I don't have access to the documentation, prototypes (incclude files) of the DLL/SO files that are called by the NT4 LV library.  Let me know what additional information will help track this down.

0 Kudos
Message 3 of 6
(1,617 Views)

One additional detail. The clients that help demonstrate this issue are Shuffleboard running on a PC, and PhotonVision (java) running on a Raspberry PI 

0 Kudos
Message 4 of 6
(1,616 Views)

I did some more testing to confirm the issue.  This time with shuffleboard, smart dashboard, and LabVIEW dashboards and a run at startup robot program.  Same issue with the time - the clients are sending their local time, not their adjusted to server time. 

 

I looked through the NT VI and didn't see anywhere that the NT server was setting anything other than the FPGA time.  (There was one place in NT server where a global variable was set, but I changed that to see if anything changed and it didn't.)  I think that may mean that the issue is buried in the DLL/SO files or a DLL routine isn't being called that should be..  Sorry, I realize this isn't a lot of help.

 

Attached are my test programs, screen shots and additional notes.

0 Kudos
Message 5 of 6
(1,602 Views)

I heard that NI found the root cause of the issue, but I don't know what plans there are for an update. 

0 Kudos
Message 6 of 6
(1,541 Views)