View Single Post
  #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.