Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   USB CameraServer causing high CPU usage on RoboRIO (http://www.chiefdelphi.com/forums/showthread.php?t=147368)

Mr. Lim 04-18-2016 07:05 PM

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.

Mark McLeod 04-18-2016 08:03 PM

Re: USB CameraServer causing high CPU usage on RoboRIO
 
Is it this bug?
https://usfirst.collab.net/sf/go/art...4592608865 89


All times are GMT -5. The time now is 07:23 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi