View Single Post
  #3   Spotlight this post!  
Unread 23-01-2008, 14:13
Steve_Alaniz Steve_Alaniz is offline
Registered User
FRC #2848 (All Sparks)
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 1997
Location: Dallas
Posts: 211
Steve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond repute
Re: steering wheel help FIRST Team 2044

Actually, your post IS a bit confusing, but starting with the last question first, Speed as in forward or backwards is simply a function of the p1y axis on port 1. a joystick plugged into port 1 will automatically take on this role when using the default code and PWM13 - 16. ( this sounds a lot like a throttle BTW)
The trick comes with the wheel part. A car wheel turns the car as long as it is turned and in a rate proportional to the amount of turn. If that's all you want, again, it's done with the default code. but if you want the wheel controlling the X direction and Y the joystick controlling the Y (forward/backward/speed) you need to have the User_routine.c remap the values you want here:
Code:
/*---------- 1 Joystick Drive ----------------------------------------------
  *--------------------------------------------------------------------------
  *  This code mixes the Y and X axis on Port 1 to allow one joystick drive. 
  *  Joystick forward  = Robot forward
  *  Joystick backward = Robot backward
  *  Joystick right    = Robot rotates right
  *  Joystick left     = Robot rotates left
  *  Connect the right drive motors to PWM13 and/or PWM14 on the RC.
  *  Connect the left  drive motors to PWM15 and/or PWM16 on the RC.
  */  
  p1_x = 255 - p1_y;
  p1_y = 255 - pwm05;

  pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);
  pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);
Where it says:
p1_x = 255 - p1_y;
p1_y = 255 - pwm05;



since:

Code:
  *   This maps the joystick axes to specific PWM outputs.
  */
  pwm01 = p1_y;
  pwm02 = p2_y;   
  pwm03 = p3_y;   
  pwm04 = p4_y;   
  pwm05 = p1_x;  
  pwm06 = p2_x;   
  pwm07 = p3_x;   
  pwm08 = p4_x;   
  pwm09 = p1_wheel;
  pwm10 = p2_wheel;   
  pwm11 = p3_wheel;   
  pwm12 = p4_wheel;

If you plug the joystick in port1 and the wheel in port 2 then something like:

p1_x = 255 - p1_y;
p1_y = 255 - pwm06;

not sure this is what you're asking but hope it at least helps.

Steve