View Single Post
  #5   Spotlight this post!  
Unread 31-01-2008, 07:19
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 685
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: 1 Joystick Control

See also this thread.

Hmmm... I never thought about putting the subtraction outside of the Limit_Mix() function. I had it inside:

Code:
   //Put modified joystick numbers into the four motors
   //The (256- ) part reverses one side's motors so no reverse wiring is needed!

   pwm13 = pwm14 = Limit_Mix(2000 +        p1_yNew  +        p1_xNew  - 127);
   pwm15 = pwm16 = Limit_Mix(2000 + (256 - p1_yNew) - (256 - p1_xNew) + 127);
You can also create a spreadsheet to check the range.

Reversing motors isn't the only problem us programmers have to go thru. We loaded up code on our brand-spanking new robot that we've been testing on last year's robot for the past -- well, the past year, come to think of it. New robot goes all which-way crazy directions. (Didn't help that one side's motors weren't working.) Shop says "programming error!" (Yeah, right!) Check wiring from last year to this year. Red-to-red, black-to-black. Everything checks out. Turns out (40 minutes later!) new robot has one less set of gears, so motor output to wheels is now opposite from last year. Shop says "oh yeah." Sigh....

But this year we had our autonomous working (on last year's robot) before they even built the robot! Woo-hoo!