jfedor2 / magellan-spacemouse

Adapter to use RS-232 Magellan/SpaceMouse with modern software
37 stars 8 forks source link

Internal workings #2

Open MohrJonas opened 1 year ago

MohrJonas commented 1 year ago

I'm trying to adapt this software to a DIY spacemouse and was wondering if you could elaborate on the internal workings a bit more. Looking at the source code, descriptors.c seems pretty clear to me. As far as I understand it, it defines the USB manufacturer, model and some other stuff.
My understanding of magellan.c is the following:

jfedor2 commented 1 year ago

That's the serial protocol that the legacy device speaks (the one we're adapting). If you're making your own it's not really relevant to you. You'll be reading the data from whatever sensors your device has instead.

MohrJonas commented 1 year ago

Alright, thank you for that information. What data does the trans_report, rot_report and buttons_report expect?

jfedor2 commented 1 year ago

The translations and rotations are 16-bit signed values (though only -350..+350 range is used I think), one for each axis. Buttons are one bit per button, though not all of them are actually used. button_bits has some bit positions that are definitely mapped to something on a SpaceMouse Pro.

MohrJonas commented 1 year ago

Awesome, thanks for the answer 😀 Are these values absolute or relative to the previous one, meaning if, for example, the X axis is rotated 20 degrees and is then rotated to 25 degrees, do you report 25 degrees (the absolute value) or 5 degrees (because that's the relative change that has occurred)?

jfedor2 commented 1 year ago

They are absolute (despite the fact that the report descriptor says they're relative).