smartavionics / RawMouse

Cura Plugin that lets you use a HID mouse to pan/rotate/zoom the view
94 stars 7 forks source link

Support for OS3M Mouse #25

Open hotsgit opened 8 months ago

hotsgit commented 8 months ago

GENERAL INFO: In the past year or so 3 DIY 6DoF mice have been developed, so I'm hoping people will be able to adapt this plugin to them. I built an OS3M mouse (I didn't design it) which acts as a serial 6DoF mouse in Windows and I've gotten it working in one game without an intermediary program. The pic below shows all 6 axes (X and Y are in the box). image

OS3M OVERVIEW (not necessary to look at): https://github.com/spoter368/os3m-hardware https://www.youtube.com/watch?v=p3HOFJEZwfs

REQUEST: I'm not sure what I'm doing wrong when adding it to the device list in config.json. I can confirm that the rawmouse plugin installed correctly in Cura 5.5.0 but the log file says "No mouse found!".

Log File: image image

From Device Manager: image image

My added line in config.json - this does nothing. I've tried several combinations of profiles and device names, pretty sure I shouldn't use libspnav since that's not installed (is that just a Linux thing?): image

Also are there deadbands I can set in that config.json, or do I have to change RawMouse.Py?

smartavionics commented 8 months ago

Hi, I'm happy to help with this but rather busy right now. Will look into it soon.

smartavionics commented 8 months ago

Hi, have you made any progress? Could it be that another driver has grabbed the device and so it isn't visible to Cura?

hotsgit commented 8 months ago

No drivers were running, no new progress. For available OS3M drivers, so far there's only one for Solidworks API and one for a test program. Does it need a driver to work with Rawmouse even though windows recognizes it as a serial 6DoF USB device?

If yes, would the config.json and Rawmouse.py need a custom profile for whatever custom driver this OS3M needs, or could it use the spacemouse profile? Should I pursue libspnav as a driver or is it just for linux?

smartavionics commented 8 months ago

I would not expect it to require a driver. The whole point of RawMouse is that it can work directly with a HID device. Ignore libspnav as that's a Linux thing that someone requested support for.

What usage page and usage values does your device support?

hotsgit commented 8 months ago

I think this means Usage Page 0x01 and Usage 0x04 but I'm speculating a bit since the internet isn't useful for how to find those.

image

Tables from Microsoft:

image

A dumb mistake in my first post is that I was editing a backup of the config.json, so I put this line into the correct json file...

image

and now Rawmouse sees the device in Cura - except moving the mouse does nothing:

image

image

Same results with this: image

smartavionics commented 8 months ago

Sorry for the slow response, I've only just got in from work. It's good that the device is now detected. I think the problem you have now is that the data format of your device does not match the format that the spacemouse uses. Do you have any documentation that describes the layout of the data that is sent with each HID event when you move the axes or press buttons?

smartavionics commented 8 months ago

Hi, I have added some extra diagnostics to the master branch. It will now print the usage_page and usage of the HID device that is found and it will also print the contents of the events when the profile name isn't recognized (i.e. the profile name is not spacemouse or tiltpad). So if you change your config file to have some other profile name you should see the contents of the events in cura.log.

smartavionics commented 8 months ago

Sorry, I forgot to add that you will need to define a profile with the new name, e.g. "STM32HI", so you could just duplicate the spacemouse profile and give the duplicate that name.

smartavionics commented 8 months ago

I've had a dig and found https://github.com/spoter368/os3m-software. Looking at that, I think the event data format is going to be very similar to what the spacemouse provides.

smartavionics commented 8 months ago

Did your log show any "Unknown spacemouse event" messages? If so, what was the reported len?

smartavionics commented 8 months ago

I'm pretty certain what needs to be done and have pushed some code to the master branch. You should see some movement but the scaling is probably wrong.

hotsgit commented 8 months ago

Thanks so much for all your work! With the new code the OS3M can move the build area in Cura, though I had to change the scale in all axes to 0.0005, and I will take a while to figure out which axes are which and how to get rid of drift. Will update.

Weirdly enough the rawmouse option to see device info in Cura doesn't work now.

smartavionics commented 8 months ago

Good sounds like progress.

I have pushed another update that should fix the lack of device info.

I should think that altering the threshold values should fix the drift.

hotsgit commented 8 months ago

Hello, can you set these as the values for the "os3m" profile? They're a baseline, and I'll inform people how to change them.

  "axes" : [
    { "offset": 0.0, "scale": -0.0015, "threshold": 0.080, "target": "movx" },
    { "offset": 0.0, "scale": -1.8, "threshold": 94.0, "target": "zoom" },
    { "offset": 0.0, "scale": 0.0015, "threshold": 0.080, "target": "movy" },
    { "offset": 0.0, "scale": -0.0004 , "threshold": 0.023, "target": "rotpitch" },
    { "offset": 0.0, "scale": -0.0004, "threshold": 0.022, "target": "rotroll" },
    { "offset": 0.0, "scale":  0.0005, "threshold": 0.023, "target": "rotyaw" }
  ]

If the OSM hardware/firmware is improved then I can just tell people what new values to use here: https://github.com/spoter368/os3m-software/issues/8

smartavionics commented 8 months ago

I've incorporated your config values and made a new release (1.2.2).

Let's leave this issue open in case you want to make some further changes.