You're so Vexy.
Home
Go Back   Chief Delphi > Technical > Programming
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 Yesterday, 12:44
Classified*'s Avatar
Classified* Classified* is offline
Just grab a hacksaw and go.
AKA: Julia Cecchetti
FRC #0291 (CIA: Creativity in Action)
Team Role: Leadership
 
Join Date: Nov 2015
Rookie Year: 2015
Location: Erie PA
Posts: 63
Classified* will become famous soon enough
Microsoft Cam Exposure Reseting To Automatic on Robot Reboot?

Hello,

I am currently working on vision tracking to find the tape around the peg using the Microsoft Life Cam 3000, and I have been having a lingering problem. I am using LabVIEW. My vision processing code works great, but when I reboot the robot (Turn it off and back on, not just reboot the roboRIO), all of the camera settings (white balance and exposure) are returned to automatic. As we all know, vision doesn't work very well like this . Here is a screen shot of my Vision Processing.vi.

As soon as I restart robot code from the drivers station, however, the camera settings return to what I set them to in my code, but the target is extremely dim. Picture. When I redeploy the code, though, keeping the robot on, the target becomes very bright (how I want it to be). Picture. Both of these shots were taken with THE SAME CODE WITH THE SAME SETTINGS. The only difference was that the first was taken after turning the robot on and restarting robot code, while the second was taken after the robot had been on and new code had just been deployed.

Last offseason was our first time using vision tracking, and we had the same problem. At our offseason events, we got around it by quickly restarting robot code as soon as we got communication, but I have a feeling this would be frowned upon at a Regional. Also, this didn't solve the problem of it being dim, but we were okay after we recalibrated the thresholds to detect it like this.

I did a thorough search on CD and Google, but I found no mention of this issue. Any suggestions on how to fix this problem are much appreciated! Do I need to initialize the camera in Begin.vi instead of just in Vision Processing.vi? Is this a problem with the Life Cam? Has anyone else ever run into this issue?

Thanks!

-Julia Cecchetti
__________________
Team291.com
Work smarter, not harder.
Reply With Quote
  #2   Spotlight this post!  
Unread Yesterday, 12:53
microbuns's Avatar
microbuns microbuns is offline
Registered User
AKA: Sam Maier
FRC #4917 (Sir Lancerbot)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2014
Location: Elmira, ON
Posts: 89
microbuns is an unknown quantity at this point
Re: Microsoft Cam Exposure Reseting To Automatic on Robot Reboot?

Our team had a lot of similar issues when we tried the Microsoft Lifecam - as well as issues with its autofocus. We ended up switching to a fixed focus Axis camera, and it persisted its white balance and exposure settings as we wanted it to.

However, there is totally a chance that another team got it to work with the Microsoft camera.
Reply With Quote
  #3   Spotlight this post!  
Unread Yesterday, 13:10
wt200999's Avatar
wt200999 wt200999 is online now
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 327
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
Re: Microsoft Cam Exposure Reseting To Automatic on Robot Reboot?

Quote:
Originally Posted by Classified* View Post
As soon as I restart robot code from the drivers station, however, the camera settings return to what I set them to in my code, but the target is extremely dim. Picture. When I redeploy the code, though, keeping the robot on, the target becomes very bright (how I want it to be). Picture. Both of these shots were taken with THE SAME CODE WITH THE SAME SETTINGS. The only difference was that the first was taken after turning the robot on and restarting robot code, while the second was taken after the robot had been on and new code had just been deployed.
To me the 1st image you showed seems like it would be easier to process, as I see much less green reflections and the green color is more consistent, it looks like it would be much kinder to the threshold step. Is there any particular reason you prefer the 2nd one?

For the camera it looks like the vision settings are only applied once when the vision start. The only difference between the two you describe above is whether or not the robot has been running for some time. Maybe the camera isn't 'ready' to start receiving commands when you first turn the robot on? I would start there, maybe you can monitor the error wire or send the error wire back to the dashboard to see if that has any hints. Maybe you need a delay before running the settings, or check if the camera is available first?
__________________
Programming in LabVIEW? Try VI Snippets!

FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -
Reply With Quote
  #4   Spotlight this post!  
