My vision processing is working almost flawlessly (yay!), but I came across an unexpected issue. I have a Kangaroo doing the actual processing. It publishes the data to Network Tables for the roboRio to use. In the middle of some testing, the Kangaroo died and I didn’t notice it. The robot just kept spinning. It took a while for me to notice the Kangaroo’s light wasn’t on. I figured if such a thing would happen that the code would stop running, being that I thought there would be no values in the table. It turns out it just keeps using the last chunk of data that was published. Is there a way to know when a table was last updated? I’m using Java.
You can add a field that the Kangaroo increments each time it updates the data, or a time stamp your code on the roboRIO can then check to see if the Kangaroo has posted an update.
Worth mentioning that NetworkTables 4.0 is out this year and has built in timestamps for every entry.
How are those generated and are they relative or absolute time entries?
They are relative time stamps. They are the result of a 10us timer from the operating system. There is a function to get what the current count is, and you could use that to turn the relative into an absolute.
That is the code that generates them. Also note they did exist in 3.0 as well, however they were only accessable from c++. Java is now accessable this year.
Man, C++ gets all the good stuff…
That’s because C++ is a real language that actually makes getting 2 values out from a function easy… :yikes:
Holistically, functions which return N things have N! ways to fail from errant data. From an OO perspective, combinations of native things should be represented by an encapsulating ‘thing’.
That’s why real Java devs don’t see this as a limitation. :deadhorse:
More seriously, if you’d like some help getting the Java side up to speed with the C++ side, I’ll likely have some time during the next dev cycle (i.e. next summer).