Go to Post Guess i don't know what the secret weapon is, but i bet if it can be wedge shaped it is. - Chris [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-02-2007, 13:53
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
Camera Code Update

I've made a few changes to the camera code and would like to get some feedback before releasing it. If you can think of something you'd like changed or added, please leave a message here. These are the changes do far:

2/11/07 changes made for version 2.2:

Important: after loading the new software, make sure
you "Load default values" and then "Save changes" from
the tracking menu.

terminal.c/.h:
-Fixed benign bug where old_camera_t_packets was not getting updated in Tracking_Info_Terminal().

-Altered code to use Tracking_Config_Data values for center tilt and pan values instead of hardwired values in Tracking_Info_Terminal().

-Altered code to use Get_Camera_T_Packets() function instead of directly accessing camera_t_packets variable.

camera.c/.h:
-Added Poll_Mode() function.

-Added Get_Camera_ACKs() function.

-Added Get_Camera_NCKs() function.

-Added Get_Camera_T_Packets() function.

tracking.c/.h:
-Altered code to use Get_Camera_T_Packets() function instead of directly accessing camera_t_packets variable.

-Changed default CONFIDENCE_THRESHOLD_DEFAULT values to 10 (was 20).

-Greatly simplified search code (same functionality with less code).

-Changed search parameters so that a fixed tilt angle of about 30 degrees is used.

-For finer control, moved camera pan servo to PWM output 15.

-For finer control, Moved camera tilt servo to PWM output 16.

user_routines_fast.c:
-Replaced call to Generate_Pwms() in User_Autonomous_Code() with a call to PWM().

serial_ports_readme.txt:
-Corrected installation instruction #4.

camera_readme.txt:
-Added Virtual_Window() function description.

-Added Poll_Mode() function description.

-Added Get_Camera_ACKs() function description.

-Added Get_Camera_NCKs() function description.

-Added Get_Camera_T_Packets() function description.

pwm.h:
-Using new PWM() software, optimized camera tilt for a range of 0 to 90 degrees.


-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #2   Spotlight this post!  
Unread 12-02-2007, 14:04
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,187
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

After I just finished porting your tracking software to work with WPILib...!!!!

Can't wait to test the new stuff out. I'm particularly excited about the increased servo resolution.
  #3   Spotlight this post!  
Unread 12-02-2007, 14:17
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 Tom Bottiglieri View Post
After I just finished porting your tracking software to work with WPILib...!!!!

Can't wait to test the new stuff out. I'm particularly excited about the increased servo resolution.
This is the new search code:
Code:
///////////////////
// //
// search code //
// //
///////////////////
 
// To provide a delay for the camera to lock onto the
// target between position changes, we only step the camera
// to a new position every SEARCH_DELAY times while we're 
// in search mode. SEARCH_DELAY is #define'd in tracking.h
loop_count++;
 
if(loop_count >= Tracking_Config_Data.Search_Delay)
{
// reset the loop counter
loop_count =0;
 
// If we're starting a new search, initialize the pan
// and tilt servos to the search starting point.
// Otherwise, just continue the search pattern from
// where we left off. The variable new_search is reset
// to one each time the tracking code (above) executes.
if(new_search ==1)
{
new_search =0;
temp_pan_servo = Tracking_Config_Data.Pan_Min_PWM;
temp_tilt_servo = Tracking_Config_Data.Tilt_Center_PWM; 
}
else
{
// calculate new pan position based upon the current pan servo position
temp_pan_servo = (int)pan_servo_position;
 
// step the pan servo to its next destination
temp_pan_servo += (int)Tracking_Config_Data.Pan_Search_Step_Size;
 
// is the new pan servo position beyond the end of its travel?
if(temp_pan_servo > (int)Tracking_Config_Data.Pan_Max_PWM)
{
// send the pan servo back to the starting position
temp_pan_servo = (int)Tracking_Config_Data.Pan_Min_PWM;
 
// calculate new tilt position based upon the current pan servo position
temp_tilt_servo = (int)tilt_servo_position;
 
// step the tilt servo to its next destination
temp_tilt_servo += (int)Tracking_Config_Data.Tilt_Search_Step_Size;
 
// is the new tilt servo position beyond the end of its travel?
if(temp_tilt_servo > (int)Tracking_Config_Data.Tilt_Max_PWM)
{
// send the tilt servo back to the starting position
temp_tilt_servo = (int)Tracking_Config_Data.Tilt_Min_PWM;
}
// update the local variable used to store the current tilt servo positions
tilt_servo_position = (unsignedchar)temp_tilt_servo;
}
// update the local variable used to store the current pan servo positions
pan_servo_position = (unsignedchar)temp_pan_servo;
}
 
// update the pan and tilt servo PWM value
Set_Pan_Servo_Position(pan_servo_position);
Set_Tilt_Servo_Position(tilt_servo_position);
}
The increased servo resolution was mentioned towards the end of this thread:

