View Single Post
  #1   Spotlight this post!  
Unread 02-08-2012, 14:08
F22Rapture's Avatar
F22Rapture F22Rapture is offline
College Student, Mentor
AKA: Daniel A
FRC #3737 (4H Rotoraptors)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Goldsboro, NC
Posts: 476
F22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant future
How do I program a joystick deadband?

I'm using an Xbox controller, which are notorious for not returning to center properly. I want to use a threshold of +- .1 (on a scale of -1 to 1).

I assume it would be something like:

Code:
if ((joystick < .1) && (joystick > -.1)) {
return 0;
}
but I'm new to Java and have no idea where I would put the statement.


Also: I'm planning on using one thumbstick to turn, and the right trigger as throttle, but I'm not sure how you would accomplish that and most tutorials are either for tank drive or in languages other than Java.

Thanks!
Reply With Quote