Go to Post Building things from scratch builds character. - davidthefat [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, 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,561
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
  #2   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: 575
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
  #3   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: 323
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()
  #4   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,077
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?
  #5   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,513
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.
  #6   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: 266
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.
__________________

  #7   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: 507
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.

  #8   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,112
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.
  #9   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: 507
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 05:12.

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