OCCRA
Go to Post Honesty and integrity should always be taken seriously. It's the lubrication that makes the world go round. - rsisk [more]
Home
Go Back   Chief Delphi > CD-Media > Photos
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

photos

papers

everything



Time flies when you're having fun... with an RTC on the RoboRIO.

marshall

By: marshall
New: 08-09-2017 09:41 PM
Updated: 08-09-2017 09:41 PM
Views: 1143 times


Time flies when you're having fun... with an RTC on the RoboRIO.

Project is here:
https://github.com/FRC900/rtc-bq32k-rRIO

Use at your own risk obviously. Do you really need to be warned not to put code on your robot written by Marshall?

Also, consult an LRI if you obtain an NTP correction for longer than 4 hours.

Recent Viewers

  • Guest

Discussion

view entire thread

Reply

08-10-2017 03:42 AM

BornaE


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

10/10



08-10-2017 06:34 AM

cbale2000


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Pardon my ignorance, but the purpose of this is what?



08-10-2017 08:13 AM

marshall


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by cbale2000 View Post
Pardon my ignorance, but the purpose of this is what?
Keeping time of course. It's an RTC module.



08-10-2017 08:36 AM

phurley67


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by cbale2000 View Post
Pardon my ignorance, but the purpose of this is what?
The RoboRIO does not have a RTC (calendar/wall time clock). It normally gets the correct time from the driver's station, but there are use cases where this might not happen and you still want to create logs with useful timestamps, a RTC (real time clock) is a good way to handle the problem if you do not have (or cannot depend on) internet connectivity.



08-10-2017 09:28 AM

cbale2000


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by phurley67 View Post
The RoboRIO does not have a RTC (calendar/wall time clock). It normally gets the correct time from the driver's station, but there are use cases where this might not happen and you still want to create logs with useful timestamps, a RTC (real time clock) is a good way to handle the problem if you do not have (or cannot depend on) internet connectivity.
Interesting, I was not aware of this. Are there cases aside from data logging that this could benefit as well? Say time-based robot actions (autonomous, etc.)? Is there enough variance in the DS-acquired time that there would be any benefits to this for anything aside from logs?



08-10-2017 09:36 AM

marshall


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by cbale2000 View Post
Interesting, I was not aware of this. Are there cases aside from data logging that this could benefit as well? Say time-based robot actions (autonomous, etc.)? Is there enough variance in the DS-acquired time that there would be any benefits to this for anything aside from logs?
Maybe.



08-10-2017 10:03 AM

TimTheGreat


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by cbale2000 View Post
Say time-based robot actions (autonomous, etc.)? Is there enough variance in the DS-acquired time that there would be any benefits to this for anything aside from logs?
Probably not, because most of the things you care about have to do with the [i]change[i] in time, rather than the time itself. So as long as you have a base number to say 'this is the start of the program', then everything past there will be in reference to that start number.

Knowing the 'exact' time is really only useful for logging, but even then, not really useful. Knowing that the robot finished autonomous at 11:33:22.879 is (to me) less useful than knowing it finished 11.3 seconds into autonomous



08-10-2017 10:04 AM

TimTheGreat


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by phurley67 View Post
useful timestamps
1) Why are exact timestamps useful?

2) Why are relative timestamps not useful?



08-10-2017 10:21 AM

marshall


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by TimTheGreat View Post
1) Why are exact timestamps useful?

2) Why are relative timestamps not useful?
Both are useful. They aren't mutually exclusive.



08-10-2017 10:25 AM

techhelpbb


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Does that RTC module have a battery?

If so probably should check the battery rules.

EDIT: I see that is a super capacitor.
So no battery issue.
http://www.newark.com/kemet/fc0v474z...smd/dp/18X4840



08-10-2017 10:28 AM

marshall


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by techhelpbb View Post
Does that RTC module have a battery?

If so probably should check the battery rules.

EDIT: I see that is a super capacitor.
So no battery issue.
http://www.newark.com/kemet/fc0v474z...smd/dp/18X4840
You read the friendly manual... Excellent.



08-10-2017 10:31 AM

techhelpbb


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by marshall View Post
You read the friendly manual... Excellent.
Have you tried fully discharging that capacitor then connecting it and turning on the RoboRio?

I don't see a charger circuit schematic.



08-10-2017 10:36 AM

marshall


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by techhelpbb View Post
Have you tried fully discharging that capacitor then connecting it and turning on the RoboRio?