http://www.chiefdelphi.com/forums/sh...ad.php?t=51802

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #4   Spotlight this post!  
Unread 12-02-2007, 14:25
team 2244 team 2244 is offline
Carla Sena
FRC #2244 (Free Access Evolution)
Team Role: Teacher
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Brasil
Posts: 13
team 2244 will become famous soon enoughteam 2244 will become famous soon enough
Send a message via MSN to team 2244
Re: Camera Code Update

Thanks for this new version!!!
Our team is having some problems with the CMUCam2.1 version, the tilt and pan is not moving and stuff like this!We`ll try to test this one.
Probably we`ll need to change the PWM`s to other outputs. Am I correct??(we`re newbies, and we need a lot of help!!!)
We hope it works!!!

Bye!
  #5   Spotlight this post!  
Unread 12-02-2007, 14:29
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 Code Update

Quote:
Originally Posted by team 2244 View Post
Probably we`ll need to change the PWM`s to other outputs. Am I correct??
Kevin's revised code takes advantage of the ability to use hardware built into the PIC to generate higher-precision PWM signals on PWM 13-16. This allows you finer control over the tilt and pan of the camera for better triangulation.

So, you could modify the code to use the PWMs you were before, but I would recommend moving to PWM 15 and 16 as Kevin has done.
  #6   Spotlight this post!  
Unread 12-02-2007, 14:37
Goldeye Goldeye is offline
Registered User
AKA: Josh Hecht
FRC #0694 (Stuypulse)
Team Role: College Student
 
Join Date: Jan 2005
Rookie Year: 2005
Location: New York
Posts: 145
Goldeye has a spectacular aura aboutGoldeye has a spectacular aura aboutGoldeye has a spectacular aura about
Send a message via AIM to Goldeye
Re: Camera Code Update

Sounds excellent. I think you should release it as soon as possible; time is running short
__________________
Team 694

2005 Championship - Galileo Semifinalist
2005 New York - Regional Chairmans Award
2005 New York - Semifinalist (Thanks 1257,1340)
  #7   Spotlight this post!  
Unread 12-02-2007, 14:40
team 2244 team 2244 is offline
Carla Sena
FRC #2244 (Free Access Evolution)
Team Role: Teacher
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Brasil
Posts: 13
team 2244 will become famous soon enoughteam 2244 will become famous soon enough
Send a message via MSN to team 2244
Re: Camera Code Update

