Open 3D Mouse working with Spacenavd on Ubuntu 20.04
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 8
- Joined: Thu May 07, 2020 7:05 am
Open 3D Mouse working with Spacenavd on Ubuntu 20.04
Hi everybody,
I am making a Open 3D Mouse (Both Open Source and Open Hardware) based on Nordic nRF52 chips using HOGP (HID Over Gap Profile).
So it's wireless and it's mean to be use as a wearable that can be held in one hand and don't send any packets until the user push a button activating the device sensors.
I am writing the firmware and the PCB (KiCad).
I already have the device working with the driver Spacenavd and FreeCAD and Blender are responding to any change on rotations (Rx,Ry and Rz), but not on displacement (X,Y,Z).
I don't have a 3Dconnection at hand to test and compare with, but a friend from Spain (I am living in Costa Rica), sent me the usb capture packets from windows.
Right now I am making debugging and testing in Ubuntu 20.04 and found out there's support for the 3DConnection on FreeCAD on windows based on the same driver Spacenavd. That's great.
I'm interest to take the code used for the Windows implementation (based on spacenavd), as based for the driver of my Open 3D Mouse to make it work on Windows as it does in GNU/Linux.
I don't know where is the code of the implementation for Windows' FreeCAD support based on spacenavd.
Any help with that, would be great.
Also, as I said, I don't have a 3DConnection at hand and I haven't be able to find anywhere in Internet the HID Report Descriptor Map of any 3D Mouse available on the market to make sure the HID Report Descriptor I am using is the right one.
This is part of my Report Descriptor:
# 0x05, 0x01, // Usage Page (Generic Desktop)
# 0x09, 0x08, // Usage (Multi Axis)
# 0xa1, 0x01, // Collection (Application)
# 0x85, 0x03, // Report ID (3)
# 0x09, 0x08, // Usage (Multi Axis)
# 0x05, 0x01, // Usage Page (Generic Desktop)
# 0xa1, 0x00, // Collection (Physical)
# 0x09, 0x30, // Usage (X)
# 0x09, 0x31, // Usage (Y)
# 0x09, 0x32, // Usage (Z)
# 0x16, 0x01, 0x80, // Logical Minimum (-32767)
# 0x26, 0xff, 0x7f, // Logical Maximum (32767)
# 0x95, 0x03, // Report Count (3)
# 0x75, 0x10, // Report Size (16)
# 0x81, 0x02, // Input (Data,Var,Abs)
# 0xc0, // End Collection
# 0xa1, 0x00, // Collection (Physical)
# 0x09, 0x33, // Usage (Rx)
# 0x09, 0x34, // Usage (Ry)
# 0x09, 0x35, // Usage (Rz)
# 0x15, 0x00, // Logical Minimum (0)
# 0x26, 0xa0, 0x8c, // Logical Maximum (36000)
# 0x35, 0x00, // Physical Minimum (0)
# 0x46, 0xa0, 0x8c, // Physical Maximum (36000)
# 0x95, 0x03, // Report Count (3)
# 0x75, 0x10, // Report Size (16)
# 0x65, 0x14, // Unit (Degrees,EngRotation)
# 0x55, 0x0e, // Unit Exponent (-2)
# 0x81, 0x02, // Input (Data,Var,Abs)
# 0xc0, // End Collection
# 0xc0, // End Collection
I choose to used degrees instead of radians, I don't know if there's a problem. And also absolute value instead of relative like a mouse behave.
If someone can help me with the Report Descriptor of a 3Dconnection that would be great too.
Thanks a lot and Best Regards,
Jose Pablo,
I am making a Open 3D Mouse (Both Open Source and Open Hardware) based on Nordic nRF52 chips using HOGP (HID Over Gap Profile).
So it's wireless and it's mean to be use as a wearable that can be held in one hand and don't send any packets until the user push a button activating the device sensors.
I am writing the firmware and the PCB (KiCad).
I already have the device working with the driver Spacenavd and FreeCAD and Blender are responding to any change on rotations (Rx,Ry and Rz), but not on displacement (X,Y,Z).
I don't have a 3Dconnection at hand to test and compare with, but a friend from Spain (I am living in Costa Rica), sent me the usb capture packets from windows.
Right now I am making debugging and testing in Ubuntu 20.04 and found out there's support for the 3DConnection on FreeCAD on windows based on the same driver Spacenavd. That's great.
I'm interest to take the code used for the Windows implementation (based on spacenavd), as based for the driver of my Open 3D Mouse to make it work on Windows as it does in GNU/Linux.
I don't know where is the code of the implementation for Windows' FreeCAD support based on spacenavd.
Any help with that, would be great.
Also, as I said, I don't have a 3DConnection at hand and I haven't be able to find anywhere in Internet the HID Report Descriptor Map of any 3D Mouse available on the market to make sure the HID Report Descriptor I am using is the right one.
This is part of my Report Descriptor:
# 0x05, 0x01, // Usage Page (Generic Desktop)
# 0x09, 0x08, // Usage (Multi Axis)
# 0xa1, 0x01, // Collection (Application)
# 0x85, 0x03, // Report ID (3)
# 0x09, 0x08, // Usage (Multi Axis)
# 0x05, 0x01, // Usage Page (Generic Desktop)
# 0xa1, 0x00, // Collection (Physical)
# 0x09, 0x30, // Usage (X)
# 0x09, 0x31, // Usage (Y)
# 0x09, 0x32, // Usage (Z)
# 0x16, 0x01, 0x80, // Logical Minimum (-32767)
# 0x26, 0xff, 0x7f, // Logical Maximum (32767)
# 0x95, 0x03, // Report Count (3)
# 0x75, 0x10, // Report Size (16)
# 0x81, 0x02, // Input (Data,Var,Abs)
# 0xc0, // End Collection
# 0xa1, 0x00, // Collection (Physical)
# 0x09, 0x33, // Usage (Rx)
# 0x09, 0x34, // Usage (Ry)
# 0x09, 0x35, // Usage (Rz)
# 0x15, 0x00, // Logical Minimum (0)
# 0x26, 0xa0, 0x8c, // Logical Maximum (36000)
# 0x35, 0x00, // Physical Minimum (0)
# 0x46, 0xa0, 0x8c, // Physical Maximum (36000)
# 0x95, 0x03, // Report Count (3)
# 0x75, 0x10, // Report Size (16)
# 0x65, 0x14, // Unit (Degrees,EngRotation)
# 0x55, 0x0e, // Unit Exponent (-2)
# 0x81, 0x02, // Input (Data,Var,Abs)
# 0xc0, // End Collection
# 0xc0, // End Collection
I choose to used degrees instead of radians, I don't know if there's a problem. And also absolute value instead of relative like a mouse behave.
If someone can help me with the Report Descriptor of a 3Dconnection that would be great too.
Thanks a lot and Best Regards,
Jose Pablo,
- tanderson69
- Veteran
- Posts: 1626
- Joined: Thu Feb 18, 2010 1:07 am
Re: Open 3D Mouse working with Spacenavd on Ubuntu 20.04
That is great! Is anything public yet? Sorry I can't help with your specific questions as I run my old serial magellan plus xt on debian. I implemented the linux spaceball support for freecad and I have wrote my own driver for my magellan that I use everyday, so I have some experience in this area. If you think I can help, let me know.josepablo.castro wrote: ↑Sun May 10, 2020 6:24 am I am making a Open 3D Mouse (Both Open Source and Open Hardware) based on Nordic nRF52 chips using HOGP (HID Over Gap Profile).
maybe useful: space mice
Re: Open 3D Mouse working with Spacenavd on Ubuntu 20.04
I haven't used any of these devices, so I can only speculate.josepablo.castro wrote: ↑Sun May 10, 2020 6:24 am ...
I don't know where is the code of the implementation for Windows' FreeCAD support based on spacenavd.
...
The source for the 3D connexion support (3D input devices) seems to be in src/Gui/3Dconnexion. Maybe you'd like to ask the developer "tsadowski" who was the last person who touched those files.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
-
- Posts: 8
- Joined: Thu May 07, 2020 7:05 am
Re: Open 3D Mouse working with Spacenavd on Ubuntu 20.04
At the moment, I have a gitlab repository for both Hardware and Software development but it's most like a sandbox where I am experimenting a lot.tanderson69 wrote: ↑Sun May 10, 2020 6:41 pmThat is great! Is anything public yet? Sorry I can't help with your specific questions as I run my old serial magellan plus xt on debian. I implemented the linux spaceball support for freecad and I have wrote my own driver for my magellan that I use everyday, so I have some experience in this area. If you think I can help, let me know.josepablo.castro wrote: ↑Sun May 10, 2020 6:24 am I am making a Open 3D Mouse (Both Open Source and Open Hardware) based on Nordic nRF52 chips using HOGP (HID Over Gap Profile).
maybe useful: space mice
So the repositories are messy. My plan is publish both repository as soon as the code become more stable. I'm not sure if I will keep the repos on gitlab or move them to github. Will see.
Thanks for the link of Spacemice I will check it out.
- kkremitzki
- Veteran
- Posts: 2517
- Joined: Thu Mar 03, 2016 9:52 pm
- Location: Illinois
Re: Open 3D Mouse working with Spacenavd on Ubuntu 20.04
Sorry for the slight derail but I am interested in these types of devices and a coworker gave me an old 3Dconnexion SpaceBalll 5000. When I first plugged it in it didn't seem to do anything although it did get detected, so I thought it wasn't working, but it was only when I opened FreeCAD that I found it was active. Is it normal for these types of devices to only be usable inside the application and not on the desktop?
-
- Posts: 8
- Joined: Thu May 07, 2020 7:05 am
Re: Open 3D Mouse working with Spacenavd on Ubuntu 20.04
Hi,vocx wrote: ↑Sun May 10, 2020 7:15 pmI haven't used any of these devices, so I can only speculate.josepablo.castro wrote: ↑Sun May 10, 2020 6:24 am ...
I don't know where is the code of the implementation for Windows' FreeCAD support based on spacenavd.
...
The source for the 3D connexion support (3D input devices) seems to be in src/Gui/3Dconnexion. Maybe you'd like to ask the developer "tsadowski" who was the last person who touched those files.
I found the source code and already started to study it.
In Linux the Spacenav driver allow the user to add more device by editing a config life on /etc/spnavrc adding this
device-id = vendorId:productId
And works fine, both Blender and FreeCAD.
But in windows it seems to be hardcoded.
The idea I have is to add input setting in the FreeCAD configuration to include extra devices just adding the productId:vendorId.
I will try to contact with tsadowski.
Thanks,
Jose Pablo
-
- Posts: 8
- Joined: Thu May 07, 2020 7:05 am
Re: Open 3D Mouse working with Spacenavd on Ubuntu 20.04
It's a HID device and its detected as a Multi-Axis Controller.kkremitzki wrote: ↑Sun May 10, 2020 7:41 pm Sorry for the slight derail but I am interested in these types of devices and a coworker gave me an old 3Dconnexion SpaceBalll 5000. When I first plugged it in it didn't seem to do anything although it did get detected, so I thought it wasn't working, but it was only when I opened FreeCAD that I found it was active. Is it normal for these types of devices to only be usable inside the application and not on the desktop?
The mouse/pointer is another HID device.
In Linux each HID device greats a hidraw intances here: /dev/hidrawN, where N start at 0 and continue to increase.
Also creates a several inputs event: /dev/inputs/eventN.
For example my Open 3D Mouse has 5 report ids:
1 Standard Mouse
2 Joystick
3 Multi-Axis Controller
4 3D Digitizer (I'm not sure if I will keep this one)
5 Vendor Specific (For control mostly)
And everyone has an /dev/input/eventN associated to the packets coming in to the host. But only one /dev/hidrawN instance for the raw data without any processing for the data.
So, you connect your device, it's get recognized by the Kernel and get it's own /dev/input/eventN for the packets, and then, when you use an application, like FreeCAD or Blender, they used that data.
Well, in the case of the driver spacenavd, take the data and send instrucction to the X11 so application like FreeCAD and Blender respond to it.
If you open another application, let's say LibreOffice, and move your 3D Mouse, it should ignore the events generated by it.
When the Open 3D Mouse sends data through the Mouse Report Id, the data it's treated as a Normal Standard Mouse for any application.
I hope that answered your question.
Best Regards,
Jose Pablo
Re: Open 3D Mouse working with Spacenavd on Ubuntu 20.04
Recently one user added the possibility of adding an XML with button mapping. I'm not sure if this is helpful to you.josepablo.castro wrote: ↑Sun May 10, 2020 7:48 pm In Linux the Spacenav driver allow the user to add more device by editing a config life on /etc/spnavrc adding this
...
Adds 3DConnexion Device Button Map loading from XML file (#3065)
This is the XML that you see in the source code.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
-
- Posts: 8
- Joined: Thu May 07, 2020 7:05 am
Re: Open 3D Mouse working with Spacenavd on Ubuntu 20.04
I took a look at the XML, but, it does not indicates the VendorID:ProductID.vocx wrote: ↑Sun May 10, 2020 8:12 pmRecently one user added the possibility of adding an XML with button mapping. I'm not sure if this is helpful to you.josepablo.castro wrote: ↑Sun May 10, 2020 7:48 pm In Linux the Spacenav driver allow the user to add more device by editing a config life on /etc/spnavrc adding this
...
Adds 3DConnexion Device Button Map loading from XML file (#3065)
This is the XML that you see in the source code.
The file src/Gui/3Dconnection/GuiNativeEventEin32.cpp has this defines:
#define LOGITECH_VENDOR_ID 0x46d
#define CONNEXION_VENDOR_ID 0x256f
So its hard coded to used only that VendorID. I haven't finished to study the source code, so I could be wrong about this.
I haven't test it on windows yet because of the early state of development.
Thanks and Best Regards,
Jose Pablo
- tanderson69
- Veteran
- Posts: 1626
- Joined: Thu Feb 18, 2010 1:07 am
Re: Open 3D Mouse working with Spacenavd on Ubuntu 20.04
Yes that is normal.kkremitzki wrote: ↑Sun May 10, 2020 7:41 pm Is it normal for these types of devices to only be usable inside the application and not on the desktop?
spacenavd supports 2 different output protocols. The original x11 and a 'homegrown' unix socket. If I remember correctly, blender uses the unix socket, and freecad uses x11. When I started the freecad support, spacenavd didn't support any old serial devices and the 3dconnexion prop. driver still worked on linux and had support for my devices. I chose x11 so my devices would work. That was a mistake, which is obvious by all the permission problems people experienced.josepablo.castro wrote: ↑Sun May 10, 2020 8:10 pm Well, in the case of the driver spacenavd, take the data and send instrucction to the X11 so application like FreeCAD and Blender respond to it.
Oh that is interesting!josepablo.castro wrote: ↑Sun May 10, 2020 8:10 pm When the Open 3D Mouse sends data through the Mouse Report Id, the data it's treated as a Normal Standard Mouse for any application.