Go to Post When mentors and students battle it's the team that loses. - Koko Ed [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 28-01-2007, 19:19
krunal krunal is offline
Registered User
FRC #0188 (The Blizzard)
Team Role: Programmer
 
Join Date: Nov 2006
Rookie Year: 2006
Location: canada
Posts: 3
krunal is an unknown quantity at this point
programming help needed

Our programmers are having trouble figuring out how to lock onto one light when two of them are on during autonomous! Wondering if any one could help us out, please post if you can!
  #2   Spotlight this post!  
Unread 28-01-2007, 20:08
aaeamdar's Avatar
aaeamdar aaeamdar is offline
Post-A-Holic
AKA: Paul Dennis
FRC #1719 (The Umbrella Corp)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Baltimore, MD
Posts: 231
aaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant future
Re: programming help needed

Krunal,

I was a programmer last year, but this year I'm on electrical/leadership. So while I know in general terms what we're talking about, I don't have any specific experience this year with the camera. That being said, here's my idea: would it be possible (if you find yourself between two lights) to pick one and turn yourself toward it until you can't see the other one? If your camera is unhappy turning, then try turning the robot.

I'll think about this more and try to come up with another answer if that doesn't work for you.

Best wishes,
Paul Dennis
  #3   Spotlight this post!  
Unread 28-01-2007, 22:37
ebowla's Avatar
ebowla ebowla is offline
The Overmind
FRC #2016
Team Role: Programmer
 
Join Date: Dec 2006
Rookie Year: 2006
Location: Ewing High School
Posts: 15
ebowla is on a distinguished road
Re: programming help needed

From what I know it only sees the center of (mass, light, whatever) right? Like it will end up somewhere between the two lights. I think someone told me that somewhere in the code, dont take me for certain I havent touched on this problem yet in our code, the camera is takeing the highest, lowest, furthest right, and furthest left points of light. It uses them to find the center. Well I think that perhaps if you wanted a robot to lock onto one specifically, left or right, top or bottom, you could use those points to get it at least closer to the target.

It wont be perfect, but if it works it will probably put the center target at the (right)(left)(top)(bottom) of the target, whatever one you chose. Best I can think of right now. Just look through the camera code to see if you cant find the part that picks out those points and decides on the center. It might take a bit of work, but its not impossible.
__________________
Progamming Master
Disclaimer: May not be actually as good as claimed, not reliable for advice, and shirks away any real work.
  #4   Spotlight this post!  
Unread 29-01-2007, 00:18
ace123's Avatar
ace123 ace123 is offline
Registered User
AKA: Patrick Horn
FRC #0008 (Paly Robotics - http://robotics.paly.net/)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Palo Alto, CA
Posts: 50
ace123 has a spectacular aura aboutace123 has a spectacular aura about
Send a message via AIM to ace123
Re: programming help needed

Basically, you want to look at the ratio of width (x2-x1) to height (y2-y1). This will tell you if there are two lights.

Something else you can look at as well is the number of pixels (the variable is called "pixels")... and it's ratio to the area width*height... unfortunately keep in mind that these are all unsigned chars, so it means that the limit is 255 for all values.

I'm pasting the EasyC example code segment about how the demo determined if it was one or two lights:
Code:
#define MIN_REGION          0
#define WIDEST_ONE_LIGHT    30
#define HALF_LIGHT_WIDTH    3

...

// get data from camera
CaptureTrackingData ( &centroid_x , &centroid_y , &upleft_x , &upleft_y , &lowright_x , &lowright_y , &region_size , &confidence , 0 , 0 ) ;
targets = 0;
if ( region_size > MIN_REGION  ) { // Check if we're locked
	icentroid_x = (int)centroid_x ; // move into integer variable
	int target_width = lowright_x - upleft_x ; // Horizontal extents of bounding box
	if ( target_width > WIDEST_ONE_LIGHT  ) { // looking at two lights?
		targets = 2;
		// pick the closer one of the two lights.
		if ( ( lowright_x - centroid_x) < (centroid_x - upleft_x) ) {
			// the centroid is nearer the right 
			target_x = lowright_x- HALF_LIGHT_WIDTH  ;
		} else {
			// the centroid is nearer the left
			target_x = upleft_x + HALF_LIGHT_WIDTH  ;
		}
	} else { // the target is NOT wide, it's one light
		targets = 1;
		target_x = icentroid_x; // target that light
	}
That code basically checked if the width was greater than a constant, and then decided it was two targets instead of one.

Now, I would suggest aiming for the *opposite side* of the median, which, when you are exactly at the middle, will be the same as the center coordinate:
(lowright_x + upleft_x - icentroid_x) -- that is... the flip image of the centroid...
or in normal C, it would be (x2 + x1 - mx)
__________________
-Patrick Horn, Paly Robotics

Check out the space simulator called Vega Strike, modelled after the space simulator games Elite and Wing Commander. It's Open Source too!
If you have ever played Wing Commander, or especially Privateer, and had a feeling of nostalga derived from the you will enjoy these two Vega Strike mods: Privateer Gemini Gold and Privateer Remake!
I'm working on adding multiplayer support this year...
Closed Thread


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
HELP-URGENT PROGRAMMING HELP NEEDED Rohith Surampudi Lego Mindstorm Discussion 1 24-03-2006 23:05
URgent Programming Help needed rcubes85 Programming 4 15-02-2005 23:21
Compiler Help Needed Darkman_X000 Programming 24 10-02-2004 12:19
Help needed.... Pin Man General Forum 9 02-06-2003 20:40


All times are GMT -5. The time now is 22: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