View Single Post
  #27   Spotlight this post!  
Unread 03-02-2004, 14:47
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Desensitizing Joysticks

I've posted the low pass filter on the white pages. It's called low pass filter. (Duh! )

An example usage:
Code:
...
pwm01 = rampPWM(pwm01, where_we_want_it, 6, 5);
...
Basically, you call this function with what your current speed is, where you want it to be, how fast you want it to get there (higher numbers are faster), and how large you want the dead zone to be (i.e. if the joystick is at 129, you probably want to be at 127. You can set how far from 127 it will be corrected with this param.). It returns what value you should set the PWM to next.

By calling this function multiple times you get a nice gradual increase in output values, so if you move the joystick as fast as you can in circles, very little of that will be picked up. How sensitive it is to input is set by you. The exact equation for finding what to set sensitivity to:
255
-------------- = t
(1000/26.2)*s

t is time in this equation. deterimine what time (in seconds) you think is best for it to be able to go from full reverse to full forward and plug that equation. Solve and use that as your input to the function, ignoring any decimal portion. For instance, if t = 1 sec, then s = 6.

Note that the equation assumes it is being called every 26.2 ms.

Post again if you have any questions about the code or if you'd like to comment on it.

PS I had to re-write it because somebody took my disk that I had that on, so it hasn't been complied. It should be right, though.
__________________


Last edited by Ryan M. : 03-02-2004 at 14:56.