Go to Post I have to wrap my brain about a robotics team named Dudettes. I can get there but ... I need coffee. - JaneYoung [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 12-03-2012, 17:20
abrightwell abrightwell is offline
Lead Software Engineer
FRC #0342 (Burning Magnetos)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Charleston, SC
Posts: 20
abrightwell is an unknown quantity at this point
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.
Reply With Quote
  #2   Spotlight this post!  
Unread 12-03-2012, 18:04
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 12-03-2012, 21:31
abrightwell abrightwell is offline
Lead Software Engineer
FRC #0342 (Burning Magnetos)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Charleston, SC
Posts: 20
abrightwell is an unknown quantity at this point
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?
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 12:47.

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