Go to Post :D NASCAR is way harder than we thought. - SL8 [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 04-18-2016, 07:05 PM
Mr. Lim Mr. Lim is online now
Registered User
AKA: Mr. Lim
no team
Team Role: Leadership
 
Join Date: Jan 2004
Rookie Year: 1998
Location: Toronto, Ontario
Posts: 1,125
Mr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond repute
USB CameraServer causing high CPU usage on RoboRIO

A few FTAs in Canada have told me teams using Java, USB cameras, and the CameraServer automatic capture have been having issues.

I think I may have tracked down the problem. I was able to recreate very high CPU usage by just running the example code.

In the CameraServer class, there is a capture() method with a while loop that polls the camera for image data.

In this loop there is no Thread.sleep, so it will poll the camera as fast as the roboRIO can, thus using a lot of CPU time.

I added a Thread.sleep(15) to the end of the while loop. This wait amount is pretty arbitrary, as the max FPS we are trying to achieve is 30.

After making this modification, our CPU usage dropped dramatically, with no obvious loss in framerate to the camera feed.
__________________
In life, what you give, you keep. What you fail to give, you lose forever...

Last edited by Mr. Lim : 04-18-2016 at 07:22 PM.
Reply With Quote
 


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:23 AM.

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