Native joystick support

Ok, but a generic joystick is a set of analog (axes) and digital (buttons) outputs.

So:

  1. in the constructor I should define the number of axes (usually greater than 2) and buttons of a specific joystick (defined by an index) and register all outputs;
  2. in a “set_source” method I can re-define all outputs previously defined in the constructor (changing the joystick index);
  3. in the “do_transmit_data” method I send all outputs to the data tree.

Is it correct?

Some questions:

  • What kind of data inputs my class receives?
  • What kind of data outputs I should use for analog axes?
  • What is the “AnalogNode” class?

Thanks David!

Ah, hmm. It’s been a while since I looked at the whole ClientBase device layer. You’re right, perhaps AnalogNode and ButtonNode would be a better interface for you to hook into, because it’s already doing all this interfacing into the data graph.

This system of nodes, including AnalogNode, ButtonNode, DialNode, and TrackerNode, was originally designed to provide the API too hook into VRPN, which provides a standard interface to all of these kinds of devices. These are the generic interfaces; the actual VRPN specializations are things like VrpnAnalogDevice and VrpnButtonDevice.

Now that I look more closely, it probably does make more sense for you to subclass from ClientAnalogDevice and/or ClientButtonDevice, and add the functionality for reading your joystick axes and buttons. Because of the design, a single joystick will be represented by multiple device objects–one for the axes, and another one for the buttons.

You’ll also need to subclass ClientBase; the ClientBase object is used to represent the “device” that hosts the joystick. In the VRPN case, this contains a handle to the VRPN server. In your case, it may not have any important information, since everything is local to the computer.

Anyway, if you go this route, than you can use the existing AnalogNode and ButtonNode to put your devices in the data graph.

David

Mmmm, can I create a JoystickNode which has an AnalogNode and a ButtonNode as children, so the final node is composite?

How ClientBase, (Analog/Button)ClientDevice and (Analog/Button)Node interact one to each other (which is the workflow)?

Yes, I think this is possible; though I’m not sure it’s necessary. I can see the value of consolidating the interface, though.

The user will start by creating an instance of your SystemClient (not sure what it should be called). This is the subclass of ClientBase. Using this instance, he can create any number of SystemAnalogDevice etc. objects, which subclass from ClientAnalogDevice. Each of these corresponds to the analog controls for a particular joystick. Then he can attach the SystemAnalogDevice object(s) into the data graph.

David

What is happening with this project?
Gamepad support would be great :slight_smile:

The solution is to integrate OIS:

sourceforge.net/projects/wgois/

Does anyone still have the old libjstar/Panda integration code? The libjstar google code site seems to be offline (I get a 403 when I go to it) so I can’t really get at the code.

If I could get my hands on the latest version of the Panda-integration code you wrote, I could probably switch it over to OIS, if that seems like the best course to take.

Sorry for the bump but I too am interested

I only have this in case it helps.

dl.dropbox.com/u/14000546/libjstar.7z

Anyone have any not C/C++ programer instruction on how to get this to work with Panda?