Go to Post I know that it's often dangerous to use common sense in a YMTC thread... - Kris Verdeyen [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
  #16   Spotlight this post!  
Unread 12-02-2007, 23:06
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Camera Code Update

Quote:
Originally Posted by Tyr333 View Post
I've noticed that when the camera is in a search, if the camera is resetting its pan for a new sweep:...and if the camera sees the light during this motion of resetting the pan to its minimum, when it arrives at this new pan position, the camera tilts down. It continues to search at this lower tilt, reaches the maximum pan, tilts back up, sweeps to its minimum pan, sees the light during this trip, and tilts down again. It continues this loop and never tracks the light...What can we do to fix this?
You can change the search pattern code to do a zigzag sweep instead of always going left-to-right. That way it will never be panning too fast to stop when it sees the light, and it won't need to restart the search immediately upon glimpsing and then losing it.

Here's an overview of one way to go about it. Where it tests for the pan value being greater than the maximum limit, set a flag instead of resetting to minimum. Add a similar test for the pan value being less than the minimum and reset the flag if it is. Where the code adds the step size to the current pan value, have it subtract instead if the flag is set.
  #17   Spotlight this post!  
Unread 13-02-2007, 02:45
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: Camera Code Update

I've uploaded version 2.2 of the bells & whistles camera code. See the attached document for a list of changes. As it's very close to the ship date, I would caution everyone to think really, really hard before ripping open your nearly complete code and dumping my changes in. For this reason I'm not sure if I'll add a link to this code on my website before the ship date. I guess I'll wait to see what the Chief Delphi crowd thinks. As always, please let me know if you find any bugs in the code or documentation. Anyway, here's a link: http://kevin.org/frc/frc_camera_22.zip.

Edit: I found a bug in the search code I published above, so don't use it.

-Kevin
Attached Files
File Type: txt readme_first.txt (5.2 KB, 106 views)
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org

Last edited by Kevin Watson : 13-02-2007 at 02:47.
  #18   Spotlight this post!  
Unread 13-02-2007, 07:21
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,188
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: Camera Code Update

I found a bug in the old search code. Not sure if someone has seen this before or not. We have our camera mounted upside down. So, top is bottom and left is right. The camera still tracks the right way because the image is flipped, but the search code looks at the floor instead of the ceiling. When we have the target in front of the robot and elevated a bit, the search code freaks out. As it transitions from its max tilt pwm to its min tilt pwm, it does a diagonal. While traveling this path, it gets a new t packet (I see the red light on the camera flash) as it passes where the light is. As soon as it gets to the other corner, it doesn't see the light anymore, but it continues to drop to the middle tilt search pwm and scan on that level, at which it does not get a new t packet.

This problem will go away when we change the search code to our own algorithm, but I still think it is a bit of a problem.
  #19   Spotlight this post!  
Unread 13-02-2007, 08:09
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,554
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Camera Code Update

I'd like to make one suggestion - we've found the common sense says the light is probably closest to the position that you lost at it. If you comment out the "New_Search = 1" line in the old code, the camera will just continue searching from it's current location.

Generally it results in a much quicker lock, because if it was only a temporary loss of the light (say a robot drives in front of you) the camera may well catch the light on the next pan, rather than resetting the tilt completely and starting a new search.

This is especially true when the robot is under the light to score. It also fixes the issue some teams are having where the camera "freaks out" and starts doing the tilt down then pan that someone else mentioned here.
  #20   Spotlight this post!  
Unread 13-02-2007, 11:55
jdejoannis jdejoannis is offline
Registered User
FRC #1845
 
Join Date: Feb 2006
Location: Atlanta,GA
Posts: 48
jdejoannis will become famous soon enoughjdejoannis will become famous soon enough
Re: Camera Code Update

Quote:
Originally Posted by Kevin Watson View Post
I've uploaded version 2.2 of the bells & whistles camera code. See the attached document for a list of changes. As it's very close to the ship date, I would caution everyone to think really, really hard before ripping open your nearly complete code and dumping my changes in. For this reason I'm not sure if I'll add a link to this code on my website before the ship date. I guess I'll wait to see what the Chief Delphi crowd thinks. As always, please let me know if you find any bugs in the code or documentation. Anyway, here's a link: http://kevin.org/frc/frc_camera_22.zip.

Edit: I found a bug in the search code I published above, so don't use it.

-Kevin
Don't use what? Are you saying not to use v2.2 altogether?
  #21   Spotlight this post!  
Unread 13-02-2007, 12:38
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: Camera Code Update

Quote:
Originally Posted by jdejoannis View Post
Don't use what? Are you saying not to use v2.2 altogether?
No, I meant the snippet of search code I included in this posting. The problem is that when a new search is initiated, the servo PWM values could be initialized to values outside the min/max PWM range set in the code, which could lead to wacky behavior. I haven't had time to look at it yet, but the same bug may be present in older code. The new search code is easier to read and comprehend, should work better, and provide a better foundation for those that want to modify it for their specific needs.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #22   Spotlight this post!  
Unread 13-02-2007, 13:40
jdejoannis jdejoannis is offline
Registered User
FRC #1845
 
Join Date: Feb 2006
Location: Atlanta,GA
Posts: 48
jdejoannis will become famous soon enoughjdejoannis will become famous soon enough
Re: Camera Code Update

