View Single Post
  #9   Spotlight this post!  
Unread 23-03-2008, 13:16
tseres's Avatar
tseres tseres is offline
obsessed with FIRST...
FRC #1565 (Think Tank Tech)
Team Role: Leadership
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Cambridge, ON
Posts: 305
tseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of light
Re: control all driving with one joystick

Quote:
Originally Posted by T3_1565 View Post
Those are the extremes, and then we set up a blend function (not sure if it something we made or not though) to blend the extremes together for any other joystick position.
for the record, yes, we made it. the best example i've seen is in the IFI 2007 default code (NOT kevin watson 2008 code). in user_routines.c, look for the limit_mix() function as where as where it is called. that's basic tank drive. now, if you're like me, that's way too complicated. simplify it. make the right side wheels and the left side wheels the actual joystick value, then blend (add to) the x-axis joystick values to what the wheels are already doing.

EX.

pwm01=pwm02=p1_y; //right wheels forward with the joystick
pwm03=pwm04=flip(p1_y); //flip() simply makes 255 into 0, and so on

pwm01=pwm03=blend(pwm01,p1_x); //add p1_x to what pwm01 is already doing
pwm03=pwm04=blend(pwm03,flip(p1_x)); //same with other side.


of course, this is very simple. when you realize that the KOP joysitcks arent the bast things to use and have a lot of error, you'll want to make a function that returns if it's around a certain value, say, 127 perhaps?

good luck!
__________________