|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#6
|
||||
|
||||
|
Re: How do I program a joystick deadband?
Allow me to show you a piece of code my team has used the last three years....
public double deadband(double JoystickValue, double DeadbandCutOff) { if (JoystickValue<DeadbandCutOff&&JoystickValue>(Dead bandCutOff*(-1))) { deadbandreturn=0; } else { deadbandreturn=(JoystickValue-(Math.abs(JoystickValue)/JoystickValue*DeadbandCutOff))/(1-DeadbandCutOff); } return deadbandreturn; } this not only cuts it off at a point, but prevents jumping up to 0.1 after you get past it. it basically smooths the dead band curve. How ever, i would recommend making a algorithm you understand. ((i am still working on understanding this one. lol)) Last edited by techkid86 : 08-10-2012 at 01:31. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|