Go to Post I didn't say this! - Max Lobovsky [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 23-01-2007, 16:49
Inverted Inverted is offline
Registered User
AKA: Eric P.
FRC #1228 (Robo Tribe)
Team Role: College Student
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Rahway, NJ
Posts: 25
Inverted is an unknown quantity at this point
Send a message via AIM to Inverted
Camera track and drive integration code

After 3 years of frustration, broken cameras, and bad programming, I finally got the camera to track the light. (Kevin Watson, you are a god!) Now that a third of our autonomous code is done, all we have left to do is get the bot to move towards the light once the camera has locked on, and then have it operate our arm mechanism. I pretty much know how to write the code to operate the arm, but I have no idea how to go about getting the bot to track to the color.

From what I've been reading, I'm under the impression that Kevin's code has a function that does this, but I haven't been able to find it. Then again, I could be completely wrong about this. If I'm correct, which function would it be? And if I'm not, could someone point me towards where I could find the code that does this or a resource that will teach me how to (preferably the former). Any help is much appreciated.
  #2   Spotlight this post!  
Unread 23-01-2007, 22:32
jtdowney jtdowney is offline
Boiler Up
AKA: John Downey
FRC #4302 (Robophins)
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2006
Location: Chicago
Posts: 300
jtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant future
Re: Camera track and drive integration code

I have not read through Kevin's code completely but I have yet to see code that will align the robot for you. Given the wide range and style of drivetrains I wouldn't think that would be practical.

Kevin's code does however give you convient access to the pan and tilt angles and using what you know about trigonometry you should be able to work out a way to figure out what you need the robot to do. Another thing to consider is when you have a large blob size then you know you are either tracking two green lights or have a green light very close to the camera (unlikely in a competition). Using that data you should be able to work out how far you need to go forward before you can play your peice.
  #3   Spotlight this post!  
Unread 25-01-2007, 02:00
teh_pwnerer795 teh_pwnerer795 is offline
Registered User
AKA: !!Mitch!!
FRC #1392
Team Role: Programmer
 
Join Date: Nov 2006
Rookie Year: 2006
Location: Ajax, Canada
Posts: 142
teh_pwnerer795 is just really niceteh_pwnerer795 is just really niceteh_pwnerer795 is just really niceteh_pwnerer795 is just really nice
Send a message via MSN to teh_pwnerer795 Send a message via Yahoo to teh_pwnerer795
Re: Camera track and drive integration code

Basically,

pwm01 = 124; // camera's PAN servo
pwm09 = 127; // left wheel
pwm10 = 127; // right wheel

if (pwm01 > 127)
{
pwm09 = 0; //turn left
pwm10 = 254;
}
else if (pwm01 < 127)
{
pwm09 = 254; // turn right
pwm10 = 0;
}

Now .. this way is simple! but its not effective... again... u have to use trig and some math as well to calculate where the object is.. either way.. it works.. and this year.. u will not have to worry about the camera tracking more then 1 light at a time..... thats a majorly different story and takes too long to understand and program.. so first focus on allowing the robot to align itself, then drive forwards and backwards.

EDIT: WOW... ok .. i am not thinking today! its like 2am... for my code.. i got really lazy ... i just point the TILT to the target is that the values would be centered... if it was greater then that number... move backwards.... ..else if it was less then that number... move forwards,... very simple..

Also in my code.. for it to drive forwards, backwards, left and right. i just pasted my values into the 1 joystick drive code.

pwm09 = Limit_Mix(2000 + PAN + TILT - 127)
pwm10 = Limit_Mix(2000 + TILT - PAN + 127)

Also keep in mind that the height of the camera effects all ur values.. have fun..
__________________
Great Art is Created; Master Pieces are Stolen

[n00b]Teh_Foxdonut teh_pwnerer795 - CounterStrike:Source

Last edited by teh_pwnerer795 : 25-01-2007 at 02:07.
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
EasyC for FRC: Drive and Auto Track Camera Code Kingofl337 Programming 7 08-01-2007 15:30
Autonomous Camera Integration GregC Programming 2 06-02-2005 14:34
Autonomous Camera Integration GregC Programming 1 05-02-2005 18:56
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 13:40.

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