Go to Post "The safety log is the log people sit on to think about the unsafe act they've just committed." - Kevin Sevcik [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 19-01-2008, 14:09
JHale JHale is offline
Registered User
no team
 
Join Date: Feb 2007
Rookie Year: 2008
Location: Nowhere
Posts: 14
JHale is an unknown quantity at this point
Camera Works Well with the Balls!

Hey all!

For two years we have struggled intensely with the camera and getting it to work, at all.

Last year we found out that the camera's auto gain function didn't account for the light, and thus the light was simply registered as a white box (overexposure cannot be handled per-wavelength.)

This year we wanted a way to know where one of our balls is in order to knock it down during autonomous very accurately without wasting time sending commands from remote.

Because the balls are just lit, and don't glow, they work well with the camera. However, when we turn over control of the camera to the controller (instead of my computer) we were dissappointed to see absolutely no activity (the code stalls). This lead us to realize that Kevin's code does not work well...no offense to him.

We are writing some new code that gives most of the control to the camera, instead of trying to run the servos with the FRC controller. I will be posting an alpha version of the code for tracking the balls soon.

If you want to help out that would be great. On my team I am the only person doing programming, and thus cant give a whole lot of time to the camera. All you need is a good understanding of how the camera communicates with the controller and how to program C.

Thanks all!
-James
  #2   Spotlight this post!  
Unread 19-01-2008, 14:42
Unsung FIRST Hero
Greg Marra Greg Marra is offline
[automate(a) for a in tasks_to_do]
FRC #5507 (Robotic Eagles)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2005
Location: San Francisco, CA
Posts: 2,031
Greg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond repute
Re: Camera Works Well with the Balls!

I would recommend you look closer at Kevin's code. I wrote my own camera driver in 2005, and the experience was less than pleasant. Kevin has taken care of all sorts of things that I didn't even know existed in 2005.

Give it another shot before you invest dozens and dozens of hours rewriting it from scratch.
  #3   Spotlight this post!  
Unread 19-01-2008, 22:18
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 751
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: Camera Works Well with the Balls!

Quote:
Originally Posted by JHale View Post
However, when we turn over control of the camera to the controller (instead of my computer) we were dissappointed to see absolutely no activity (the code stalls).
I guess I would question whether or not you have loaded and intialized the camera settings?

It's one thing to "teach" the camera the blue ball, but you've also got to record those values into the code so the software can "recall" your taught settings and intialize those values and beginning tracking the ball.

Are you getting any tracking data? Is the "red" LED on in the front of the camera when you present the ball in front of it?
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #4   Spotlight this post!  
Unread 22-01-2008, 02:20
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: Camera Works Well with the Balls!

last year, you had to set the camera to CMYK mode, and adjust the red, blue, green, and white gains so that the light appeared as a purple smudge on the camera's vision field.

this year you can keep the gains normal and the mode in RGB, but you have to watch out for the fact that there may be multiple blue/red balls in your field of vision, which will throw your tracking algorithm for a loop, and will not point you at the ball at all (probably somewhere in the middle of the overpass)

be careful, though, with your intended code. external electronics are NOT allowed to control motors, and that includes the servos.
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY
  #5   Spotlight this post!  
Unread 22-01-2008, 10:32
PhilBot's Avatar
PhilBot PhilBot is offline
Get a life? This IS my life!
AKA: Phil Malone
FRC #1629 (GaCo: The Garrett Coalition)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Maryland
Posts: 747
PhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond repute
Re: Camera Works Well with the Balls!

Quote:
Originally Posted by JHale View Post
Hey all!

However, when we turn over control of the camera to the controller (instead of my computer) we were dissappointed to see absolutely no activity (the code stalls). This lead us to realize that Kevin's code does not work well...no offense to him.
-James
I suspect that you aren't calling the Camera_Handler() in the Process_Data_From_Master_uP() loop....

But the easiest way to see what's going on is to turn degugging on in the camera.h file.... as per Kevin's comment:

// To view debugging information on the terminal screen, uncomment the
// "#define _DEBUG" line below.
#define _DEBUG

This will show you the process of initializing the camera and reading data. If this doesn't run then the problem is hardware, or how you are calling the code.
__________________
Phil Malone
Garrett Engineering And Robotics Society (GEARS) founder.
http://www.GEARSinc.org

FRC1629 Mentor, FTC2818 Coach, FTC4240 Mentor, FLL NeXTGEN Mentor
  #6   Spotlight this post!  
Unread 22-01-2008, 10:40
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Re: Camera Works Well with the Balls!

Quote:
Originally Posted by JHale View Post
We are writing some new code that gives most of the control to the camera, instead of trying to run the servos with the FRC controller.
Are you sure you're satisfying the parts use and electrical rules? You should definitely double-check <R36> and <R62>.
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_
  #7   Spotlight this post!  
Unread 23-01-2008, 10:41
JHale JHale is offline
Registered User
no team
 
Join Date: Feb 2007
Rookie Year: 2008
Location: Nowhere
Posts: 14
JHale is an unknown quantity at this point
Re: Camera Works Well with the Balls!

I have followed all of the troubleshooting tips and instructions given by Kevin and IFI. I can confirm all of the initialization on the camera easily, and it does initialize, however tracking is where the majority of the problem is.

At the moment I have some custom code working the camera quite nicely. It can track the red ball (the only one we have) pretty well. The code only works to ensure that the camera is in tracking mode (not just idiling). Tomarrow I hope to add functionality for searching, register changes on the fly, and manual control.

I will post the code sometime next week. The main difference is turning over servo control to the camera, instead of the controller. In collecting output, I had noticed that the camera would tell the controller that it had sufficient confidence to start tracking, however, if the next packet denies this (perhaps the ball has moved and the confidence is slightly decreased) the code restarts.

Thanks all for the suggestions, but I have struggled with this camera for 2 years, and in 2 days I was able to get it working. Hasta!
  #8   Spotlight this post!  
Unread 23-01-2008, 10:46
Tytus Gerrish's Avatar
Tytus Gerrish Tytus Gerrish is offline
IGAB, ADHD, and Dislexic
AKA: Ty
FRC #0179 (SwampThing)
Team Role: Tactician
 
Join Date: Feb 2003
Rookie Year: 2001
Location: West Palm Beach, Florida
Posts: 2,017
Tytus Gerrish has a reputation beyond reputeTytus Gerrish has a reputation beyond reputeTytus Gerrish has a reputation beyond reputeTytus Gerrish has a reputation beyond reputeTytus Gerrish has a reputation beyond reputeTytus Gerrish has a reputation beyond reputeTytus Gerrish has a reputation beyond reputeTytus Gerrish has a reputation beyond reputeTytus Gerrish has a reputation beyond reputeTytus Gerrish has a reputation beyond reputeTytus Gerrish has a reputation beyond repute
Re: Camera Works Well with the Balls!

using the camera on the big balls makes sense. they look the same shape from any direction and they're enormus. you can't miss them. with all the hussle and bussle of 6 robots zipping arround having an auto aim for picking up balls even would be an advantage
  #9   Spotlight this post!  
Unread 24-01-2008, 04:49
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: Camera Works Well with the Balls!

Quote:
Originally Posted by JHale View Post
The main difference is turning over servo control to the camera, instead of the controller.
As has been stated previously, you can't have the camera control servos, unfortunately.

Quote:
Originally Posted by JHale View Post
In collecting output, I had noticed that the camera would tell the controller that it had sufficient confidence to start tracking, however, if the next packet denies this (perhaps the ball has moved and the confidence is slightly decreased) the code restarts.
If you're willing to give Kevin's code another, slightly different, go, try the drop-in replacement for tracking.c here. It's a modification I did last year that deals with just the problem you stated by not dropping the camera lock unless it loses the target for several consecutive frames. Success rate was over 80% (I don't have specific numbers at the moment) tracking last year's lighted targets with no recalibration ever needed, even between venues, so give it a try if you want.