I don't see a charger circuit schematic.
Ohh! Good question! So, my code changes to the stock module were to enable the trickle charge setting for the RTC (without all of the device tree shenanigans). It has some internal bits to flip to make that work:



Image is from the TI data sheet for the BQ32000.

I'm still testing all of this so it really is "use at your own risk" right now.

Because someone is going to ask: I wasn't happy with the charge rate on the diode side above so I went the other route.



08-10-2017 10:38 AM

techhelpbb


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by marshall View Post
Ohh! Good question! So, my code changes to the stock module were to enable the trickle charge setting for the RTC. It has some internal bits to flip to make that work:



I'm still testing all of this so it really is "use at your own risk" right now.
Positive feedback left - you've taken great initiative - love to see this work out.



08-10-2017 10:40 AM

Jon Stratis


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by marshall View Post
You read the friendly manual... Excellent.
I would recommend putting a label on it that says "Not a Battery"

In all seriousness, I had wondered the same thing, how you were persisting the clock through power outages, and had to go take a look myself earlier. I may have missed it in the documentation, how long will the clock persist once the robot is turned off?

Quote:
Originally Posted by TimTheGreat View Post
1) Why are exact timestamps useful?

2) Why are relative timestamps not useful?
There are situations where power may be inadvertently cut to the RoboRio. Even if it's for a fraction of a second, if it's enough to cause the RoboRio to reboot the relative timestamps may not give you what you want. Further, if you're trying to track down an issue at the end of the day and have video showing it occurring in different matches, having exact timestamps can let you more easily isolate the different occurrences.

