Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Pages: [1] 2

Author Topic: 6 DOF device [3Dconnexion space navigator as example]  (Read 6872 times)

Absum

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile
6 DOF device [3Dconnexion space navigator as example]
« on: June 01, 2007, 11:20:29 PM »

A while back I hacked into OIS to get my 3Dconnexion Space Navigator http://www.3dconnexion.com/products/3a1d.php working when I played around with Ogre3D... and guess what, i succeeded, its not pretty code in anyway but i implemented it in the most logical way i could come up with without rewriting OIS whole joystick support.
I have only done this for linux so I don't know if its possible to use the same method in windows but it should be. I made OIS recognize the spacenavigator as a joystick with rel axis instead of abs and then I made an extra callback so that data only is sent on EV_SYN event which makes it a bit easier to work with. I also tried to implement led support but that didn't go too well and is one of the reasons the code is so "unclean".

Anyway, I just wanted to know if anyone is interested in my implemention of this or if someone more skilled and more involved in OIS should do it from scratch?

[EDIT]
If its not obvious by my description I just wanted to say that I don't use 3Dconnexions drivers but instead uses the hid interface (the same way it works for joysticks that is)

[EDIT again]
The new patch:
http://sourceforge.net/tracker/index.php?func=detail&aid=1837755&group_id=149835&atid=775955
« Last Edit: November 24, 2007, 11:48:46 AM by Absum »
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Re: 6 DOF device [3Dconnexion space navigator as example]
« Reply #1 on: June 02, 2007, 07:00:40 AM »

