LabView control via Spacemouse compact

Questions and answers about 3Dconnexion devices on Windows.

Moderator: Moderators

Post Reply
viga
Posts: 3
Joined: Tue Dec 04, 2018 2:54 am

LabView control via Spacemouse compact

Post by viga »

We aim to use a Spacemouse Compact for the device control of a microskope in our lab. The GUI should be programmed in LabVIEW on a Windows system. LabVIEW recognizes the Spacemouse as a Joystick (Human Interface Device Object) with 7 axes but no axes data can be obtained while moving the Spacemouse handle. If i map the buttons to mouse buttons the spacemouse button action can be obtained but the crucial thing is to receive the axes data. Does anyone have an idea how to overcome this Problem?
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: LabView control via Spacemouse compact

Post by jwick »

It depends how LabView is reading it. If it is using one of the Microsoft APIs, then our driver may be getting in the way.
Stop our driver and try it.

It may also be reading it as a joystick rather than a native device. In that case, our driver can be told to make the device look like a joystick.
viga
Posts: 3
Joined: Tue Dec 04, 2018 2:54 am

Re: LabView control via Spacemouse compact

Post by viga »

Thanks for the quick Reply.

I deaktivated the Connexion driver but there is still no reaction of the LabVIEW programm while in parallel the mouse implementation is running
(see screenshots on my Sciebo-Cloud).

https://uni-duisburg-essen.sciebo.de/f/468738765
https://uni-duisburg-essen.sciebo.de/f/468736757

LabView knows three types of HUDs (mouse, keyboard, joystick) it can connect to. So if you say the driver can be told to make the device look like a joistick, how can i do it. I didn't find anything in the driver menues. Can you please help me. Many thanks in advance.
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: LabView control via Spacemouse compact

Post by jwick »

There is no official support for this, but last I checked it still worked fine. The GUI isn't going to help you. You have to do some manual editing.

I'll help you as you get stuck.

There are three tasks needed to get this to work.
1) Have the driver installed and running with its joystick support.
2) Tell the driver when to use the joystick output.
3) Probably you also need to tell the application to use the joystick. It may need some prodding.

Some details:
The driver needs to be told to turn 3d mouse events into joystick events.
The joystick events are sent to the OS for distribution using its mechanisms.
When 3DxWare is installed, you will see a pseudo-joystick we add for this in the Device Manager. It has the fancy name: HID-compliant game controller. It seems that LabView has already found it.
Games/applications that enumerate all the joysticks attached to the system will find it.

To tell the driver to send Joystick events, the output of each axis has to be reassigned. This is done in a cfg file that you must create for your application.

We ship a template that you can start with, which assigns all the 3D mouse axes to joystick axes (buttons too).
To turn a template into a usable cfg file, you need to do some manual editing. The GUI used to do this for you.

1) Copy the (typical location) c:\Program Files\3Dconnexion\3DxWare\3DxWinCore64\Cfg\JoystickTemplate.xml to MyLabViewApp.xml (or whatever you want to use). You can do all this editing in Program Files if you have write access. if not, you can do it in ProgramData, but I'll have to give you some hints on that.
2) Open MyLabViewApp.xml and change the outer element names from AppCfgTemplate, to AppCfg.
3) Change the Name from STR_3_JOYSTICK_TEMPLATE to MyLabVeiwApp. This is the string that will be shown to the user in our GUI and on our LCD.
4) The ExecutableName element will be empty. Put your executable's name in there. E.g., MyLabViewApp.exe. This is how the driver identifies when to use this cfg. When it sees MyLabView.exe in focus, it switches to this cfg.
5) Save the cfg file.
6) You may have to clear out conflicting cfgs in your %appdata%\3Dconnexion\3DxWare\Cfg dir if you have been experimenting with the driver for a while.
7) To be safe, restart the 3dxService.exe driver.
8) Bring your application into focus.
9) Hover over the 3Dx systray icon. It should say that it is using MyLabVeiwApp.xml. if not, let me know.
10) Probably you need to go into the controls of the LabView environment to tell it to use the joystick. You might also have to set scale factors and absolute/relative positioning info. You may have to contact them to find out how to do that. It often isn't well documented.

This should get you going, but the joystick interface is limited. The best solution probably involves reading the native HID device. I recall hearing about a plugin architecture for LabView that allows this.

Let me know how it goes.
viga
Posts: 3
Joined: Tue Dec 04, 2018 2:54 am

Re: LabView control via Spacemouse compact

Post by viga »

Great support instructions!! It's working perfect. Thank you very much.
After the implementation of the LabVIEW.xml config file (modified Joystick template) i was even able to fine tune the behavior of the Spacemouse using the "3DConnexion Properties" tool and to assign actions to the Joystick Buttons.


I think you should add the config file for the Labview development environment and for the LabVIEW runtime environment to the driver bundle because the Spacemouse is a great control device for LabVIEW controlled laboratory equipment.

Thanks again for your help!
Post Reply