Go to Post We're not behind, the rest of the world is ahead! Yeah. Thats it. - Curtis Williams [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 Rating: Thread Rating: 5 votes, 5.00 average. Display Modes
  #16   Spotlight this post!  
Unread 29-01-2012, 22:25
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 6,991
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Worried about high CPU usage in CRIO

Quote:
Originally Posted by Chris_Elston View Post
Ok, I think I have attracted all the "power users" of Labview at CD in one post.
My role here is to balance that equation. What's the opposite of "power user?"
Quote:
Originally Posted by DominickC View Post
Wait, so you can string together multiple cRIO II's to get more processing power?
Yes, just as you can put a laptop (or even a desktop, I suppose) onto the robot as an auxiliary processor, under [R65]. But remember [R52] applies here as well.
__________________

I am N2IRZ - What's your callsign?
Reply With Quote
  #17   Spotlight this post!  
Unread 29-01-2012, 22:28
Thad House Thad House is offline
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,091
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: Worried about high CPU usage in CRIO

One thing i have noticed when running the code is that sending the data to the dashboard using the default code takes up alot of CPU resources. It the past when i have deleted that it freed up between 10 and 20% of the cpu resources. I havent tried it with this years code or the new Crio's. I will try this tomorrow when i get access to our robots.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
Reply With Quote
  #18   Spotlight this post!  
Unread 29-01-2012, 22:36
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,170
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
Re: Worried about high CPU usage in CRIO

Quote:
Originally Posted by sst.thad View Post
One thing i have noticed when running the code is that sending the data to the dashboard using the default code takes up alot of CPU resources. It the past when i have deleted that it freed up between 10 and 20% of the cpu resources. I havent tried it with this years code or the new Crio's. I will try this tomorrow when i get access to our robots.

We take over that default operation with our own dashboard sending code and send the data less often, more often than 10Hz is of questionable value
Reply With Quote
  #19   Spotlight this post!  
Unread 29-01-2012, 22:51
Thad House Thad House is offline
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,091
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: Worried about high CPU usage in CRIO

Quote:
Originally Posted by wireties View Post
We take over that default operation with our own dashboard sending code and send the data less often, more often than 10Hz is of questionable value
Last year we had so little code we sent it every teleop period, and it worked, but this year i know that will not be possible because of the amount of stuff we have to have. We will have to test how often we can send our dashboard, or we might not have it at all.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
Reply With Quote
  #20   Spotlight this post!  
Unread 30-01-2012, 00:59
SuperS_5's Avatar
SuperS_5 SuperS_5 is offline
[Certified LabVIEW Developer]
FRC #1219
 
Join Date: Dec 2010
Rookie Year: 2010
Location: Canada
Posts: 140
SuperS_5 will become famous soon enoughSuperS_5 will become famous soon enough
Re: Worried about high CPU usage in CRIO

Adding some code to my test project, when I was demonstrating for a local team, I kept killing the cRIO. (BTW the DoS bug in the network stack still exists.) I had to add some careful performance controls in my code to keep the CPU utilization down. (Partially my fault to begin with.) I was running between 65-75% CPU on the cRIO with nearly default code.

Previous years have not be a whole lot better, and normally saw these utilization numbers for most LabVIEW projects. The Vision loop was the worse, normally consuming whatever was remaining of the cRIO. The performance monitoring in LabVIEW is very useful in tracking down problems. A built project, running at start-up should take a bit less resources then just hitting the run button, since it is not running in debug mode.

PS. During my testing the other night, I saw some interesting metrics. I will have to dive into it tonight.
__________________
Mike B
Reply With Quote
  #21   Spotlight this post!  
Unread 30-01-2012, 20:02
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
Re: Worried about high CPU usage in CRIO

Now, I've placed this code within Periodic Tasks.vi. There are two more case structures similar to the two visible, and I've moved the axis value to Teleop.vi. Today, we were getting some infrequent watchdog errors which shut down our comms with the cRIO.

Just by looking at this image, is there a way to streamline the code? I had tried to do something similar to the second image with just the single case structure visible, wired to a joystick button. When the structure was false, it set motor outputs to 0. No matter what I did, it wouldn't work. (I followed it in debug mode, and it appeared that the command to set the motor output to -1 was being triggered, however nothing happened on our jags.)

Is there a conflict between the 500 millisecond timing and the 100 millisecond timing within the while loop?
Attached Thumbnails
Click image for larger version

Name:	periodic.JPG
Views:	61
Size:	114.3 KB
ID:	11637  Click image for larger version

Name:	case.JPG
Views:	41
Size:	16.6 KB
ID:	11638  
Reply With Quote
  #22   Spotlight this post!  
Unread 30-01-2012, 20: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,749
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: Worried about high CPU usage in CRIO

Quote:
Now, I've placed this code within ...
The image shows a single sleep of 100 and then in parallel, two loops that do unlimited I/O calls.

I'm assuming that the code shown is in the Periodic task with 100ms sleep. The issue is that when one of those buttons are pressed, the inner loop goes for 500ms with no sleep. That would likely cause a watchdog or other issue with CPU usage. After the inner loop completes, things would go back to normal.

If you place a 20ms delay within the loop, that will improve the CPU usage, but you will still have an issue in that for 500ms, the outer loop cannot run. I'd think that you can make a loop that starts on a message, like a notifier, then runs for 500ms and waits again and is independent of the others. You can then send the notifier from the teleop or other loops.

Greg McKaskle
Reply With Quote
  #23   Spotlight this post!  
