Go to Post I learned about how FIRST really is about so much more than a robot competition, it is about team building and the individual. - Adel Hodiwala [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-02-2014, 21:41
blaisanx's Avatar
blaisanx blaisanx is offline
Registered User
FRC #1732
 
Join Date: Feb 2014
Location: Milwaukee
Posts: 3
blaisanx is an unknown quantity at this point
Exclamation CPU at 100%

Hi everyone,
Im a programmer from team 1732 and i need a bit of help with our cRio. even without having anything running, our CPU usage is at 100% we tried taking out all of our vision tracking code to no avail. is there any team that has had and fixed this problem or know how to fix it. any help would be appreciated.
Thanks
Reply With Quote
  #2   Spotlight this post!  
Unread 25-02-2014, 22:47
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: CPU at 100%

If you want to zip and post your project we could help look for the problem.

A common cause is a While loop that doesn't have a Wait inside to give the CPU time to breathe.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #3   Spotlight this post!  
Unread 26-02-2014, 12:01
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,579
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: CPU at 100%

Another common problem is a typo in a device reference that gets called repeatedly. This is shown by error messages on the driver station diagnostics screen.
Reply With Quote
  #4   Spotlight this post!  
Unread 26-02-2014, 16:34
pastelpony's Avatar
pastelpony pastelpony is offline
Programmer/Electrical
AKA: Zach M
FRC #3525 (Nuts and Bolts of Fury)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2013
Location: Waterbury, Connecticut
Posts: 152
pastelpony will become famous soon enough
Re: CPU at 100%

Try and see if there any devices that are programmed onto the bot but not in actual use (i.e. a solenoid or compressor.) For example, our bot's cRio completely crashed during a match because we forgot to take out references to a solenoid that was not actually on the bot and so the cRio was maxing out it's usage while trying to find it. Also, disable any safety configs that may be hooked up to devices in your code. Sometimes, an incorrect loop in Periodic Tasks can cause a cRio to max out.

Last edited by pastelpony : 26-02-2014 at 16:41.
Reply With Quote
  #5   Spotlight this post!  
Unread 03-03-2014, 23:07
joecloud joecloud is offline
Registered User
FRC #2805
Team Role: Programmer
 
Join Date: Apr 2013
Rookie Year: 2013
Location: Texas
Posts: 22
joecloud is an unknown quantity at this point
Re: CPU at 100%

Do you have pneumatics on the bot? Make sure in periodic tasks that your compressor code is not in it's own while loop, I did this and had the same issue with max cpu usage and robot joystick response being choppy.
VI's you are implementing that already have set refresh cycles with while loops can cause the cpu to hang if you put those VI's in another while loop (like the cotrol loop for the compressor).
__________________
--
Joe,
Programming: Team #2805
Reply With Quote
  #6   Spotlight this post!  
Unread 04-03-2014, 06:17
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,752
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: CPU at 100%

Unless it has been modified, the compressor loop has a 1000ms delay. If it ends immediately and you invoke it again in a loop, it will once again sleep that thread for 1000ms. This shouldn't cause 100% CPU usage.

If you do not see a loop without a delay, look for a loop with more work it is doing than time to do it in. If a loop sleeps for 20ms, but uses the CPU for 15ms, the CPU is guaranteed to be above 75% usage. If it runs for 20ms, the CPU is guaranteed to be at 100%.

If you cannot find the loop by looking, consider debugging your code using either the Performance Profiler or using the Elapsed Time VI. Both of these will give you precise numbers about how things are running. It is a lot like turning a light on in a dark room. It is amazing what you find sometimes.

Greg McKaskle
Reply With Quote
  #7   Spotlight this post!  
Unread 09-04-2014, 19:54
EDesbiens's Avatar
EDesbiens EDesbiens is offline
Passionate crackpot
AKA: Étienne Desbiens
FRC #5859 (i)
Team Role: College Student
 
Join Date: Apr 2014
Rookie Year: 2013
Location: Canton de Hatley, QC, Canada
Posts: 297
EDesbiens is a glorious beacon of lightEDesbiens is a glorious beacon of lightEDesbiens is a glorious beacon of lightEDesbiens is a glorious beacon of lightEDesbiens is a glorious beacon of lightEDesbiens is a glorious beacon of light
Re: CPU at 100%

We got the same problem... Just try to lower the number of global variables and make sure youre Crio cards are in order...
Reply With Quote
  #8   Spotlight this post!  
Unread 10-04-2014, 01:54
tcjinaz tcjinaz is offline
Tim
FRC #3853
Team Role: Mentor
 
Join Date: May 2011
Rookie Year: 2011
Location: Arizona
Posts: 206
tcjinaz has a spectacular aura abouttcjinaz has a spectacular aura about
Re: CPU at 100%

Why lower the number of global variables? Seems like the worst they can do to performance is stimulate some extra address calculation dances. The global memory page(s) is(are) probably not likely to get swapped out very often when the main line code is running.

The profiler is a wonderful thing. Pay large amounts of attention to Greg McKaskle; it's his job to know this stuff inside and out. We had a mediocre string to DevRev VI that was called way too often, The profiler highlighted the problem in just a minute or two of analysis. And none of us had seen that profiler before. (FIRST Mentor salary: seeing the lights go on in my lead programmer when he started looking at the profiler data and saw the problem about the same time I did).
__________________
Software Mentor
3853 Pridetronics[

Reply With Quote
  #9   Spotlight this post!  
Unread 10-04-2014, 07:16
EDesbiens's Avatar
EDesbiens EDesbiens is offline
Passionate crackpot
AKA: Étienne Desbiens
FRC #5859 (i)
Team Role: College Student
 
Join Date: Apr 2014
Rookie Year: 2013
Location: Canton de Hatley, QC, Canada
Posts: 297
EDesbiens is a glorious beacon of lightEDesbiens is a glorious beacon of lightEDesbiens is a glorious beacon of lightEDesbiens is a glorious beacon of lightEDesbiens is a glorious beacon of lightEDesbiens is a glorious beacon of light
Re: CPU at 100%

Quote:
Originally Posted by tcjinaz View Post
Why lower the number of global variables?
We had a lot of global variables and they started dead-locking... We changed some of them into local variables to avoid dead-locks.
Reply With Quote
  #10   Spotlight this post!  
Unread 11-04-2014, 23:58
tcjinaz tcjinaz is offline
Tim
FRC #3853
Team Role: Mentor
 
Join Date: May 2011
Rookie Year: 2011
Location: Arizona
Posts: 206
tcjinaz has a spectacular aura abouttcjinaz has a spectacular aura about
Re: CPU at 100%

Quote:
Originally Posted by EDesbiens View Post
We had a lot of global variables and they started dead-locking... We changed some of them into local variables to avoid dead-locks.
You were writing globals from multiple places? If so, there are some other ways of managing those sorts of communications. They're not in my toolkit today, look for semaphores and queues and the like. And probably you fixed it in the whole with local variables (empirical observations are important).
__________________
Software Mentor
3853 Pridetronics[

Reply With Quote
Reply


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 20: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