Unread Yesterday, 14:17
Classified*'s Avatar
Classified* Classified* is offline
Just grab a hacksaw and go.
AKA: Julia Cecchetti
FRC #0291 (CIA: Creativity in Action)
Team Role: Leadership
 
Join Date: Nov 2015
Rookie Year: 2015
Location: Erie PA
Posts: 63
Classified* will become famous soon enough
Re: Microsoft Cam Exposure Reseting To Automatic on Robot Reboot?

Quote:
Originally Posted by wt200999 View Post
To me the 1st image you showed seems like it would be easier to process, as I see much less green reflections and the green color is more consistent, it looks like it would be much kinder to the threshold step. Is there any particular reason you prefer the 2nd one?

For the camera it looks like the vision settings are only applied once when the vision start. The only difference between the two you describe above is whether or not the robot has been running for some time. Maybe the camera isn't 'ready' to start receiving commands when you first turn the robot on? I would start there, maybe you can monitor the error wire or send the error wire back to the dashboard to see if that has any hints. Maybe you need a delay before running the settings, or check if the camera is available first?
Thanks for these suggestions. I will try this and see if I can see what is happening. Another thing I just thought of is setting the exposure inside the loop just like the example code does with image size. This way it would be sure to set it correctly (I think). I know it's not the most efficient way to do it, but if all else fails it is better than nothing. This would also allow us to change the exposure back to auto during teleop for driver vision.

The reason the second one was preferred last year was because the goal was so much farther away that it was really, really dim. I had to set the threshold to see everything except pure black, which resulted in lots of noise. Luckily my algorithm for ranking the targets was robust, because at our competition we were seeing 10-20 particles because of the tower LEDs and ceiling lights. This year I have the code able to detect both the dim and bright versions with the same threshold and similar robust filtering/ranking algorithm, although this year there is less of a problem with noise because the camera is not looking toward the ceiling and there are no LEDs around the peg (except on the steam tank, but that's not much of a problem).

Quote:
Our team had a lot of similar issues when we tried the Microsoft Lifecam - as well as issues with its autofocus. We ended up switching to a fixed focus Axis camera, and it persisted its white balance and exposure settings as we wanted it to.
I think we have a few Axis cameras laying around. I will try this also!
__________________
Team291.com
Work smarter, not harder.
Reply With Quote
  #5   Spotlight this post!  
Unread Yesterday, 14:23
Nebster's Avatar
Nebster Nebster is offline
Registered User
AKA: Ben Kishter
FRC #1306 (BadgerBOTS)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Madison, Wisconsin
Posts: 63
Nebster is on a distinguished road
Re: Microsoft Cam Exposure Reseting To Automatic on Robot Reboot?

This was a problem for us last year as well, we ended up switching to an axis camera. This year we are using a Logitech C270 webcam, which doesn't have the issue the Microsoft HD-3000 did.
__________________
2016 Tesla Division Semifinalists
2016 Wisconsin Regional Engineering Inspiration

2015 Wisconsin Regional Chairman's Award
Carson Division

2013 Wisconsin Regional Chairman's Award
Curie Division
Reply With Quote
  #6   Spotlight this post!  
Unread Today, 12:20
Classified*'s Avatar
Classified* Classified* is offline
Just grab a hacksaw and go.
AKA: Julia Cecchetti
FRC #0291 (CIA: Creativity in Action)
Team Role: Leadership
 
Join Date: Nov 2015
Rookie Year: 2015
Location: Erie PA
Posts: 63
Classified* will become famous soon enough
Re: Microsoft Cam Exposure Reseting To Automatic on Robot Reboot?

So,

Problem:

I tracked the errors, and the problem was indeed that the camera was not initializing before the code tried to apply settings to it.

Solution:


I solved this by setting the exposure inside of the while loop. This also allowed me to set the camera to have a low exposure for autonomous, and automatic exposure for teleop so the drivers can use it to see. Here is a screenshot for when auto is enabled (or disabled), and here is another for when teleop is enabled.

I hope this helps anyone with this problem in the future!
__________________
Team291.com
Work smarter, not harder.

Last edited by Classified* : Today at 12:27.
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 15: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