Unread 30-01-2012, 20:52
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,749
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: Worried about high CPU usage in CRIO

I was able to look at the usage of the framework code a bit today.

I built a new framework, ran the code from the run button, and watched the CPU usage from the DS tab.

The disabled robot default usage on an 8-slot was about 25%. I ran the default teleop and the usage did not change. I ran the default auto, and the usage jumped to just under 50%. Odd, but it turns out that when the auto doesn't update the motors, they go into safety update, and I'm assuming the error messaging eats the CPU. I need to take more measurements tomorrow to be sure that the errors are the issue. But if the auto sets the motors, even setting them to 0 every 20 ms or so, the CPU usage stays at 25%.

Since this was default code, this was without video enabled, with no panels open except for Robot Main. The 8-slot was formatted without net console or CAN enabled.

Can anyone with higher CPU usage provide differences or code to go on?

Greg McKaskle
Reply With Quote
  #24   Spotlight this post!  
Unread 30-01-2012, 20:56
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,058
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: Worried about high CPU usage in CRIO


@DominickC: If you haven't already seen these two posts, they're worth reading:

http://www.chiefdelphi.com/forums/sh...96&postcount=3

http://www.chiefdelphi.com/forums/sh...21&postcount=6

Reply With Quote
  #25   Spotlight this post!  
Unread 30-01-2012, 21:00
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Worried about high CPU usage in CRIO

Having a high usage isn't necessarily bad. Well written code can consume 100% of the CPU but be squishy enough to not get in the way. For example, let vision consume whatever cycles happen to be left over, but prioritize it correctly so it doesn't consume cycles that aren't left over.

Also, it is really easy to rail the processor - any while loop without a delay will take care of your spare cycles immediately.

Do any of the power users have a favorite way to implement Dominick's code? If it doesn't need to run in parallel with itself, I typically do that with a single (Enum)Notifier with multiple loops.

Let me temper that with an admission: I haven't gone into serious depth with FRC LabVIEW since I started working at NI. Most of my FIRST LV experience is in FTC/FLL, and most of that was so far under the hood that I didn't know what road we were driving on...

Quote:
Originally Posted by DominickC View Post
Now, I've placed this code within Periodic Tasks.vi. There are two more case structures similar to the two visible, and I've moved the axis value to Teleop.vi. Today, we were getting some infrequent watchdog errors which shut down our comms with the cRIO.

Just by looking at this image, is there a way to streamline the code? I had tried to do something similar to the second image with just the single case structure visible, wired to a joystick button. When the structure was false, it set motor outputs to 0. No matter what I did, it wouldn't work. (I followed it in debug mode, and it appeared that the command to set the motor output to -1 was being triggered, however nothing happened on our jags.)

Is there a conflict between the 500 millisecond timing and the 100 millisecond timing within the while loop?
I found a few spots in your code that you might want to look at. Once you fix the first error, I think the others might not be relevant. I mention them just in case.

Both loops are busy loops - they will consume all available CPU time to check to see if 500 milliseconds have elapsed and to write the output. If there isn't anything else contending, you could just write once, wait 500, write again.

Both loops are fully blocking - the owning VI has to wait 500 milliseconds to continue. Was this intended?

Both loops pull the motor reference every iteration. If you are using the same reference often, you don't have to pull it each time.
Reply With Quote
  #26   Spotlight this post!  
Unread 30-01-2012, 21:10
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
Re: Worried about high CPU usage in CRIO

@Greg - Ah, now I understand. I'll see what I can do here.

@Ether - I have read the first post before, however reading it again now (with a deeper knowledge of LV) I feel like I understand it better. If I wanted to make a "state machine", I would get the Joystick button values and set a local/global variable, and call such a variable within the code requiring the value from the variable, yes?

@EricVanWyk - Is there a way within LV to prioritize code?

I did not intend for my loops to be blocking (at least not in this situation). How could I write a value (such as a motor output) then rewrite a value 500ms later without it becoming a blocking loop?

I'm going to try to write the code here from scratch.
Reply With Quote
  #27   Spotlight this post!  
Unread 30-01-2012, 21:14
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,058
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: Worried about high CPU usage in CRIO

Quote:
Having a high usage isn't necessarily bad. Well written code can consume 100% of the CPU ...
True. It's not unusual for safety critical embedded software to use all available leftover time to run background health monitoring.

Quote:
Both loops are busy loops - they will consume all available CPU time to check to see if 500 milliseconds have elapsed
If you've got a 32-bit Windows machine, here's a simple demo why this is important.

Reply With Quote
  #28   Spotlight this post!  
Unread 30-01-2012, 21:19
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
Re: Worried about high CPU usage in CRIO

Quote:
Originally Posted by Ether View Post
True. It's not unusual for safety critical embedded software to use all available leftover time to run background health monitoring.



If you've got a 32-bit Windows machine, here's a simple demo why this is important.

Wow, that set my fans on full tilt immediately!
Reply With Quote
  #29   Spotlight this post!  
Unread 30-01-2012, 21:22
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,749
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: Worried about high CPU usage in CRIO

I think what you are trying to do is set the output, then wait 500ms, and then restore the output. Consider using a sequence structure. Put the delay in the center frame and have the outer two update the outputs.

Greg McKaskle
Reply With Quote
  #30   Spotlight this post!  
Unread 30-01-2012, 21:23
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
Re: Worried about high CPU usage in CRIO

Wow, that turned my fans on to full tilt!
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 07:06.

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