--Ryan
  #10   Spotlight this post!  
Unread 31-01-2008, 21:39
JHale JHale is offline
Registered User
no team
 
Join Date: Feb 2007
Rookie Year: 2008
Location: Nowhere
Posts: 14
JHale is an unknown quantity at this point
Re: Camera Works Well with the Balls!

Hey all,

The camera is working great when we hand servos to the board (the way the CMU guys made it to work). Newer boards can do this by getting the servo angle that the camera is desiring and then sending that to the appropriate PWM. We however are using an older board that still has the PWM outs.

Cant post the code because it uses Kevin's serial code. Snippits on the way!

Hasta!
  #11   Spotlight this post!  
Unread 01-02-2008, 00:04
The Lucas's Avatar
The Lucas The Lucas is offline
CaMOElot, it is a silly place
AKA: My First Name is really "The" (or Brian)
FRC #0365 (The Miracle Workerz); FRC#1495 (AGR); FRC#4342 (Demon)
Team Role: Mentor
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Dela-Where?
Posts: 1,564
The Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond repute
Send a message via AIM to The Lucas
Re: Camera Works Well with the Balls!

Quote:
Originally Posted by JHale View Post
We however are using an older board that still has the PWM outs.
The older camera board is illegal. You have to use RevA of the CMUCam2 board since it is COTS (sold at IFI).
__________________
Electrical & Programming Mentor ---Team #365 "The Miracle Workerz"
Programming Mentor ---Team #4342 "Demon Robotics"
Founding Mentor --- Team #1495 Avon Grove High School
2007 CMP Chairman's Award - Thanks to all MOE members (and others) past and present who made it a reality.
Robot Inspector
"I don't think I'm ever more ''aware'' than I am right after I burn my thumb with a soldering iron"
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
Camera did not work for well at the regionals, but worked great at home. Alan Ing Programming 12 17-04-2006 17:43
1281's camera isnt working too well ThomasH Regional Competitions 1 31-03-2006 00:27
Blocking balls with balls allowed? MrBamboo Rules/Strategy 16 27-01-2006 19:59
Help with the balls! tchescow Kit & Additional Hardware 11 20-01-2004 10:52
Will ANYONE mess with the black balls? archiver 2001 0 23-06-2002 22:35


All times are GMT -5. The time now is 18:37.

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