Spaceballs and Joysticks

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
lpburke86
Posts: 3
Joined: Thu Oct 15, 2020 10:37 pm

Spaceballs and Joysticks

Post by lpburke86 »

Either someone's mind is never in the gutter, or it's always in the gutter when they named these devices.... but I digress...

So last night I discovered the bug that apparently many people already know about. That is when my Logitech Extreme 3d joystick is plugged in that Freecad sees it as a 3d mouse. I figured out how to disable it and be able to continue to use the program so that's not the issue....

3D Mice are expensive as hell for a device that a casual user only uses every once in a while, but they are crazy handy either way.....

It got me thinking. Since the program already reads it as a spaceball, how hard would it be to set it up as one? It appears the biggest problem is that the axis on a spaceball is always set to the extreme of the axis, and the joystick is always centered.... How would you go about recalibrating it in Freecad to read 0 at center instead of one extreme or the other?
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Spaceballs and Joysticks

Post by wmayer »

lpburke86 wrote: That is when my Logitech Extreme 3d joystick is plugged in that Freecad sees it as a 3d mouse.
The reason is that some very old 3d mouses (SpaceMouse Plus XT USB (VID: 0x046d PID: 0xc603)) are indeed handled as a joystick and not as multi-axis controller which possibly is related to the used driver version: https://github.com/FreeCAD/FreeCAD/blob ... 2.cpp#L411
It got me thinking. Since the program already reads it as a spaceball, how hard would it be to set it up as one?
The most difficult part is to translate the incoming events into 6 numbers to describe the translation and rotation.
https://github.com/FreeCAD/FreeCAD/blob ... .cpp#L1042

In case you are on Windows you should try the latest version and start it with FreeCAD.exe --write-log
This creates the file %APPDATA%\FreeCAD\FreeCAD.log and records the incoming events of your joystick.
User avatar
watsug
Posts: 100
Joined: Sat Sep 26, 2020 10:51 pm

Re: Spaceballs and Joysticks

Post by watsug »

Seem like spaceballs and alternative input devices is this months hot topic! Which I love :)

Here's 3 other related topics
FreeCAD spaceball on arduino https://forum.freecadweb.org/viewtopic.php?f=3&t=53765
Replace 3Dmouse input with generic https://forum.freecadweb.org/viewtopic.php?f=10&t=53854
Diy 8+DOF Controller https://forum.freecadweb.org/viewtopic.php?f=24&t=54367
lpburke86
Posts: 3
Joined: Thu Oct 15, 2020 10:37 pm

Re: Spaceballs and Joysticks

Post by lpburke86 »

Awesome. Thank you yall both. Now I got a place to start
User avatar
SammysHP
Posts: 6
Joined: Sat Dec 19, 2020 6:32 pm
Location: Germany

Re: Spaceballs and Joysticks

Post by SammysHP »

lpburke86 wrote: Sat Jan 16, 2021 10:52 pm 3D Mice are expensive as hell for a device that a casual user only uses every once in a while, but they are crazy handy either way.....
Not necessarily. I've got a 3Dconnexion SpaceNavigator for 40 €. Auction sites are full of them, many with disintegrating rubber coating (which can be removed easily).
eajmarceau
Posts: 73
Joined: Tue Feb 22, 2022 9:16 pm

Re: Spaceballs and Joysticks

Post by eajmarceau »

Hi SammysHP,
SammysHP wrote: Wed Jan 20, 2021 8:07 pm Not necessarily. I've got a 3Dconnexion SpaceNavigator for ... (snip).
My brother gave me a 3dconnexion SpaceNavigator that looks untouched (transparent protective layer still stuck on the bottom chrome rim. Were you able to get that to work on Linux? I'm on UbuntuMATE. 20.04 for now. Moving to 22.04 in a couple of months.

Pause that! I'll go check the Linux site first. Thank you.

Update: After trying without success to download the "spacenavd" package thru my standard Synaptic, which never offered it even after a package list refresh, I ended up circling back to the FreeCAD site's page at https://wiki.freecadweb.org/3Dconnexion ... devices/en. Everything outlined there worked. :) But it looks like I have to do the "Customize" thing to clean up the interraction. Thank you to everyone who contributed to making that work with FreeCAD. It was surely a labour of love.

Code: Select all


OS: Ubuntu 20.04.4 LTS (MATE/mate)
Word size of FreeCAD: 64-bit
Version: 0.20.28611 (Git) AppImage
Build type: Release
Branch: (HEAD detached at a3b804e)
Hash: a3b804e7806c2b3b5e1228c41bca4569a743b400
Python 3.9.12, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: English/Canada (en_CA)
Installed mods: 
  * workfeature
  * Curves 0.3.0
  * offline-documentation 1.0.0-alpha
  * workfeature-macro
  * Pyramids-and-Polyhedrons
Post Reply