Go to Post Improve yourself. Try not to tear others down. - Tom Line [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 08-10-2012, 01:24
techkid86's Avatar
techkid86 techkid86 is offline
Magic Programer
FRC #3044 (0xBE4)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: ballston spa
Posts: 58
techkid86 is an unknown quantity at this point
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))
__________________
"you can build a perfect machine out of imperfect parts" -Urza

Last edited by techkid86 : 08-10-2012 at 01:31.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:49.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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