Go to Post I wouldn't trade my FIRST experiences for the world. - Koko Ed [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 17-01-2009, 15:04
ellisk ellisk is offline
Registered User
FRC #1540
 
Join Date: Dec 2008
Location: Vancouver, WA
Posts: 41
ellisk is on a distinguished road
Only intermittently finding the 2 trailer colors

Hi all,
I've been trying to get the camera to track the two colors using the code at http://first.wpi.edu/FRC/frcupdates.html, and it sort of works. It seems to almost never recognize the colors, except every once in a while. Even when it stays in the exact same place as where it recognized the image, I still cannot get more times where it recognizes the two colors.

The camera is correctly focused (we viewed it, and it can clearly see the colors on the trailer). The settings are correct in terms of brightness etc.

We then tried to increase the range of acceptable colors, and it still didn't work. Increasing other tolerances in Target.h also didn't help, and strangely didn't give us any false positives (just the same huge number of false negatives). Does anyone else have the same problems or know what causes this?

Thanks,
-Kevin
Reply With Quote
  #2   Spotlight this post!  
Unread 17-01-2009, 15:33
RedHeadRobotics's Avatar
RedHeadRobotics RedHeadRobotics is offline
Registered User
AKA: Brigid
FRC #2081 (Icarus)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Peoria, IL
Posts: 87
RedHeadRobotics will become famous soon enoughRedHeadRobotics will become famous soon enough
Re: Only intermittently finding the 2 trailer colors

We had to play with the colors a lot. We found that different lighting also made a difference. Try an incandenscent maybe instead of a flourescent. Just trying different things can help. We did a lot of trial and error.
__________________
Reply With Quote
  #3   Spotlight this post!  
Unread 17-01-2009, 17:26
ellisk ellisk is offline
Registered User
FRC #1540
 
Join Date: Dec 2008
Location: Vancouver, WA
Posts: 41
ellisk is on a distinguished road
Re: Only intermittently finding the 2 trailer colors

Quote:
Originally Posted by RedHeadRobotics View Post
We had to play with the colors a lot. We found that different lighting also made a difference. Try an incandenscent maybe instead of a flourescent. Just trying different things can help. We did a lot of trial and error.
We've done a lot of experimentation with different tolerances and camera settings, and it still is very touch-and-go. Do you recommend any particular settings to play with?
Reply With Quote
  #4   Spotlight this post!  
Unread 17-01-2009, 18:30
EdenA EdenA is offline
Programmer & Driver
AKA: Anthony Eden
FRC #1540 (The Flaming Chickens)
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Portland, Oregon
Posts: 10
EdenA is an unknown quantity at this point
Re: Only intermittently finding the 2 trailer colors

The api definitely needs to be more documented. Trial and error is not fun for anyone.


Last edited by EdenA : 17-01-2009 at 18:58.
Reply With Quote
  #5   Spotlight this post!  
Unread 17-01-2009, 20:19
Peter Randall Peter Randall is offline
Director of Technology
FRC #1218 (Vulcan Robotics)
Team Role: Teacher
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Philadelphia
Posts: 37
Peter Randall will become famous soon enoughPeter Randall will become famous soon enough
Re: Only intermittently finding the 2 trailer colors

We found two problems - the vertical control for the servos controlling the camera were reversed from our installation. You need to check the motion of the camera after a find. Second, check the color of Friend. We spent an hour chasing our own tail. Once we reset these, the demo code worked fine.

PGR
__________________
Peter Randall
Chairman, Department of Engineering & Robotics
Springside Chestnut Hill Academy
TEAM 1218
Reply With Quote
  #6   Spotlight this post!  
Unread 17-01-2009, 20:28
Peter Randall Peter Randall is offline
Director of Technology
FRC #1218 (Vulcan Robotics)
Team Role: Teacher
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Philadelphia
Posts: 37
Peter Randall will become famous soon enoughPeter Randall will become famous soon enough
Re: Only intermittently finding the 2 trailer colors

We found two problems - the vertical control for the servos controlling the camera were reversed from our installation. You need to check the motion of the camera after a find. Second, check the color of Friend. We spent an hour chasing our own tail. Once we reset these, the demo code worked fine.

PGR
__________________
Peter Randall
Chairman, Department of Engineering & Robotics
Springside Chestnut Hill Academy
TEAM 1218
Reply With Quote
  #7   Spotlight this post!  
Unread 18-01-2009, 10:47
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Only intermittently finding the 2 trailer colors