What you mean when you say better triangulation??
And where do I add this new search code that Kevin has created??
Probably I will do a lot of questions don`t be mad please
Thanks for your help!
  #8   Spotlight this post!  
Unread 12-02-2007, 15:54
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 team 2244 View Post
And where do I add this new search code that Kevin has created??
If you don't already understand the innards of tracking.c, I think you're better off leaving it alone. The 2.1 code does exactly the same thing as this update, just not as elegantly.
  #9   Spotlight this post!  
Unread 12-02-2007, 16:08
Bharat Nain's Avatar
Bharat Nain Bharat Nain is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2003
Location: New York
Posts: 2,000
Bharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond repute
Send a message via AIM to Bharat Nain Send a message via MSN to Bharat Nain
Re: Camera Code Update

Request: Please release the streamlined version of this too.
__________________
-= Bharat Nain =-

Whatever you do, you need courage. Whatever course you decide upon, there is always someone to tell you that you are wrong. There are always difficulties arising that tempt you to believe your critics are right. To map out a course of action and follow it to an end requires some of the same courage that a soldier needs. Peace has its victories, but it takes brave men and women to win them. - Ralph Waldo Emerson
  #10   Spotlight this post!  
Unread 12-02-2007, 17:08
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 Bharat Nain View Post
Request: Please release the streamlined version of this too.
Yes, once I'm reasonably happy with the code, I'll quickly port it over to the streamlined version. Unless I need to make some last minute changes, I'll zip-up the bells & whistles code tonight and post a link here.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #11   Spotlight this post!  
Unread 12-02-2007, 17:22
Bomberofdoom's Avatar
Bomberofdoom Bomberofdoom is offline
Biggest FIRST addict in Israel
AKA: Nir Levanon
FRC #2230 (Zcharia's Angels)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Israel
Posts: 471
Bomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond repute
Send a message via MSN to Bomberofdoom
Re: Camera Code Update

Kevin, PWM outputs 15 and 16 are used for the (left?) motors. If you take those PWM outputs, we won't be able to use the camera to move the robot to the light. But of course, that's not a real issue, since I can change the Servo PWM outputs. But mabye others don't know how do to it and could freak out a bit because some of thier engines are not working.
I don't mind you have changed it, but just thinking about the weaker ones.

Our team will check the code tommorow, tweak it as needed.

Thanks for the update.
  #12   Spotlight this post!  
Unread 12-02-2007, 17:25
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 Alan Anderson View Post
If you don't already understand the innards of tracking.c, I think you're better off leaving it alone. The 2.1 code does exactly the same thing as this update, just not as elegantly.
I'm not sure the new code is elegant, but I am sure the old search code is not elegant .

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #13   Spotlight this post!  
Unread 12-02-2007, 17:33
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 Bomberofdoom View Post
Kevin, PWM outputs 15 and 16 are used for the (left?) motors. If you take those PWM outputs, we won't be able to use the camera to move the robot to the light. But of course, that's not a real issue, since I can change the Servo PWM outputs. But mabye others don't know how do to it and could freak out a bit because some of thier engines are not working.
I don't mind you have changed it, but just thinking about the weaker ones.
Yes, it's a pain, but I need to move the pan and tilt servos to the range 13 through 16 to exploit the new PWM() functionality. You make a good point and I'll make sure it's very clear in the readme_first.txt document that the assignments have changed.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #14   Spotlight this post!  
Unread 12-02-2007, 17:46
Bio's Avatar
Bio Bio is offline
Registered User
AKA: Brian Dellon
None #1389 (Worst Case Scenario)
Team Role: Programmer
 
Join Date: Mar 2004
Rookie Year: 2003
Location: Bethesda, MD
Posts: 8
Bio is an unknown quantity at this point
Re: Camera Code Update

Considering you've got a get, you may very well be including it already, but we would definitely appreciate Reset_Camera_ACKs() and Reset_Camera_NCKs() functions. Not a real big deal, but it would save us a variable.
  #15   Spotlight this post!  
Unread 12-02-2007, 19:48
Tyr333 Tyr333 is offline
Registered User
FRC #1086 (Blue Cheese)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2004
Location: Virginia
Posts: 2
Tyr333 is an unknown quantity at this point
Re: Camera Code Update

I've noticed that when the camera is in a search, if the camera is resetting its pan for a new sweep:
"if(temp_pan_servo >= PAN_MAX_PWM_DEFAULT)
{
temp_pan_servo = PAN_MIN_PWM_DEFAULT;"

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. We don't usually have this problem, but at certain distances from the light it becomes impossible to track. What can we do to fix this?
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 00:26.

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