Quote
I made an extra callback so that data only is sent on EV_SYN[/quote
What extra callback did you make?

Anyway, the device looks interesting, though I'm not so sure a joystick with relative axes would be that easy to use - especially in a generic way (as in interchangeable with other joysticks). But, that is why I have the isAbs flag :-) Thinking about it, though, I could always make other joystick devices report relative values in addition to their absolute position, as it would simply be a matter of storing the last reported value... hmm.

Though, the device looks more like a mouse than a joystick. Perhaps it makes more sense to modify the mouse class a bit to support more axis?

x & y could be the north/south and east/west movement.
   
z could be the up/down motion.

As for rotate, maybe a vector3 control that would describe the current rotation? Just a suggestion, looks pretty cool. I'd be interested in seeing what values it generates.
Logged

Absum

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile
Re: 6 DOF device [3Dconnexion space navigator as example]
« Reply #2 on: June 02, 2007, 03:48:11 PM »

The extra callback is just a callback to get a Vector6 on EV_SYN, I'm pretty sure its a bad way of implementing it but i got the idea from the vector3moved or whatever its called.

I use it as a replacement for my mouse when im playing with physics simulations and such, i have a pretty hard time coming up with a functional game for the SpaceNav but I'm sure its possible ;) 3Dconnexion recommends it to be used in your left hand with your mouse in your right when modelling in 3D, soon blender supports the spacenav too.

I'm pretty sure its possible to change the mouse class instead but doesn't it use XInput on Linux? That would (too me atleast) be much more complicated to implement then to just access it the same way as a joystick. But something that I came up with on my second or third attempt to make it work is that there should be an eventdevice class that the joystick class can inherit from... or maybe that just makes sense in linux? I know OIS i mainly aimed at game input but I still think it should support as much as possible, maybe even haptic devices in the future, like the Novint falcon (or whatever its called).

What values the spacenav generates? You get REL_X(...) and REL_RX(...), integers from both if i remeber correctly, the raw data is generally somewhere in the range -300 - 300 (but it was a while i messed with it).

And leds, have to have leds, my spacenav looks soo sad when it stands on my desktop without its shiny blue light :(

Oh and if anyone is planning on making their own patch, remeber that the 3dconnexion linux drivers does something ugly so after having run the drivers you have to unplug/replug the device for the event device to register.

And finally, sorry for this post, im tired and have had a little bit of alcohol.
Logged

Krulspeld

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 3
    • View Profile
Re: 6 DOF device [3Dconnexion space navigator as example]
« Reply #3 on: June 04, 2007, 01:11:49 AM »

I have an interest in using the 3DConnexion devices from OIS, so I am interested in the implementation...
Logged

jorrit5477

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 11
    • View Profile
Re: 6 DOF device [3Dconnexion space navigator as example]
« Reply #4 on: June 04, 2007, 03:31:37 AM »

I started with a Win32 implementation a while ago, but I am very busy in another project till july. My implementation was based on the WiiMote implementation though (addon factory, etc.), and I believe I made it a joystick as well (but using three axes instead of two and including rotation). I do not agree it is more a mouse type device.

I hope to continue the project from July, when I finaly have finished school.

Although it is a 6DOF device, it's interaction methods are absolutely different than 6DOF devices as haptic devices, which have true absolute positioning devices.

But I am curious about your implementation indeed.
Logged

Absum

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile
Re: 6 DOF device [3Dconnexion space navigator as example]
« Reply #5 on: June 04, 2007, 03:59:52 PM »

Ok, i made a really dirty patch here over all the changes that i've made to the source code for this to work... but there is also alot of junk code, like the code for leds which i didn't know how to do really. I should probably also point out that the code very well could mess something up with regular joystick.

Anyway here it is: http://sourceforge.net/tracker/index.php?func=detail&aid=1837755&group_id=149835&atid=775955

If you find anyway to improve this or if you clean the patch up a bit please post it and ill replace the one on my server.

[edit]
updated the url to the patch.
« Last Edit: November 24, 2007, 11:49:51 AM by Absum »
Logged

Game_Ender

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 4
    • View Profile
Re: 6 DOF device [3Dconnexion space navigator as example]
« Reply #6 on: September 17, 2007, 05:41:39 PM »

The patch is gone.  Can you reupload it?  It really doesn't seem that hard to add support, all you need to do is provide 6 joystick axes and then map the buttons.
Logged

robagar

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 5
    • View Profile
Re: 6 DOF device [3Dconnexion space navigator as example]
« Reply #7 on: October 26, 2007, 12:10:33 AM »

Anyone have this device working in OIS? 

Looks pretty on my desk with it's blue LEDs, but it's just a paperweight right now :(
Logged

Absum

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile
Re: 6 DOF device [3Dconnexion space navigator as example]
« Reply #8 on: October 26, 2007, 12:57:32 PM »

The patch is gone.  Can you reupload it?  It really doesn't seem that hard to add support, all you need to do is provide 6 joystick axes and then map the buttons.

Anyone have this device working in OIS? 

Looks pretty on my desk with it's blue LEDs, but it's just a paperweight right now :(

The link works again now, its still old and dirty, please take care of it.
Logged

robagar

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 5
    • View Profile
Re: 6 DOF device [3Dconnexion space navigator as example]
« Reply #9 on: October 26, 2007, 01:37:25 PM »

magic, thanks! 

I'm a bit confused - why doesn't it just work as a joystick with 6 axes?  Clearly it doesn't,  but I just don't get why not...
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/
Re: 6 DOF device [3Dconnexion space navigator as example]
« Reply #10 on: October 26, 2007, 02:36:57 PM »

He wasn't thinking of it in those terms, his way works, it is just not 'standard'.  Would not be hard to make it standard though.
Logged

robagar

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 5
    • View Profile
Re: 6 DOF device [3Dconnexion space navigator as example]
« Reply #11 on: October 26, 2007, 02:49:40 PM »

sorry, what I meant was, why does the unpatched OIS code not just work?  Stepping through the code it looks like it initializes the device OK as a 6-axis joystick.  I'm no DI expert, but it looks like the action ID isn't being set properly when GetDeviceData is called in capture().  Would that be a driver bug?
Logged

Absum

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile
Re: 6 DOF device [3Dconnexion space navigator as example]
« Reply #12 on: October 26, 2007, 03:01:04 PM »

Well for starter a joystick passes absolut values while a spacenavigator passes relative values... a minor thing but its probably the biggest difference that I remeber from making the patch. And joysticks doesnt often have leds... you have to have leds!
Logged

Absum

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 13
    • View Profile
Re: 6 DOF device [3Dconnexion space navigator as example]
« Reply #13 on: October 26, 2007, 03:06:30 PM »

And I have to recommend http://www.3dconnexion.com/forum/viewtopic.php?t=1310 to all you spacenav users out there, an excellent open-source replacement for the driver that doesn't f*s up the device handling as the original driver from 3dconnexion does.

Thinking of that I should probably warn everyone who hasn't figured that out or read it somewhere that if you try my patch for ois and the device isn't found after you have run the 3dconnexion driver try un/replugging the device, I'm guessing this is only a problem in linux.
Logged

robagar

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 5
    • View Profile
Re: 6 DOF device [3Dconnexion space navigator as example]
« Reply #14 on: October 26, 2007, 04:36:55 PM »

hi Absum -  the patch (and the replacement driver) is for linux support only isn't it? Did you by any chance look at adding stuff for DI / win32?
Logged
Pages: [1] 2