Does line 365 need to be changed to Tilt_Min?
  #23   Spotlight this post!  
Unread 13-02-2007, 13:59
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: Camera Code Update

Quote:
Originally Posted by jdejoannis View Post
Does line 365 need to be changed to Tilt_Min?
No, I changed it to Tilt_Center_PWM so that you can specify a starting angle for searches other than Tilt_Min_PWM, which is currently zero degrees. The comment associated with TILT_CENTER_PWM_DEFAULT in tracking.h was updated to reflect this change. Thanks for helping with the bug hunt.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #24   Spotlight this post!  
Unread 13-02-2007, 15:00
jdejoannis jdejoannis is offline
Registered User
FRC #1845
 
Join Date: Feb 2006
Location: Atlanta,GA
Posts: 48
jdejoannis will become famous soon enoughjdejoannis will become famous soon enough
Re: Camera Code Update

Quote:
Originally Posted by Kevin Watson View Post
No, I changed it to Tilt_Center_PWM so that you can specify a starting angle for searches other than Tilt_Min_PWM, which is currently zero degrees. The comment associated with TILT_CENTER_PWM_DEFAULT in tracking.h was updated to reflect this change. Thanks for helping with the bug hunt.
Are you sure? I believe its line 339 that pertains to the initial position for a new search. Line 365 is for when the tilt has exceeded its max. Tilt_Min_PWM is not mentioned even once within the search portion of the code.

Jason
  #25   Spotlight this post!  
Unread 13-02-2007, 15:38
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: Camera Code Update

Quote:
Originally Posted by jdejoannis View Post
Are you sure? I believe its line 339 that pertains to the initial position for a new search. Line 365 is for when the tilt has exceeded its max. Tilt_Min_PWM is not mentioned even once within the search portion of the code.

Jason
I'll have a look...

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #26   Spotlight this post!  
Unread 13-02-2007, 16:01
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: Camera Code Update

Quote:
Originally Posted by jdejoannis View Post
Are you sure? I believe its line 339 that pertains to the initial position for a new search. Line 365 is for when the tilt has exceeded its max.
Both lines of code return the tilt servo to the starting tilt angle, which may or may not be zero. The code as it is currently configured, does not change the tilt angle from 30 degrees because the vertical field of view of the camera from that angle can see the light from most of the field, including the entire starting area.


Quote:
Originally Posted by jdejoannis View Post
Tilt_Min_PWM is not mentioned even once within the search portion of the code.
Yes, I know. Tilt_Min_PWM is only used by the tracking algorithm to establish the minimum PWM value that the tracking algorithm will attempt to drive the servo to. Tilt_Center_PWM establishes the same baseline while tracking.

I realize that this may be confusing, so perhaps I need to consider changing the name(s) to something else.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #27   Spotlight this post!  
Unread 13-02-2007, 16:17
jdejoannis jdejoannis is offline
Registered User
FRC #1845
 
Join Date: Feb 2006
Location: Atlanta,GA
Posts: 48
jdejoannis will become famous soon enoughjdejoannis will become famous soon enough
Re: Camera Code Update

Quote:
Originally Posted by Kevin Watson View Post
I realize that this may be confusing, so perhaps I need to consider changing the name(s) to something else.
I got you now. You want it to search from 30-90 degrees and track from 0-90 degrees. I don't really see why they should be different ranges. Could just as well set the min to 30 rather than 0 (and use it as the starting point). This will work fine though, thanks!

Jason
  #28   Spotlight this post!  
Unread 14-02-2007, 16:59
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: Camera Code Update

How's it going with this code? Any problems, complaints, etc? Should I go public with it? Does Diet Pepsi taste better that Diet Coke?

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #29   Spotlight this post!  
Unread 14-02-2007, 17:33
DanDon's Avatar
DanDon DanDon is offline
ohhh MY god
AKA: Dan Hoizner
FRC #0375 (The Robotic Plague)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Staten Island, NY
Posts: 1,432
DanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond repute
Send a message via ICQ to DanDon Send a message via AIM to DanDon Send a message via MSN to DanDon
Re: Camera Code Update

Quote:
Originally Posted by Kevin Watson View Post
How's it going with this code? Any problems, complaints, etc? Should I go public with it? Does Diet Pepsi taste better that Diet Coke?

-Kevin

So far, after small amounts of testing the new code (i.e. seeing if it searches and tracks, and testing the menus), I have not found any bugs.
__________________
  #30   Spotlight this post!  
Unread 14-02-2007, 17:37
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,188
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: Camera Code Update

Quote:
Originally Posted by Kevin Watson View Post
How's it going with this code? Any problems, complaints, etc? Should I go public with it? Does Diet Pepsi taste better that Diet Coke?

-Kevin
For some reason I was under the presumption that the tracking software was broken. I'll start testing tonight.
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
Problems Combining Camera Code and Driving Code cmurdoch Programming 20 10-02-2007 16:34
Problems when combine ADC code && camera code nirhaim1942 Programming 1 24-01-2007 06:58
problems using gyro/adc code with camera default code tanstaafl Programming 7 22-01-2006 23:09
Code error on RC after downloading "bells and whistles" version of Kevins camera code DanDon Programming 6 10-01-2006 18:07
Team THRUST - Kevin's Code and Camera Code Combine Chris_Elston Programming 3 31-01-2005 22:28


All times are GMT -5. The time now is 04:12.

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