Go to Post Only think of Gracious Professionalism as a standard to work toward personally. Never use it as a gauge to point out someone else’s shortcomings. - Rich Kressly [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 17-02-2013, 09:36
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Deadband Help

Quote:
Originally Posted by Ether View Post

Let "J" be your joystick value, in the range -1 to +1.

Let "d" be your desired +/- deadband.

Let "out" be your modified joystick command (incorporating the deadband).


Then:

Code:
if (J>d) out = (J-d)/(1-d);

else if (J>-d) out = 0;

else out = (J+d)/(1-d);

"d" is the deadband tuning parameter in the range 0 <= d < 1

Attached is a graph of what the above code produces for d=0.2:
Attached Thumbnails
Click image for larger version

Name:	deadband.png
Views:	14
Size:	4.7 KB
ID:	14060  
Reply With Quote
  #2   Spotlight this post!  
Unread 19-02-2013, 19:33
garyk garyk is offline
Programming Mentor: 668, 972, 2643
FRC #0668 (Apes of Wrath)
Team Role: Mentor
 
Join Date: Dec 2006
Rookie Year: 2005
Location: Santa Clara (Silicon Valley) Calif.
Posts: 93
garyk is a jewel in the roughgaryk is a jewel in the roughgaryk is a jewel in the roughgaryk is a jewel in the rough
Re: Deadband Help

Another way to create deadzone-behaviour is to square the joystick X, Y, or Z value (and preserve the original sign, so a negative joystick value gives a negative result). For example, a js value of 0.5 gives a square of 0.25, but the maximum value of 1.0 still gives 1.0.

The way I learned this is an example of why I love to be a mentor. I'd written the algebra to implement a dead zone and with two slopes - it was complicated and when I tried to teach it at a WRRF programming workshop I confused most of the students. Afterwards a student (I think from FRC1700, Gatorbotics) told me about the square trick - it did what I wanted and was far easier to teach and implement.
__________________

Silicon Valley Regional 2005, 2006 972
Silicon Valley Regional 2007 668 Xerox Creativity Award
Championship Event 2007 668
Portland Regional 2008 668
Silicon Valley Regional 2008 668, 972
Beta Test Team 2008 668 (with 100 & 254)
Silicon Valley Regional 2009 668 Regional Chairman's Award; 2643
Sacramento Regional 2009 668 Winning Alliance (thanks, 1717 & 2473!), 2010 Winning Alliance 3256
CalGames 2006, 2007, 2008, 2009, 2010, 2011 Field Tech
NorCal FTC Regional 2008, 2009 Inspector
Championship Event 2009
San Diego, Silicon Valley Regionals; Champ. Event 2010 668, 2643, 3256
Silicon Valley, Madera Regional 2012 2643
WRRF Programming Instructor 2006-2016
Regional Woodie Flowers Award 2014 2643 Utah Regional

Reply With Quote
  #3   Spotlight this post!  
Unread 19-02-2013, 20:11
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Deadband Help

Quote:
Originally Posted by garyk View Post
Another way to create deadzone-behaviour is to square the joystick X, Y, or Z value (and preserve the original sign, so a negative joystick value gives a negative result).
Or use a simple function as shown in the attachment and you can adjust the sensitivity to suit your taste.
Attached Thumbnails
Click image for larger version

Name:	sensitivity adjustment.png
Views:	23
Size:	12.9 KB
ID:	14126  
Reply With Quote
Reply


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 13:58.

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