![]() |
Smartdashboard Dual Camera Issue
During our first regional competition for this year (Orlando Regional) we found the frequent "ball under the bridge" scenario to be quite annoying. Therefore, we decided to mount another camera on our robot that was low enough to give us visibility under the bridge and to assist us when needing to clear out a ball or two prior to the end game period.
We found, however, that doing so caused quite a performance issue with our drive station as the CPU would spike sometimes causing the robot to stop responding. We are using the WPI distributed Smartdashboard for our image processing and display. We are using a Lenovo laptop, not the classmate netbook. This was more annoying than the balls under the bridge and quickly had us digging into the source code for the smartdashboard as well as running the code with a Java Profiler attached. What we determined was that the "background image processing" thread was being way too greedy. Therefore, I decided to take it upon myself to determine a quick fix for this issue so that we could make use our two camera strategy. The code that I changed simply causes this background thread to sleep a few times a second so that resources aren't as scarce. This was a simple "hack" but it worked great for us, so I thought I would share. I'm going to be reviewing the rest of the camera and smartdashboard source to determine a better/more elegant solution, but for now it worked well enough for us to get the job done. Here is a link to the source that we used to replace the WPICameraExtension class. It is essentially a complete copy paste with some minor cleanup and an added call to sleep the thread. Feedback and comments are welcome and if anyone is interested in collaborating with us in getting to the root of the issue, then I'm all for it. |
Re: Smartdashboard Dual Camera Issue
Have you checked the framerate limitation on the camera? I don't remember the exact procedure off-hand, but if you log into your camera you can lower the rate, decreasing network traffic and processing time.
Unfortunately, it seems that certain framerates cause WPICameraExtension to think that there's no connection, so you have to be careful when choosing one. |
Re: Smartdashboard Dual Camera Issue
Yeah, we tried playing with the frame rate a bit, but like you pointed out there was a bit of an issue with getting it to communicate with the smartdashboard. In the end the code changes seemed to do the trick. I am going to continue messing with this between now and our next regional. Do you know of a "magic" number to set the frame rate?
|
| All times are GMT -5. The time now is 09:49. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi