View Single Post
  #1   Spotlight this post!  
Unread 30-01-2008, 20:24
usbcd36's Avatar
usbcd36 usbcd36 is offline
Registered User
AKA: "DOS"
FRC #2399 (The Fighting Unicorns)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Solon, OH
Posts: 151
usbcd36 is a jewel in the roughusbcd36 is a jewel in the roughusbcd36 is a jewel in the rough
Re: 1 Joystick Control

That code assumes that both motors (or sets of motors) move the robot in one direction when they are going forwards. In order to make it work for conventional systems, you need to reverse one of the sides. Simplest way to do that is subtract the value you assign to the PWM outputs from 254:



Code:
  p1_x = 255 - p1_y;

  p1_y = 255 - pwm05;



  pwm13 = pwm14 = 254 - Limit_Mix(2000 + p1_y + p1_x - 127);  // reverse this side

  pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);