Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   controller sensitivity (http://www.chiefdelphi.com/forums/showthread.php?t=63404)

kDude 06-02-2008 15:41

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?

kevin.li.rit 06-02-2008 15:43

Re: controller sensitivity
 
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.

psy_wombats 06-02-2008 15:55

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

Code:

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/at...9&d=1201127844

Hope that helps.

kDude 06-02-2008 16:05

Re: controller sensitivity
 
Quote:

Originally Posted by psy_wombats (Post 693322)
As far as joystick sensitivity goes, our team has been using this:

Code:

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 not a 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/at...9&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.

psy_wombats 06-02-2008 16:09

Re: controller sensitivity
 
Sorry, this is the working link:
http://www.chiefdelphi.com/forums/at...9&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.

Jon Stratis 06-02-2008 16:22

Re: controller sensitivity
 
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:
Code:

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.


All times are GMT -5. The time now is 23:48.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi