[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] usb game controllers
On Thursday 23 June 2005 01:25 pm, Bob the Hamster wrote:
> On Thu, Jun 23, 2005 at 12:57:46PM -0500, Terry Hancock wrote:
> > So it appears that you are saying that even a device like this one:
> > http://www.cdw.com/shop/products/specs.aspx?EDC=313623
> > is still just a joystick as far as PyGame is concerned? Is there such
> > a thing as a hardware compatibility guide for this, or can one
> > expect any of them to work? (standard interface?)
>
> USB joysticks/gamepads are *very* standard. The old ones that connect to
> the sound card are less so... but still not bad.
>
> Looking at the gamepad at that link< expect it would probably show up as
> a six-axis 13 button joystick -- of course, it is possible that the
> directional pad and the left thumb stick are duplicates of each other
> (I have a device like that) and also sometimes some of the buttons will
> be duplicates (but usually not)
I see.
> > What, BTW, is a "directional hat". The first thing that comes to mind
> > is a unit vector which is written with a circumflex or "hat". But maybe
> > this is a reference to the shape of a "thumb stick" controller?
>
> That is probably refering to the + shaped directional button. It would
> probably show up as a pair of thresholded analong inputs.
I'm referring to the Joystick object documentation on the PyGame site:
"""
get_numhats
Joystick.get_numhats() -> int
Returns the number of available directional hats on the Joystick.
"""
Which of course, assumes I know what a "directional hat" is.
> Jargon is fun :)
> forgive my rambling about "thresholded analog inputs"
[...]
> Anyway, when the inputs are thresholded, as think might be the case for
> the "hat" you were asking about, the X and Y values will not change
> until they go beyond a certain threshold. So while pushing left on a
> regular joystick would cause the X axis to go negative -.01 -.05 -.18
> -.30 ... -.77 -.86 -1 ... as you pushed it harder and harder, but the
> hat on the other hand would not respond at all to a light touch, but
> might jump all the way to -1 when you press hard enough.
> Does anybody know if there is a pygame wiki out there somewhere where we
> could write up this sort of thing?
I think what would be useful is to make drawings of various types of
controller and diagrammatically show what the terms in PyGame are
referring to. Just like a "visual dictionary" of terms. I'm considering
creating such a drawing for a typical "gamepad" type controller.
> The best thing to do is just buy the thing and play with it.
> It'll be fun! :)
Yeah, but it's very disappointing when they don't work. This is much
less of a problem on Linux than it used to be, but it still can be troubling.
You've convinced me that a usb gamepad is probably worth trying out,
though.
While we're on the subject, what about "Spaceball" devices, such as:
http://www.cdw.com/shop/products/specs.aspx?EDC=479136
These are true "6-axis" devices which register XYZ translation and
PYR rotation of the ball (essentially, you push it the way you want
to go --- it apparently doesn't move very much, it's probably based on
strain gauges?).
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com