Go to Post One button, ten copyrights, you do the math. - StephLee [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

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-04-2016, 19:05
Mr. Lim Mr. Lim is offline
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 : 18-04-2016 at 19:22.
Reply With Quote
  #2   Spotlight this post!  
Unread 18-04-2016, 20:03
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,683
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: USB CameraServer causing high CPU usage on RoboRIO

Is it this bug?
https://usfirst.collab.net/sf/go/art...4592608865 89
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
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 09:30.

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