Go to Post A good robot with great strategy beats a great robot with good strategy. - Brian Maher [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-08-2012, 12:52
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,011
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
realtime runtime code throughput margin monitoring


I'm wondering how many teams add runtime throughput and scheduling monitoring in each thread (or parallel loop) of their practice or even competition deployed code.

Something like the following
Code:
* thread start *
t0=system_microseconds();
if (t0-t1)>TBD1 err1++; //scheduling monitor
t1=t0;
* put thread code here *
if (system_microseconds()-t0)>TBD2 err2++; //thread throughput margin monitor
* thread end *
"err1" and 'err2" could be displayed on the dashboard for each thread.


  #2   Spotlight this post!  
Unread 09-08-2012, 19:34
Todd's Avatar
Todd Todd is offline
Software Engineer
FRC #1071 (Team Max)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Connecticut, Wolcott
Posts: 51
Todd is just really niceTodd is just really niceTodd is just really niceTodd is just really niceTodd is just really nice
Re: realtime runtime code throughput margin monitoring

Quote:
Originally Posted by Ether View Post
I'm wondering how many teams add runtime throughput and scheduling monitoring in each thread (or parallel loop) of their practice or even competition deployed code.
I'm planning on going through this exercise with our students next year. I meant to this year, but we fell short of time.

As far as I see it's the next step toward system stability after we work out a few more of our selective failure cases.
  #3   Spotlight this post!  
Unread 09-08-2012, 20:11
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,113
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: realtime runtime code throughput margin monitoring

We had this in our code, to a certain extent. We sent loop execution times to our custom dashboard, where they would be monitored and used to check that everything was running okay. If our main loop ever ran much over 20 ms per iteration, then we'd be worried (the vision loop ideally would be at about 100 ms). Code for reference.
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
  #4   Spotlight this post!  
Unread 09-08-2012, 20:25
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,011
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: realtime runtime code throughput margin monitoring

Quote:
Originally Posted by plnyyanks View Post
We sent loop execution times to our custom dashboard, where they would be monitored and used to check that everything was running okay.
Were they monitored by software in the dashboard which counted and flagged individual outliers, or did you mean they were monitored by the driver (whenever he had a chance to glance at the screen)?


  #5   Spotlight this post!  
Unread 09-08-2012, 20:38
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: realtime runtime code throughput margin monitoring

The LV template project contains a folder called Support Code. In it is a VI called Elapsed TImes.vi. Placing it into any loop or recurring code will result in a table of elapsed times being updated to calculate and show the period of the calls. The easiest way to view the times is to open the Elapsed Times panel. This is typically used for debugging and later deleted, but could be transmitted back to dashboard if a team wanted. I have no idea how many times it was used.

Greg McKaskle
  #6   Spotlight this post!  
Unread 09-08-2012, 20:52
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,011
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: realtime runtime code throughput margin monitoring

Quote:
Originally Posted by Greg McKaskle View Post
The LV template project contains a folder called Support Code. In it is a VI called Elapsed TImes.vi. Placing it into any loop or recurring code will result in a table of elapsed times being updated to calculate and show the period of the calls. The easiest way to view the times is to open the Elapsed Times panel. This is typically used for debugging and later deleted, but could be transmitted back to dashboard if a team wanted. I have no idea how many times it was used.
Greg, do you know roughly how much runtime overhead is incurred by this? e.g. Could it reasonably be put into all the parallel tasks in an FRC robot project?


  #7   Spotlight this post!  
Unread 09-08-2012, 22:13
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: realtime runtime code throughput margin monitoring

Quote:
Originally Posted by Ether View Post
Greg, do you know roughly how much runtime overhead is incurred by this? e.g. Could it reasonably be put into all the parallel tasks in an FRC robot project?


We ran a slightly modified Elapsed Times in our robot code, and it wasn't the biggest cause of CPU usage (sorta...)

The biggest cause of CPU usage while not permanently deployed seems to be updating VI front panels. If you have enough inclusions of Elapsed Times, it seems to update the front panel array every time it changes (Every tick of every loop). If you create a slower loop somewhere (we ran ours at 75ms I think) to read the array of times from Elapsed Times, it is significantly less CPU hungry than simply opening Elapsed Times. We used the same loop to read the CPU load cluster and print it to the same debug screen, and that information (CPU usage by thread priority) was also extremely useful.

It was a very useful VI. We had it in about 10 or so tasks.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #8   Spotlight this post!  
Unread 10-08-2012, 07:29
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: realtime runtime code throughput margin monitoring

Quote:
If you create a slower loop ...
Good to know. The panel was the simplest way to see the data, but it will transmit all modifications to to the host each call, and the array is constantly changing. Maybe something like that will allow it to be in the framework by default.

Thanks.
Greg McKaskle
  #9   Spotlight this post!  
Unread 09-08-2012, 20:48
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,113
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: realtime runtime code throughput margin monitoring

Quote:
Originally Posted by Ether View Post
Were they monitored by software in the dashboard which counted and flagged individual outliers, or did you mean they were monitored by the driver (whenever he had a chance to glance at the screen)?
The latter. Although, while debugging, writing, and tuning code, they were watched very closely and we didn't let the code go into "production" until functionality was there, as well as low loop times/CPU usage.

Thankfully, it was never necessary to actively monitor these, although having software do it is a good idea for next year.
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
  #10   Spotlight this post!  
Unread 09-08-2012, 20:55
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,011
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: realtime runtime code throughput margin monitoring

Quote:
Originally Posted by plnyyanks View Post
while debugging, writing, and tuning code, they were watched very closely
How often was your dashboard screen display updated?


  #11   Spotlight this post!  
Unread 09-08-2012, 21:05
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,113
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: realtime runtime code throughput margin monitoring

Quote:
Originally Posted by Ether View Post
How often was your dashboard screen display updated?
Not all that often (I don't remember, but maybe ~200 ms). Which, of course, now that I think about it, doesn't really help catch situations like you're thinking of... Anyway, it's a good idea to implement next year.
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
  #12   Spotlight this post!  
Unread 09-08-2012, 21:35
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: realtime runtime code throughput margin monitoring

I don't have an overhead number, but I have seen it raise the CPU. The code is in about six loops in the Driver Station and I saw no need to delete it. I decided not to leave it in the default robot code loops and chose to let teams do it for themselves. I hope to get around to adding some high-water mark and stats to it and perhaps I can find a way to leave it in all loops. Time will tell.

Greg McKaskle
  #13   Spotlight this post!  
Unread 09-08-2012, 21:59
JamesTerm's Avatar
JamesTerm JamesTerm is offline
Terminator
AKA: James Killian
FRC #3481 (Bronc Botz)
Team Role: Engineer
 
Join Date: May 2011
Rookie Year: 2010
Location: San Antonio, Texas
Posts: 298
JamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to behold
Re: realtime runtime code throughput margin monitoring

Quote:
Originally Posted by Ether View Post

I'm wondering how many teams add runtime throughput and scheduling monitoring in each thread (or parallel loop) of their practice or even competition deployed code.
[/i]

I've taken a low-tech solution to this type of task... where I use printf statements that can be turned on by ftp of lua script... I get roughly 10-11ms iterations of a single thread (I cannot see the need for any more). All functions work with a delta time (double dTime_s) parameter to deal with uneven slices of time... this way I need not do anything fancy with the Sleep(10).

For the numbers I find interesting I use a separate homemade app to read the text and translate into a bmp file graph. So it's paritally real-time... partially post process.
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 00: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