It sounds like some, perhaps most, of the issues are with the gimbal construction or setup. If there still seem to be camera issues, I'd be glad to help out, and I'd love to hear what sorts of lighting works/doesn't work with the default values that were shipped.

A brief explanation. The hue colors are quite wide to allow different types of lights to still work. The green fabric in particular will tint to a different color based on sunlight, indoor fluorescent, indoor halogen, etc. The downside to having the colors set this wide is that they may identify too many other materials and colors as being the target color. Making it too narrow may miss the target when the light color changes. The current settings were selected to work in classrooms, shops, event lighting, and hopefully outdoors. If you find that you need to widen them further we'd really like to know the circumstances. If you decide to narrow them, that is fine, but hopefully not necessary.

The rest of the camera settings are hopefully fine provided the camera adapts the exposure to the scene lighting in a good way. The camera is set to use a light metering to adapt to the amount of light. This seems to work quite well with a lag of 0.5 sec or less. Certain lighting conditions can confuse it, and for this, the brightness setting is handy. This will shorten or lengthen the exposure computed using the light meter. With the green active targets, setting this low will keep the sensor from saturating, making the green light look green instead of white. Similarly, a spotlight on the target will cause glare on the target. If the background color is dark, the camera will average things out and will pick an exposure that is too long and will make the glare worse. Again, shortening the exposure with a small brightness number fixes this. Finally, if there are bright windows or lights shining into the camera, it may pick an exposure too short, making the targets appear dark. Raising the brightness in this case will help.

Again, we hope the defaults work in most cases and want to help and to hear when they don't.

Greg McKaskle
Reply With Quote
  #8   Spotlight this post!  
Unread 18-01-2009, 11:41
yoyodyne yoyodyne is offline
Registered User
AKA: Greg Smith
FRC #0116 (Epsilon Delta)
Team Role: Engineer
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Reston, VA
Posts: 61
yoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to behold
Re: Only intermittently finding the 2 trailer colors

Has anyone had a problem with the FindColor() function finding a color exactly every Nth call? We haven't had much time to look into this yet. We think we are waiting enough time between calls

To do this test we edited the now old Iterative robot example and added the following to the constructor:

if (StartCameraTask(10, 0, k160x120, ROT_0) == -1)
97 {
98 dprintf( LOG_ERROR,"Failed to spawn camera task; Error code %s",
99 GetVisionErrorText(GetLastVisionError()) );
100 }
101
102 // Set up camera tracking parameters.
103 tdata = GetTrackingData(GREEN, PASSIVE_LIGHT);


The periodic autonomous function as shown below prints the "found value..." to the console exactly every 5th time with 4 ShowActivity("\n") between.

void Team116_Demo::AutonomousPeriodic(void) {
158 // feed the user watchdog at every period when in autonomous
159 GetWatchdog().Feed();
160 ParticleAnalysisReport par; // particle analysis reports
161
162 m_autoPeriodicLoops++;
163
164 // generate KITT-style LED display on the solenoids
165 SolenoidLEDsKITT( m_autoPeriodicLoops );
166
167 if ((m_autoPeriodicLoops % 60) == 0) {
168
169 if (FindColor(IMAQ_HSL, &tdata.hue, &tdata.saturation, &tdata.luminance, &par)
170 && par.particleToImagePercent < MAX_PARTICLE_TO_IMAGE_PERCENT
171 && par.particleToImagePercent > MIN_PARTICLE_TO_IMAGE_PERCENT) {
172 // drive toward color
173 m_robotDrive->Drive((float)1.0, (float)par.center_mass_x_normalized);
174 ShowActivity("%s found: follow x value: %f", tdata.name, par.center_mass_x_normalized);
175 }
176 else
177 {
178 m_robotDrive->Drive(0,0);
179 ShowActivity("\n");
180 }
181 }


We have tried calling FindColor() at different rates with the same result. Any help would be appreciated.

Thanks,

Greg
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Attaching Colors to Trailer UnknownMember Technical Discussion 0 15-01-2009 17:41
Low-Cost trailer drawings? (was: Trailer) DM7000 General Forum 2 07-01-2009 16:54
[FTC]: The Rack colors addictedMax FIRST Tech Challenge 3 18-09-2008 23:06
Recognizing the colors of the balls in autonomous mode Armando Gonzalez General Forum 13 05-01-2008 22:35
How do you read the colors on the tetras??? hedgehogger Technical Discussion 1 11-01-2005 17:54


All times are GMT -5. The time now is 13:17.

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