controller sensitivity

Our team is using the Xbox 360 controller to drive the robot, but the analog sticks are very sensitive, like when we barely press it it’ll take off. Is there any way to lower the sensitivity of the controller?

You can add some acceleration/deceleration code to slowly ramp up the output of the PWM. You could also increase what the neutral value of the PWM is. I.E. if you push it your joystick full foward, then it goes to 255 in some amount of time instead of instantly.

As far as joystick sensitivity goes, our team has been using this:

long ramping (unsigned char ramp)
{
    long answer = 0;
    answer =  ((long)ramp - 127);
    answer = ((answer) * (answer) * (answer));
    answer = ((answer) / (128 * 128));
    answer = (answer) + (127);
    return answer;
}

It’s cubic function. You should be able to have max speed at full forward, but also have better control with lower values. Something like:

http://www.chiefdelphi.com/forums/attachment.php?attachmentid=6109&d=1201127844

Hope that helps.

Care to explain more? Sorry, I’m just very confused as to what exactly that does. And the link doesn’t work.

Sorry, this is the working link:
http://www.chiefdelphi.com/forums/attachment.php?attachmentid=6109&d=1201127844

So, this a cubic function. It sort of is like an exponential growth, but even in the negative region. What it’s doing is taking the cube and then dividing by the square of neutral. It results in this: When the joystick is at half forward, the speed is cut in four. However, at full forward, it produces the full speed. With normal division, your max speed is cut. This eliminates the issue.

We’re using a very similar function in our code, and an x-box controller and it works great… the best way to look at it’s capabilities is to run some numbers through it:


in	out
-127	-127
-120	-107
-110	-83
-100	-62
-90	-45
-80	-32
-70	-21
-60	-13
-50	-8
-40	-4
-30	-2
-20	0
-10	0
0	0
10	0
20	0
30	2
40	4
50	8
60	13
70	21
80	32
90	45
100	62
110	83
120	107
127	127

So it reduces sensitivity at the center (ie your robot doesn’t move at all when you aren’t touching the controller), and it increases the range at which your robot is manageable (ie doesn’t have a huge speed), but it gives you the maximum speed when you really need it.