And looking at non-FRC robot related usage, exact timestamps are pretty much critical for many applications. When a user calls in to complain that "something bad" happened with an application, many times your first question (after ascertaining that it really was "something bad") is going to be when did it occur. Then you can go to the logs, search the timeframe the user gives (plus or minus half an hour because users aren't always the most accurate people) for the user's ID and figure out exactly what happened and why. Relative timestamps are pretty useless in many professional applications.



08-10-2017 10:48 AM

marshall


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by Jon Stratis View Post
how long will the clock persist once the robot is turned off?
Testing this now. I'll have an update once I know. I know it can handle 4 hours but I suspect 12 is likely.



08-10-2017 10:52 AM

GeeTwo


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by techhelpbb View Post
Does that RTC module have a battery?

If so probably should check the battery rules.

EDIT: I see that is a super capacitor.
So no battery issue.
http://www.newark.com/kemet/fc0v474z...smd/dp/18X4840
Even if it had a battery, it should be legal unless Q&A or other authority says that an RTC is not a computing device.

Quote:
Originally Posted by 2017 Game Manual, last paragraph of R37
Additionally, batteries integral to and part of a COTS computing device or self-contained camera are also permitted (e.g. laptop batteries, GoPro style camera, etc.), provided they’re only used to power the COTS computing device and any peripheral COTS USB input devices connected to the COTS computing device and they are securely fastened to the ROBOT.
Well, you would need to secure the RTC a lot better than in the picture.



08-10-2017 10:53 AM

Jon Stratis


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

So in other words... longer than a team could really need at a competition. Set the time first thing in the morning, then don't worry about it the rest of the day. Nice!

And really, it would be possible to take it off the roboRio and plug it into a small battery pack to persist overnight at competitions if you really wanted to. That wouldn't even be that difficult.



08-10-2017 10:59 AM

techhelpbb


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by GeeTwo View Post
Even if it had a battery, it should be legal unless Q&A or other authority says that an RTC is not a computing device.

Well, you would need to secure the RTC a lot better than in the picture.
This supercap solution is just a bit less likely to get you held up as people start asking questions like: was the battery shipped with the RTC module?

Always wondered if inspectors would catch a Dallas Semiconductor RTC chip. The 1/4" tall package with the litium coin cells potted in:

http://www.mcamafia.de/mcapage0/dsrework.htm



08-10-2017 11:24 AM

marshall


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by GeeTwo View Post
Even if it had a battery, it should be legal unless Q&A or other authority says that an RTC is not a computing device.
I tried looking up RTC in Meriam-websters but I couldn't find it.*

I would love to see this tested with the Q&A.

*Yes, I'm still mad.



08-10-2017 12:16 PM

TimTheGreat


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by Jon Stratis View Post
There are situations where power may be inadvertently cut to the RoboRio. Even if it's for a fraction of a second, if it's enough to cause the RoboRio to reboot the relative timestamps may not give you what you want. Further, if you're trying to track down an issue at the end of the day and have video showing it occurring in different matches, having exact timestamps can let you more easily isolate the different occurrences.

And looking at non-FRC robot related usage, exact timestamps are pretty much critical for many applications. When a user calls in to complain that "something bad" happened with an application, many times your first question (after ascertaining that it really was "something bad") is going to be when did it occur. Then you can go to the logs, search the timeframe the user gives (plus or minus half an hour because users aren't always the most accurate people) for the user's ID and figure out exactly what happened and why. Relative timestamps are pretty useless in many professional applications.
Yeah I know that a realtime is useful for non-FRC application. I meant in FRC. The matching timestamp to video footage is a good example. I hadn't thought of that.



08-10-2017 12:41 PM

phurley67


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

My primary use case would be for going through our multiple log files and (somewhat) easily determining which were from which match, if we failed to pull them and log immediately after a match.

Saw a thread about getting the match info from the driver station, but have not had any of the kids pursue that yet -- it is also difficult to test without access to an FMS. Ideally the RIO would know when it was connected to the FMS and what match it was, and log files could be labeled as such.



08-10-2017 12:55 PM

Jjmase123


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

What other use cases can you think of, in FRC, for having an RTC module?



08-10-2017 01:28 PM

PayneTrain


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

how is this going to help you screw over teams when out of district

ill hang up and listen, roll tide



08-10-2017 01:30 PM

ngreen


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

This RTC could help with syncing issue in the other thread with the RPi, I assume. Although times still have to be synchronized at some point and with the discussion about how long it can stay unpowered I guess still somewhat frequently, though less than with the virtual RTC on the RIO.

In the spirit of the thread and because it will probably be the only chance I have to tell this, I'd been told an interesting RTC story from a former boss. It happened back before they were integrated and the first IBM-compatible RTC cards were becoming available. The chemist telling the story was building an autotitrator which would dispense reagents for various times. So he bought one, but couldn't get it to dispense correctly, it'd run too long or not. He thought something was wrong with the driver and he contacted Intel (or IBM -- I forget this detail) and they sent him everything to look at. He found that it was only capable of integer seconds (and not fractional seconds), and when he wanted 1.5 s dispensing the driver couldn't. So he rewrote the driver so that it could and shared it back with the Intel engineer. Later, he heard back from the engineer. Many clients with Lotus 123 (and communication software) were having problems that went away using this new driver. The problem was likely a divide-by-zero, with elapsed time in the denominator. They sent him a math co-processor chip and some other hardware as a thank you. He understood that several engineers were devoted full time to tracking down the problem with Lotus, but he was happy enough with the reward, and he got to put his name in it for distribution.



08-10-2017 03:00 PM

Tom Line


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Interesting. Am I right in thinking you may be using this to sync to another computer for potential target tracking?



08-10-2017 03:24 PM

marshall


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by Tom Line View Post
Interesting. Am I right in thinking you may be using this to sync to another computer for potential target tracking?
More computers is definitely right. Target tracking is so 2016 though.



08-10-2017 08:55 PM

GeeTwo


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by marshall View Post
More computers is definitely right. Target tracking is so 2016 though.
OK, I'm the guy who challenged the FIRST Engineers to ask WWZDhttps://www.chiefdelphi.com/forums/s...30#post1693230 (What Would the Zebracorns Do?), so I have doomed myself to ask WAZD? (What Are the Zebracorns Doing?).

What calculations require more capacity than a RoboRIO, and will be of tactical or strategic use when performed real time on board an FRC robot, which are not "target tracking"?

This is not the order I thought of things, but sorted roughly in "anybody could think of this" to "only the Zebracorns or Douglas Adams could think of this" (I don't claim to have reached that point): I also was hoping to get this posted within a very few hours of seeing Marshall's post, so I'm sure I'll come up with more stuff over the coming days, and that there is the very real possibility that I will miss the actual answer completely.
  1. Processing LIDAR data: I consider this to also fall under "Target Tracking".
  2. Deep Learning target identification (whether cameras, LIDAR, or another sensor): again, I consider this to fall under "Target Tracking".
  3. Autonomous (or hybrid teleop/HT) route planning around field obstacles: With suitable pre-calculation, this should be reducible to something that would fit on the RoboRIO; not the answer.
  4. Autonomous (or HT) route planning around a combination of field obstacles and the other five robots: While this is probably beyond a RoboRIO, so is the determination of the location of the other five robots. If this were the answer, "target tracking" would still be a majority part of the real time problem, so I consider this to be "not an answer".
  5. Something along the lines of Luke's "targeting computer" in A New Hope: It can not only identify targets, but once it does, it can dynamically calculate firing solutions to it and give the driver/operator the option of executing that plan. This is the least twisted thing I came up with which was sufficiently beyond "target tracking" that I'll consider it a possibility.
  6. An advance AI (Artificial Intelligence) robot which does not require a driver or operator; it is driven by strategic voice direction from the drive coach. A truly scary possibility, but something I expect from FRC900 in the not too distant future.
  7. A fully AI robot which can run a whole match in autonomous, leaving the three drive team members behind the polycarb with nothing to do. Let me comment on this with one word: Skynet.



08-10-2017 11:22 PM

Cash4587


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Couldn't this be used to constantly adjust your vision code based on the time of day and amount of sunlight on Einstein? I mean I assume you could potentially do that without it but... it's a thought.



08-11-2017 06:35 AM

marshall


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by Cash4587 View Post
Couldn't this be used to constantly adjust your vision code based on the time of day and amount of sunlight on Einstein? I mean I assume you could potentially do that without it but... it's a thought.
If we were going to do this then we would likely use an Ambient Light Sensor because while we can predict the location of the sun, we can't predict the weather. There are also ways to filter for this in code.



08-11-2017 06:58 AM

cbale2000


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by GeeTwo View Post
...A fully AI robot which can run a whole match in autonomous, leaving the three drive team members behind the polycarb with nothing to do. Let me comment on this with one word: Skynet.
This is the dream right here.



08-11-2017 07:14 AM

marshall


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by cbale2000 View Post
This is the dream right here.
One of our students is spending some of his time this summer playing with COTS neural interfaces so those drivers might still have something to do.



08-11-2017 07:44 AM

KJaget


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by marshall View Post
If we were going to do this then we would likely use an Ambient Light Sensor because while we can predict the location of the sun, we can't predict the weather.
Not with that attitude you won't.



08-11-2017 07:55 AM

marshall


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by KJaget View Post
Not with that attitude you won't.
I mean... https://github.com/justin-kang/ROS-Weather seems to exist.



08-11-2017 07:57 AM

Michael Hill


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Does this have to do with setting up consistent timing on vision co-processors? Like setting up an NTP server on the Rio for time stamping frames?



08-11-2017 08:03 AM

Forrest_Hurley


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by marshall View Post
One of our students is spending some of his time this summer playing with COTS neural interfaces so those drivers might still have something to do.
In the realm of neural interfaces, you can get much more responsiveness with a little bit of non-invasive brain surgery. I have to disagree with Marshall on its usefulness in two or three years once we have a fully autonomous robot. Direct brain-computer interfaces are much more useful right now, to offload some of the high level decision making and vision processing to a human.



08-11-2017 08:08 AM

KJaget


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by GeeTwo View Post
Autonomous (or HT) route planning around a combination of field obstacles and the other five robots: While this is probably beyond a RoboRIO, so is the determination of the location of the other five robots.
Hmmm



08-11-2017 08:11 AM

marshall


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by Forrest_Hurley View Post
In the realm of neural interfaces, you can get much more responsiveness with a little bit of non-invasive brain surgery. I have to disagree with Marshall on its usefulness in two or three years once we have a fully autonomous robot. Direct brain-computer interfaces are much more useful right now, to offload some of the high level decision making and vision processing to a human.
Frank... This. This is what you'll need a new rule for.



08-11-2017 09:23 AM

meg


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

Quote:
Originally Posted by Forrest_Hurley View Post
In the realm of neural interfaces, you can get much more responsiveness with a little bit of non-invasive brain surgery. I have to disagree with Marshall on its usefulness in two or three years once we have a fully autonomous robot. Direct brain-computer interfaces are much more useful right now, to offload some of the high level decision making and vision processing to a human.

We did consider letting him try. It just didn't seem safe -- it turns out its very hard to find a sterile space in a robotics lab...



08-11-2017 09:26 AM

techhelpbb


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

https://shop.openbci.com/products/ultracortex-mark-iv

I know where you are thinking .

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2921719/



08-14-2017 08:09 AM

marshall


Unread Re: pic: Time flies when you're having fun... with an RTC on the RoboRIO.

The voltage on the super cap was measured at a peak of about 3.2v while connected to the rRIO and has dropped to 2.4v being disconnected after 72 hours. Below 2v it will likely lose the time and 72 hours is FAR beyond what I was hoping for. It seems to have lost less than 1 second being disconnected. I'm quite happy with this.



view entire thread

Reply
previous
next

Tags

loading ...



All times are GMT -5. The time now is 10:12 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi