Go to Post "You fogot the gears!!!!" - The_Gman [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 28-04-2015, 11:27
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 519
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Loop timing crio vs. roborio.

A few times this year, there have been programming posts, that seemed to lead me to believe the timing loops on the roborio are far less consistent than they were on the cRIO.

At TORC we log data to a .csv file every 100 milliseconds. Attached are sample match log files from 2014 crio based, and 2015 roborio based.

The 2014 data is pulled from a timed tasks control loop with a 50ms metronome timer, the 2015 data is pulled from a timed task control loop with a 20ms metronome timer. Labview picture attached.

The data from this year is all over the place as compared with the cRIO data.

We controlled our elevator with a home brew pid, so the students would learn how to pid, and not use the labview provided pid, but as typically is done, we ignored the delta-t as the loop time was to be consistent.

Which it was consistent enough to not give us issues with control, just not nearly as consistent as the crio.

discuss...

EDIT:
2014 Avg = 49.9796 with STD = 0.21929
2015 AVG = 19.67855 with STD = 3.797736
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	102
Size:	2.7 KB
ID:	18938  
Attached Files
File Type: xls 2014-cRIO-100006.xls (533.5 KB, 27 views)
File Type: xls 2015-RoboRIO-100125.xls (1.22 MB, 30 views)
__________________
The sooner we get behind schedule, the more time we have to catch up.


Last edited by tr6scott : 28-04-2015 at 13:37.
  #2   Spotlight this post!  
Unread 28-04-2015, 15:01
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,088
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Loop timing crio vs. roborio.



One XLS says "Loop Time" and the other says "Lag Time".

Do they mean different things? How was each measured?



Last edited by Ether : 28-04-2015 at 15:03.
  #3   Spotlight this post!  
Unread 28-04-2015, 15:07
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,572
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Loop timing crio vs. roborio.

Have you compared equal time periods, with similar code? Your data doesn't seem that much different then 358's with the cRIO. http://team358.org/files/programming...Everything.PDF
  #4   Spotlight this post!  
Unread 28-04-2015, 15:15
MrRoboSteve MrRoboSteve is offline
Mentor
AKA: Steve Peterson
FRC #3081 (Kennedy RoboEagles)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Bloomington, MN
Posts: 578
MrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond repute
Re: Loop timing crio vs. roborio.

FWIW, I teach our programmers (C++) to never depend on the grand loop timing in the robot, always using timers to calculate time offsets. There's no stated SLA around the timing, and I have always been concerned that behavior on the field would vary from tethered operation in a meaningful way.
__________________
2016-17 events: 10000 Lakes Regional, Northern Lights Regional, FTC Burnsville Qualifying Tournament

2011 - present · FRC 3081 Kennedy RoboEagles mentor
2013 - present · event volunteer at 10000 Lakes Regional, Northern Lights Regional, North Star Regional, Lake Superior Regional, Minnesota State Tournament, PNW District 4 Glacier Peak, MN FTC, CMP
http://twitter.com/MrRoboSteve · www.linkedin.com/in/speterson
  #5   Spotlight this post!  
Unread 28-04-2015, 16:03
wt200999's Avatar
wt200999 wt200999 is offline
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 325
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
Re: Loop timing crio vs. roborio.

The difference could be from quite a number of factors. The most obvious one would be the difference in the loop times. Another big factor is the difference in what is running in the background and how it is being scheduled.

You should expect jitter from using the "Wait Until Next ms Multiple", this is similar to the problem of using Thread.sleep() in Java. If you need more accurate timing you need to use a timed loop structure, which will also tell you if the loop runs too long and a couple of other useful things.

Along with the paper from 358 link, this paper from NI has some useful info on the wait functions in LabVIEW RT.
__________________
Programming in LabVIEW? Try VI Snippets!

FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -

Last edited by wt200999 : 28-04-2015 at 16:13. Reason: Thread.sleep() not Time.sleep()
  #6   Spotlight this post!  
Unread 28-04-2015, 16:09
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Loop timing crio vs. roborio.

I posted about an issue in the Java implementation here. The actual task was not using a hardware interrupt for timing, but rather Thread.sleep(). Is it possible that the 2015 LabVIEW code is doing something similarly non-optimal?
  #7   Spotlight this post!  
Unread 28-04-2015, 16:28
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 519
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Re: Loop timing crio vs. roborio.

Quote:
Originally Posted by Ether View Post


One XLS says "Loop Time" and the other says "Lag Time".

Do they mean different things? How was each measured?


Both Measured the same way as the shown in the snipit. Just different programmers from different years did the log heading text.

Both loops used the "Wait for next multiple" labview timer.

I had noticed this behavior when we were doing beta testing, and have not dug into much further. But wait, I forgot I published our 2014 code as part of the beta program, and we did get the logger working in linux os before publishing...

So attached is our 2014 code running on the roborio.

Avg = 49.95124
STD = 0.7159

Just seems like the RT scheduler in the roborio, is not as preemptive in scheduling the loop, as repetitive as the cRIO was.
Attached Files
File Type: xls 2014 Code Running on Roborio-100002.xls (340.5 KB, 3 views)
__________________
The sooner we get behind schedule, the more time we have to catch up.

  #8   Spotlight this post!  
Unread 28-04-2015, 16:42
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,532
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Loop timing crio vs. roborio.

Quote:
Originally Posted by Jared Russell View Post
I posted about an issue in the Java implementation here. The actual task was not using a hardware interrupt for timing, but rather Thread.sleep(). Is it possible that the 2015 LabVIEW code is doing something similarly non-optimal?
By design. As someone else already stated, the metronome, or 'wait' in Labview means 'execute no FASTER' than your set time. It does not enforce timing, and if enough CPU is used elsewhere the loop times will vary. Our CPU usage this year was around 65%, and we could count on the wait loops to be very consistent.

If you require accurate timing, a timed-loop structure will give you sub-millisecon d accuracy at the price of substantially higher CPU utilization.
  #9   Spotlight this post!  
Unread 28-04-2015, 16:49
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Loop timing crio vs. roborio.

The 50 ms data on the cRIO and the roboRIO don't seem significantly different. I'm leaning toward the theory that it's the faster rate that is giving you the unwanted variation in logged times.

Have you measured how long the 20 ms loop is actually taking? Exceeding the expected loop time will give "interesting" results when using a metronome.
  #10   Spotlight this post!  
Unread 28-04-2015, 18:06
ayeckley's Avatar
ayeckley ayeckley is offline
Registered User
AKA: Alex Yeckley
FRC #2252 (Mavericks)
Team Role: Mentor
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Sandusky, OH
Posts: 268
ayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond repute
Re: Loop timing crio vs. roborio.

Quote:
Originally Posted by Tom Line View Post
Our CPU usage this year was around 65%, and we could count on the wait loops to be very consistent.
Ditto the experience here. We experienced less "jitter" (probably not really the correct application of the term, but you get the picture) this year than we historically did with the cRIO. Sorry, no metrics to support that.
__________________

  #11   Spotlight this post!  
Unread 29-04-2015, 07:49
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 519
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Re: Loop timing crio vs. roborio.

Quote:
Originally Posted by Tom Line View Post
By design. As someone else already stated, the metronome, or 'wait' in Labview means 'execute no FASTER' than your set time.
Yet in all of the data the avg loop time is less than the set loop time. In the roborio 20ms loop time, there are loop times of 8,9 & 10ms.

This effectively, doubled the PID gains for these loops... Again we really did not see any issue with the elevator with stability.. and as MrRoboSteve pointed out it is probably a better solution to incorporate the delta-t at this high school level, just in case the field impacts the control.

We had no programmers with calc yet this year, so we used NXT lego line following example as the start of the conversation, and 3 weeks later, ended with the white paper on the SRX internal PID code. The elevator code ended up with a separate P gain for raising the elevator, and a lower P gain for lowering the elevator, along with the SRX "IZone" implemented. This gave a very quick reacting and stable control for the elevator system. The mechanical gear ratio went from 35:1 minicim at Waterford, to 20:1 CIM at Championships.
__________________
The sooner we get behind schedule, the more time we have to catch up.

  #12   Spotlight this post!  
Unread 29-04-2015, 13:55
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Loop timing crio vs. roborio.

Quote:
Originally Posted by tr6scott View Post
Yet in all of the data the avg loop time is less than the set loop time. In the roborio 20ms loop time, there are loop times of 8,9 & 10ms.
Are we looking at the same files? The "20 ms" roboRIO data shows many records with times in the high 20s and 30s, and some greater than 40 ms. I wasn't able to get them all to match up to show a clear smoking gun of simple timing jitter, and I'd still like to see how long the loop contents actually took to run.

Quote:
This effectively, doubled the PID gains for these loops...
The P term is unaffected by loop time. The I term would indeed be overrepresented with a shorter than expected loop time, but the D term would have a reduced effect.

Quote:
Again we really did not see any issue with the elevator with stability..
It appears that you were using the built-in SRX closed loop control, so any inconsistencies in your robot code's timing should be irrelevant.
  #13   Spotlight this post!  
Unread 30-04-2015, 10:17
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 519
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Re: Loop timing crio vs. roborio.

Quote:
Originally Posted by Alan Anderson View Post
Are we looking at the same files? The "20 ms" roboRIO data shows many records with times in the high 20s and 30s, and some greater than 40 ms. I wasn't able to get them all to match up to show a clear smoking gun of simple timing jitter, and I'd still like to see how long the loop contents actually took to run.
Look at the average and standard deviation data posted. All of the three files have an average that is less than the loop time programmed in the wait for next multiple.

Quote:
Originally Posted by Alan Anderson View Post
The P term is unaffected by loop time. The I term would indeed be overrepresented with a shorter than expected loop time, but the D term would have a reduced effect.
Had to look this up, but you are correct, there is no delta-t term in the P.

Quote:
Originally Posted by Alan Anderson View Post
It appears that you were using the built-in SRX closed loop control, so any inconsistencies in your robot code's timing should be irrelevant.
No, we did not even have a SRX on the bot. The point was we started the conversation and code with simple NXT solution and it finished with reviewing the SRX whitepaper on the internal PID code CTE published. We implemented the SRX "IZone" feature in Labview, and drove a talon SR via PWM. This whole paragraph, was probably off topic to the conversation at hand, but sometimes I work that way.

So the conversation at hand, is based on the averages for the loop time, and standard deviation from our 2014 code on a cRio, and our 2014 code on the roborio, in the same 50ms loop.

The cRio data:
2014 Avg = 49.9796 with STD = 0.21929

The roboRIO data:
2014 Avg = 49.95124 with STD = 0.7159

The deviation of the loop by the roboRio is a factor of 3.2646 less repetitive than the same code on the cRio.
__________________
The sooner we get behind schedule, the more time we have to catch up.

Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 06:21.

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