View Single Post
  #2   Spotlight this post!  
Unread 08-02-2007, 18:03
Mike Copioli's Avatar
Mike Copioli Mike Copioli is offline
You make it pretty We make it dance
no team (Retired(3539, 217))
Team Role: Engineer
 
Join Date: Jan 2006
Rookie Year: 2001
Location: Romeo
Posts: 453
Mike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond repute
Re: Reliable way to detect disconnected controller

Quote:
Originally Posted by heydowns View Post
We've been using the chicklet with great success for two different controllers.

We recently moved into using enough buttons that using the "digital buttons mapped into an analog channel" feature was necessary (> 4 buttons).

When programming to this, it became apparent that there wasn't an easy and reliable way to tell if the values you were decoding were actually the button presses versus "junk" when the controller is unplugged.

This stems from the fact that the OI puts analog channels at 127 when disconnected (this appears as button 1 always pressed). Likewise in autonomous.

With the chicklet connected, but the controller/peripheral disconnected, the value hovers around 126, 127, 128. In software this, of course, looks like alternating presses of button 1 and buttons 2, 3, 4 together.

Now... is this a big deal? Not really, but it is something to be aware of if you use the "digital buttons in an analog space" for potentially hazardous robot controls (drive train go really fast, for example). We've had cases where robot is on and enabled and a controller is loose/unplugged in the past.

Anyone come up with creative ways to detect if the controller is actually present?
You are correct. This will always be an issue when using the analog pins for digital data. The best approach is to ensure that your device is properly connected an has detected and connected your gamepad/joystick (green LED) Even with these precautions in place, a joystick can still be accidentally disconnected during match play. My advice is to not attach any dangerous or irreversible functionality such as ramp/lift deployment, to the high bit.
__________________
Mike Copioli
CTRE Hardware Engineer
http://www.ctr-electronics.com

Team 3539 The Byting Bull Dogs
2013 Michigan State Champions
Team 217 The Thunder Chickens
2006 World Champions
2008 World Champions
2009 Michigan State Champions
Reply With Quote