Quote:
|
Originally Posted by bob1million
My fellow programmers and I have tried many different ways to desensitize our joysticks, but none of ways work very well. Does anyone know a good way to desensitize them?
|
It seems the problem is big enough to cause some serious thread resurrection.
Here was Team 188's solution to sensitive joysticks for 2004 courtesy Carol, Honson, Tristan and myself:
Code:
temp_p1_long = (signed long)p1_y - 128;
pwm01 = (unsigned char)(((temp_p1_long * temp_p1_long * temp_p1_long) >> 14) + 128);
temp_p2_long = (signed long)p2_y - 128;
pwm02 = (unsigned char)(((temp_p2_long * temp_p2_long * temp_p2_long) >> 14) + 128);
make sure you declare temp_p1_long and temp_p2_long as signed long beforehand.
In a nutshell, it's a cubic transfer function that makes the robot accelerate exponentially when you push the joystick. There's a nice wide area to operate slowly, yet full speed is still there when you push it all the way.
We spent a few days testing different transfer functions, and this one worked out the best.
It's pretty CPU intensive (multiplying long integers), and a look-up table would be faster, but try it for a quick and dirty way to get things working smoothly. You can generate a look-up based on the code later on.
Cheers!
-SlimBoJones...