Go to Post -Best FIRST Robot: One that Makes it to Competition - Conor Ryan [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 27-01-2009, 16:18
Elliot Swart's Avatar
Elliot Swart Elliot Swart is offline
Registered User
FRC #0192 (Gunn Robotics Team)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Palo Alto, CA
Posts: 7
Elliot Swart is an unknown quantity at this point
High CPU Usage in LabVIEW even with Basic Code

Our team has been having trouble with excessive CPU utilization of the basic FIRST supplied VI's. Even the basic code with vision turned off when deployed (not in debug mode), uses up 60% of the processor. Reading analog values and setting PWM outputs on the FPGA seems to be nearly as demanding as image processing. Given that I/O was handled easily on the old PIC, I assume there must be something wrong, either with the FRC libraries or with my teams specific version of them. I was wondering if anyone has an idea on how to fix this, and if this is a problem for other teams.

Also, when the CPU load is high, we get intermittent "no code" displays on the driver station
  #2   Spotlight this post!  
Unread 27-01-2009, 17:10
jerry w's Avatar
jerry w jerry w is offline
Free Agent Mentor
no team (Team Krunch)
Team Role: Engineer
 
Join Date: Nov 2003
Rookie Year: 2002
Location: dunedin fl
Posts: 113
jerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud ofjerry w has much to be proud of
Re: High CPU Usage in LabVIEW even with Basic Code

Quote:
Originally Posted by Elliot Swart View Post
Our team has been having trouble with excessive CPU utilization of the basic FIRST supplied VI's. Even the basic code with vision turned off when deployed (not in debug mode), uses up 60% of the processor. Reading analog values and setting PWM outputs on the FPGA seems to be nearly as demanding as image processing. Given that I/O was handled easily on the old PIC, I assume there must be something wrong, either with the FRC libraries or with my teams specific version of them. I was wondering if anyone has an idea on how to fix this, and if this is a problem for other teams.

Also, when the CPU load is high, we get intermittent "no code" displays on the driver station
The symptoms you describe are those of unrestricted while-loops. In labview, the processor loves while loops. It will run them as often as it can. sometimes nothing else gets a chance to run, because the while loop is busy.
You should examine each while-loop in your code to make sure that it contains a timed element. An example is the one waiting for a camera. one waits for the drivers station message.
You can simply insert a wait-timer into a loop so that the processor will pause to catch its breath. While paused, the rest of your parallel code gets a chance to run.
Don't pause too long, or your sequence of code steps will now take too long. for the robot, you may find that a 1 ms pause is enough to let the processor breathe.
Not all loops need to pause, since some are very quick to finish. but continuous parallel loops are the ones to check.

Jerry
team-79 beta tester
__________________
Happiest when people tell the truth... However, I am blessed with many friends.
  #3   Spotlight this post!  
Unread 27-01-2009, 17:32
Analog's Avatar
Analog Analog is offline
Registered User
AKA: Bob Most
FRC #2619 (The Charge)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2008
Location: Midland, Michigan
Posts: 53
Analog will become famous soon enoughAnalog will become famous soon enough
Re: High CPU Usage in LabVIEW even with Basic Code

May I inquire on how you know what the CPU usage is in real time?

  #4   Spotlight this post!  
Unread 27-01-2009, 17:53
Elliot Swart's Avatar
Elliot Swart Elliot Swart is offline
Registered User
FRC #0192 (Gunn Robotics Team)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Palo Alto, CA
Posts: 7
Elliot Swart is an unknown quantity at this point
Re: High CPU Usage in LabVIEW even with Basic Code

I can find out my real time CPU usage by going into tools > real time module > system manager, and then checking the CPU monitor box.

I know I have no untimed while loops because in the profiler tool, all my run #'s are within a normal range (not like one would expect with untimed loops). I am wondering if the very high CPU utilization is normal, given that even the basic code with no vision causes a 60% load
  #5   Spotlight this post!  
Unread 27-01-2009, 20:48
Analog's Avatar
Analog Analog is offline
Registered User
AKA: Bob Most
FRC #2619 (The Charge)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2008
Location: Midland, Michigan
Posts: 53
Analog will become famous soon enoughAnalog will become famous soon enough
Re: High CPU Usage in LabVIEW even with Basic Code

Quote:
Originally Posted by Elliot Swart View Post
I can find out my real time CPU usage by going into tools > real time module > system manager, and then checking the CPU monitor box.

I know I have no untimed while loops because in the profiler tool, all my run #'s are within a normal range (not like one would expect with untimed loops). I am wondering if the very high CPU utilization is normal, given that even the basic code with no vision causes a 60% load
So this is really only a Labview ability?
  #6   Spotlight this post!  
Unread 28-01-2009, 08:44
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,756
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: High CPU Usage in LabVIEW even with Basic Code

The System Manager is very useful, but its default setup adds a huge amount of its own overhead. After opening the system manager, click on the VIs tab (I think that is the name), the second one. Turn off the checkbox that displays VI state. Now go back to the first tab and click on the CPU and perhaps off the disk. The important one is the VI state as that will constantly visit every VI in memory to tell you if they are idle, running, etc. Like I said, that adds a huge amount of overhead.

I think at that point you should see the CPU usage being around 5.5 or so when no code is running, and around 12 to 15 without camera when your app is running. Clearly, the more panels you have open that are displaying data, the more the number will climb.

The equivalent of this tool for C/C++ is to connect the serial cable and use something similar to ps, don't remember exactly what the command is. There may be a similar tool build into Wind River, not sure.

Greg McKaskle
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
pic: Aiming High, even before 2006 FIRST Aim High RoboMadi Extra Discussion 7 29-10-2012 12:23
Basic Labview Programming Questions comphappy NI LabVIEW 20 13-10-2008 18:29
syntax error in code that i have never even seen before: HELP! pbhead Programming 10 24-02-2006 14:22
even simple autonomous code doesn't work?? colman77 Programming 4 17-02-2006 23:58
Whats with the Serout usage? PyroPhin Programming 2 12-01-2003 01:01


All times are GMT -5. The time now is 02:33.

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