Re: [osg-users] usb joystick in openscenegraph

2008-08-14 Thread Eric Sokolowsky
You may also find that DIVERSE can fill your needs. It's a virtual reality
controller that can be used with osg.
See: http://diverse-vr.org/index.php?page=documentation/introduction

-Eric

On Tue, Aug 12, 2008 at 12:35 PM, Jan Ciger [EMAIL PROTECTED] wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Hi Mike (and Joe),

 Mike Connell wrote:
 | Hi,
 |
 | I was in the same position this summer. Previously I'd used SDL for a
 |  gamepad, but now needed to resurrect that code and redo it for a
 | wheel+pedals.
 |
 | I looked at vrpn but failed to really grok it. In the same time it
 | took me to bash my head against the vrpn examples, I wrote the sdl
 | code. The following should be enough for you to do a quick test. SDL
 | also supports hats, and force-feedback was part of the Google
 | Summer of Code, but I haven't seen any results of that yet.
 |

 SDL is good if you need only simple joysticks/wheels etc. and do not
 need network transparency.

 On the other hand, if one requires network transparency because the
 simulator machine(s) are separate from controller input or you need
 support for HID controllers that are not joysticks - such as tablets,
 the SpaceNavigator and similar, or virtual reality hardware, SDL will
 not help you. VRPN was built for that. BTW, basic VRPN client is
 probably even shorter than you SDL example.

 Regarding force feedback - there is no support for that in any
 officially released SDL version.

 Regards,

 Jan
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (GNU/Linux)
 Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

 iD8DBQFIoeX5n11XseNj94gRAlR8AKC2RXleH50RFXFUzBKnAAhUNiu/aACg0DI6
 JkOK/FuthnNucluwVmY05OI=
 =Ogbu
 -END PGP SIGNATURE-

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] usb joystick in openscenegraph

2008-08-12 Thread Joe Lyga
I'm interested in using a usb joystick and/or wheel with openscenegraph.
They're both usb human interface devices.  Has anyone done any work with usb
human interface devices in openscenegraph, or used usb gamepads, joysticks,
or wheels as inputs?

I've heard about a few solutions, including Object Oriented Input System,
SDL, and VPRN.  I'm looking for a multiplatform solution that doesn't
necessarily have to be that complicated.

Thanks!
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] usb joystick in openscenegraph

2008-08-12 Thread Mike Connell

Hi,

I was in the same position this summer. Previously I'd used SDL for a 
gamepad, but now needed to resurrect that code and redo it for a 
wheel+pedals.


I looked at vrpn but failed to really grok it. In the same time it took 
me to bash my head against the vrpn examples, I wrote the sdl code. The 
following should be enough for you to do a quick test. SDL also supports 
hats, and force-feedback was part of the Google Summer of Code, but I 
haven't seen any results of that yet.


best wishes

Mike
ps) Note this is hard-coded for 10 buttons+5axis

void testSDLJoystick() {

SDL_Joystick *joy;

// Initialize the joystick subsystem
SDL_InitSubSystem(SDL_INIT_JOYSTICK);

// Check for joystick
if(SDL_NumJoysticks()0){
 // Open joystick
 joy=SDL_JoystickOpen(0);
 
 if(joy)

 {
   printf(Opened Joystick 0\n);
   printf(Name: %s\n, SDL_JoystickName(0));
   printf(Number of Axes: %d\n, SDL_JoystickNumAxes(joy));
   printf(Number of Buttons: %d\n, SDL_JoystickNumButtons(joy));
   printf(Number of Balls: %d\n, SDL_JoystickNumBalls(joy));

   double axis[5];
   bool button[10];
   for(;;) {
   SDL_JoystickUpdate();
   printf(Joystick );
   for(int i=0;i5;i++) {
   axis[i]=SDL_JoystickGetAxis(joy,i) / 32768.0;
   printf(a_%d=%0.3f ,i,axis[i]);
   }
   for(int i=0;i10;i++) {
   button[i]=SDL_JoystickGetButton(joy,i);
   printf(b_%d=%d ,i,button[i]);
   }
   printf(\n);
   }

 }
 else
   printf(Couldn't open Joystick 0\n);
 
 // Close if opened

 if(SDL_JoystickOpened(0))
   SDL_JoystickClose(joy);
}

Joe Lyga wrote:
I'm interested in using a usb joystick and/or wheel with 
openscenegraph.  They're both usb human interface devices.  Has anyone 
done any work with usb human interface devices in openscenegraph, or 
used usb gamepads, joysticks, or wheels as inputs?


I've heard about a few solutions, including Object Oriented Input 
System, SDL, and VPRN.  I'm looking for a multiplatform solution that 
doesn't necessarily have to be that complicated.


Thanks!


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] usb joystick in openscenegraph

2008-08-12 Thread Jan Ciger

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Mike (and Joe),

Mike Connell wrote:
| Hi,
|
| I was in the same position this summer. Previously I'd used SDL for a
|  gamepad, but now needed to resurrect that code and redo it for a
| wheel+pedals.
|
| I looked at vrpn but failed to really grok it. In the same time it
| took me to bash my head against the vrpn examples, I wrote the sdl
| code. The following should be enough for you to do a quick test. SDL
| also supports hats, and force-feedback was part of the Google
| Summer of Code, but I haven't seen any results of that yet.
|

SDL is good if you need only simple joysticks/wheels etc. and do not
need network transparency.

On the other hand, if one requires network transparency because the
simulator machine(s) are separate from controller input or you need
support for HID controllers that are not joysticks - such as tablets,
the SpaceNavigator and similar, or virtual reality hardware, SDL will
not help you. VRPN was built for that. BTW, basic VRPN client is
probably even shorter than you SDL example.

Regarding force feedback - there is no support for that in any
officially released SDL version.

Regards,

Jan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFIoeX5n11XseNj94gRAlR8AKC2RXleH50RFXFUzBKnAAhUNiu/aACg0DI6
JkOK/FuthnNucluwVmY05OI=
=Ogbu
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org