Go to Post When it was at 222, I was like 'Tigertrons from Tunkhahoohaasomethingconfusing Pennsylvania!' and my friend hit me for being such a loser. - Church [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 12-01-2007, 08:32
Smoking_Gun Smoking_Gun is offline
Registered User
AKA: Tal
FRC #1943 (Neat-Team)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2006
Location: israel
Posts: 11
Smoking_Gun is an unknown quantity at this point
Tracking 2 targets

Hi, I'm having a small trobble finding out how can I track 2 targets with the new CMUCam 2 code.
Can someone explain it to me?

10x Tal
  #2   Spotlight this post!  
Unread 12-01-2007, 08:45
bear24rw's Avatar
bear24rw bear24rw is offline
Team 11 Programming Captain
AKA: Max T
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2005
Location: Flanders, NJ
Posts: 385
bear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to behold
Send a message via AIM to bear24rw
Re: Tracking 2 targets

From my understanding you cannot actually "track" multipul targets. You can only identify how many there are. The blob size returned from the camera will be twice as large as a regular blog size if you are looking at two targets, but I dont believe that you can actually "track" two target..
  #3   Spotlight this post!  
Unread 12-01-2007, 08:53
Smoking_Gun Smoking_Gun is offline
Registered User
AKA: Tal
FRC #1943 (Neat-Team)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2006
Location: israel
Posts: 11
Smoking_Gun is an unknown quantity at this point
Re: Tracking 2 targets

Quote:
Originally Posted by bear24rw View Post
From my understanding you cannot actually "track" multipul targets. You can only identify how many there are. The blob size returned from the camera will be twice as large as a regular blog size if you are looking at two targets, but I dont believe that you can actually "track" two target..
But if one is far apart from the other (Like on the rack) and I want to know the angle between them?
  #4   Spotlight this post!  
Unread 12-01-2007, 08:59
steveg's Avatar
steveg steveg is offline
Livin' the Dream
AKA: Stephen Guerrera
no team
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Boston, MA
Posts: 70
steveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to beholdsteveg is a splendid one to behold
Send a message via AIM to steveg
Re: Tracking 2 targets

rst of all, which are you using, EasyC or mplab?

I'm going to assume that you're using mplab and relatively new to this, given your team number.

Have you downloaded Kevin Watson's camera code at http://www.kevin.org/frc? It's a great place to start if you're unfamiliar with the CMUCam.

Anyway, once you download that, compile it and load it onto your RC. Be sure that your pan and tilt servos are plugged into pwm01 and pwm02. Connect power and the TTL inputs to the camera to the appropriate place. Turn it on, and the camera should start panning around looking for the target.


Now, when your programming cable is plugged in, the console open, and the camera tracking, you can see a bunch of data, including the x and y locations of a bounding rectangle, the center of that rectangle, and the percentage of pixels in that rectangle that are being tracked. That percentage value is called the confidence. If you're tracking a single target, your confidence value should be fairly high. If you're tracking multiple targets, there will be a huge space of untracked pixels in between the two targets, which will lower your confidence substantially. So, if you see a big bounding box with low confidence, you can figure out that you're tracking two targets.
  #5   Spotlight this post!  
Unread 12-01-2007, 09:33
Smoking_Gun Smoking_Gun is offline
Registered User
AKA: Tal
FRC #1943 (Neat-Team)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2006
Location: israel
Posts: 11
Smoking_Gun is an unknown quantity at this point
Re: Tracking 2 targets

Quote:
Originally Posted by steveg View Post
....
Thank you, but I know all this from last year.
All I'm asking is how can I track 2 targerts or at least know the angle between them.
  #6   Spotlight this post!  
Unread 12-01-2007, 09:44
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,186
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Tracking 2 targets

Quote:
Originally Posted by Smoking_Gun View Post
Thank you, but I know all this from last year.
All I'm asking is how can I track 2 targerts or at least know the angle between them.
He told you.

There is no way to "track" two targets. The CMUCam2 firmware still only allows 1 target to be tracked. If it sees multiple color blobs, it will include them all in its "bounding box" and return a low confidence value.

Look at the spread of the bounding box. When tracking two targets it will most likely look like a very wide rectangle. From that you can determine the left and right limits of the targets. Using the servo angle, X center of the bounding box, and a little math, you can figure out exactly where they are in relation to your robot.
  #7   Spotlight this post!  
Unread 12-01-2007, 14:24
Workaphobia Workaphobia is offline
Registered User
AKA: Jon
FRC #1546 (Chaos Inc.)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Long Island
Posts: 26
Workaphobia will become famous soon enough
Re: Tracking 2 targets

Since the two lights should be at the same height, it seems that you only need the width of the bounding box to determine their two positions. However I think in general it should be possible to generate multiple bounding boxes for each target by using the virtual window features of the camera. That is, you should be able to cut the area being processed in half and operate only on that side, thus cropping the other light out of the picture.

But I'm not sure - I'm just an alumnus, I've never even plugged in the camera.
  #8   Spotlight this post!  
Unread 13-01-2007, 06:33
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 590
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Tracking 2 targets

Take a look at the following web site:
http://first.wpi.edu/FRC/25814.htm

It has a video that describes how to identify that you are tracking two lights and some sample code that will let you get a start playing with the camera.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #9   Spotlight this post!  
Unread 15-01-2007, 00:07
Keith Watson Keith Watson is offline
Registered User
FRC #0957 (WATSON)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Wilsonville, OR
Posts: 112
Keith Watson is just really niceKeith Watson is just really niceKeith Watson is just really niceKeith Watson is just really nice
Re: Tracking 2 targets

Unfortunately, the only place in the frc_camera code which can be used as data from the camera to do non-default searching and tracking behaviors is the T_Packet_Data_Type struct in camera.h. And it is not documented in that file as to what the fields are. Or in a txt file.

If you look at the only non-easyC code on the WPI site it uses an undocumented API call which does not seem to be available with the frc_camera code. Where that API call is used in the non-easyC code has descriptive variable names, assuming that the argument order happens to match the order of the fields in the T_Packet_Data_Type struct.

Is there anyplace where this stuff is officially documented? If not it really should be added to the .h file where the struct is defined. Last year new people kept asking questions about this right up to the first regionals. I expect the same this year.
__________________
Keith Watson - Professional Software Engineer
No relation to "Kevin" Watson, who created the camera tracking code.
  #10   Spotlight this post!  
Unread 15-01-2007, 01:11
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Cañada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Cañada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Tracking 2 targets

Quote:
Originally Posted by Keith Watson View Post
Unfortunately, the only place in the frc_camera code which can be used as data from the camera to do non-default searching and tracking behaviors is the T_Packet_Data_Type struct in camera.h. And it is not documented in that file as to what the fields are. Or in a txt file.

If you look at the only non-easyC code on the WPI site it uses an undocumented API call which does not seem to be available with the frc_camera code. Where that API call is used in the non-easyC code has descriptive variable names, assuming that the argument order happens to match the order of the fields in the T_Packet_Data_Type struct.

Is there anyplace where this stuff is officially documented? If not it really should be added to the .h file where the struct is defined. Last year new people kept asking questions about this right up to the first regionals. I expect the same this year.
The information you seek is the the file "CMUcam2_data_packets.pdf" available on my website since January 10th, 2006. The point about the t-packet not being documented in the header file is a good one and I'll make that change when I freshen the code in the next few days.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org

Last edited by Kevin Watson : 15-01-2007 at 01:14. Reason: Messsed-up link
  #11   Spotlight this post!  
Unread 15-01-2007, 02:36
amateurrobotguy's Avatar
amateurrobotguy amateurrobotguy is offline
Lead Programmer/Senior Engineer
no team
 
Join Date: Feb 2005
Rookie Year: 2000
Location: ****
Posts: 136
amateurrobotguy is infamous around these partsamateurrobotguy is infamous around these partsamateurrobotguy is infamous around these partsamateurrobotguy is infamous around these partsamateurrobotguy is infamous around these partsamateurrobotguy is infamous around these parts
Re: Tracking 2 targets

Alrighty then, I got a quick, late night question. This "rectangle" will be determined by blob size?
__________________
I quit FRC over 2 years ago (more if you're reading this past 2010).
  #12   Spotlight this post!  
Unread 15-01-2007, 08:21
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 590
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Tracking 2 targets

Quote:
Originally Posted by Keith Watson View Post
Is there anyplace where this stuff is officially documented? If not it really should be added to the .h file where the struct is defined. Last year new people kept asking questions about this right up to the first regionals. I expect the same this year.
Hi Kieth -

Good question, I guess I should have done that.

For the easyC versions of the program, all the calls are extensively documented in the easyC help with the API and examples. If you use the WPILib version of the program, the entire API (not just the camera) is documented here:
WPILib docs

The library is the same one that easyC uses so it was trival to make a version of Neil Rosenberg's program that didn't require easyC for people who wanted a quick stand-alone MPLab project.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #13   Spotlight this post!  
Unread 15-01-2007, 08:39
Dominicano0519's Avatar
Dominicano0519 Dominicano0519 is offline
My team is not competing this year
AKA: Demolition Man
FRC #0381 (Tornadoes)
Team Role: College Student
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Trenton
Posts: 165
Dominicano0519 will become famous soon enough
Send a message via MSN to Dominicano0519 Send a message via Yahoo to Dominicano0519
Re: Tracking 2 targets

Quote:
Originally Posted by BradAMiller View Post
Take a look at the following web site:
http://first.wpi.edu/FRC/25814.htm

It has a video that describes how to identify that you are tracking two lights and some sample code that will let you get a start playing with the camera.

thanks for the link this really helped
__________________
Favorite Phrases:
1. I like your robot, no-homo
2. "It depends how you define alone" ( Bill Clinton when being questioned about Monica Lewinsky)
  #14   Spotlight this post!  
Unread 22-01-2007, 00:26
Keith Watson Keith Watson is offline
Registered User
FRC #0957 (WATSON)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Wilsonville, OR
Posts: 112
Keith Watson is just really niceKeith Watson is just really niceKeith Watson is just really niceKeith Watson is just really nice
Re: Tracking 2 targets

Kevin, thank you very much for that link! That is exactly what I was looking for.

I see that web page also has the camera calibration procedures, which our default 2007 camera has a problem with. Looks like I need to do some reading. But this is a different thread.

Regards,
Keith
__________________
Keith Watson - Professional Software Engineer
No relation to "Kevin" Watson, who created the camera tracking code.
  #15   Spotlight this post!  
Unread 30-01-2007, 19:13
Keith Watson Keith Watson is offline
Registered User
FRC #0957 (WATSON)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Wilsonville, OR
Posts: 112
Keith Watson is just really niceKeith Watson is just really niceKeith Watson is just really niceKeith Watson is just really nice
Re: Tracking 2 targets

Quote:
Originally Posted by Keith Watson View Post
Kevin, thank you very much for that link! That is exactly what I was looking for.
OK, now that I have read closer, no, it isn't exactly what I'm looking for.

Quote:
Originally Posted by CMUcam2_data_packets.pdf
x1 - The left most corner’s x value
y1 - The left most corner’s y value
x2 - The right most corner’s x value
y2 -The right most corner’s y value
"Left" and "right" obviously say which X value is higher. What about the Y values? Is one always larger than the other?
__________________
Keith Watson - Professional Software Engineer
No relation to "Kevin" Watson, who created the camera tracking code.
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
How many targets? geeknerd99 Kit & Additional Hardware 19 16-01-2007 18:16
Tracking Mr.Fahrenheit Programming 3 10-01-2006 21:50
AUTO TRACKING!!!!!!:( magical hands Programming 15 15-02-2005 19:27
IR tracking nzj1 General Forum 3 26-01-2004 22:46
Tracking Wetzel Championship Event 11 06-03-2002 18:18


All times are GMT -5. The time now is 01:28.

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