Implementation of different SpaceMouse models

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
mklopfer
Posts: 3
Joined: Mon Feb 06, 2023 5:31 am

Implementation of different SpaceMouse models

Post by mklopfer »

Hi, i have a few questions about the implementation of different SpaceMouse(s?) in one programm.

Currently i use the industrial SpaceMouse variant from megatron.de and the SpaceMouse Wireless. Both work perfect with the Sample Software from the industrial SpaceMouse which i modified for my purposes. (SpaceMouseModule SDK v1, uninstalled 3dx driver).

Today i recieved the wired SpaceMouse Compact and it didn't work with my software... I get random Inputs... I debugged the programm and it seems as it adds the value from the SpaceMouse Compact to the (xyz,abc) variable(s) instead of setting it to it.

Is there any way to fix this issue? I just need to read raw input data from the SpaceMouse Compact & industrial version at the same time/switch between them. Should i switch to the 3DxWare SDK?

Is the circle LED on the SM Compact a RGB LED? Can i control it without using the 3DxWare SDK?

Thanks

Marc
jwick
Moderator
Moderator
Posts: 3374
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Implementation of different SpaceMouse models

Post by jwick »

3DxWare (& its SDK) does not support the industrial controller so you can't use 3DxWare for both of them.

You can use the 3DxWare SDK for the commercial 3D mice while you continue to use your industrial code.
It depends on your usage.
The SDK isolates your code from the differences between commercial devices. Which makes it trivial to support a different commercial device. But it also drags in a lot of other software you may not want.

You can also probably use your raw data code to read from the commercial device, but you will need to change it. The data is delivered differently. The API you are using may be able to understand the differences. The devices tell the machine how they deliver data. Not all APIs may understand it.

The LEDs are blue.
mklopfer
Posts: 3
Joined: Mon Feb 06, 2023 5:31 am

Re: Implementation of different SpaceMouse models

Post by mklopfer »

Thank you for your answer.

I tried to change my code to read the raw data from the Space Mouse Compact. I got it working but still have some errors:

I set my program's timer to 10ms (100Hz) and occasionally get readings of 0 or twice what it should be....
I'm pretty sure sometimes it misses a readout and sometimes it reads the space mouse twice and adds it together.
This error also occurs if i set the timer way slower(150ms, 500ms)...

Currently i am working on a filter to avoid these outliers.

If you have any other ideas how i can fix this, pls let me know.

Thanks
jwick
Moderator
Moderator
Posts: 3374
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Implementation of different SpaceMouse models

Post by jwick »

I wouldn't use a timer to read the hardware. The O/S will tell you when something happens.

The devices ATM send data at about 62.5Hz when they are off rest. That is probably never going to line up with your timer. And Windows is not a real-time O/S. There is no guarantee that it won't delay or bundle the delivery of events.

If you want to run a timer for application purposes, read an internal buffer. Let the device overwrite that internal buffer whenever it sends data. This way, you will always have the latest state of the device without having to catch it at exactly the right time.

You may want to put that device reading into an independent thread (does nothing more than sleep, get woken by a device event, write the buffer, go back to sleep). By sleep, I mean WaitForMultipleObjects.
mklopfer
Posts: 3
Joined: Mon Feb 06, 2023 5:31 am

Re: Implementation of different SpaceMouse models

Post by mklopfer »

I will give that a try, thanks!

If i am unable to get it working I will switch from Direct Input to Raw Input.
Post Reply