spaceball again and again 2022

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: spaceball again and again 2022

Post by Kunda1 »

wmayer wrote: Tue May 31, 2022 11:24 am
Kunda1 wrote: Tue May 31, 2022 10:38 am IIRC this wasn't backportrdnto 0.19 right? All the up-to-date spacemouse improvements are in v0.20dev
It is also part of v0.19: https://github.com/FreeCAD/FreeCAD/blob ... ux.cpp#L51
I stand corrected. wmayer has the receipts :mrgreen:

wmayer, i added a Troubleshooting section to 3Dconnexion_input_devices#Troubleshooting. Thanks for your insights!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
zawier
Posts: 10
Joined: Mon May 30, 2022 6:13 pm

Re: spaceball again and again 2022

Post by zawier »

M4x wrote: Mon May 30, 2022 10:16 pm Thank you for making use of the quote-function
You are wolcome ;) Besides I don't know smarter and cleaner way for replaying on planty of questions. That way keeps things organized ;)
M4x wrote: Mon May 30, 2022 10:16 pm Please try these examples from libnav:
Thank you so much for a such detailed instruction! So bellow my results:

Code: Select all

zawier@zawier-garuda ~/Pobrane [128]> git clone https://github.com/FreeSpacenav/libspnav.git
Klonowanie do „libspnav”...
remote: Enumerating objects: 419, done.
remote: Counting objects: 100% (221/221), done.
remote: Compressing objects: 100% (150/150), done.
remote: Total 419 (delta 128), reused 156 (delta 69), pack-reused 198
Pobieranie obiektów: 100% (419/419), 133.23 KiB | 2.34 MiB/s, gotowe.
Rozwiązywanie delt: 100% (238/238), gotowe.
zawier@zawier-garuda ~/Pobrane>  cd /home/zawier/Pobrane/libspnav
zawier@zawier-garuda ~/P/libspnav (master)> ./configure
configuring spacenav library...
configuring libspnav - v1.0-3-g1716ccf
prefix: /usr/local
optimize for speed: yes
include debugging symbols: yes
x11 communication method: yes

creating Makefile ...
creating spnav_config.h ...
creating spnav.pc ...

Done. You can now type make (or gmake) to compile libspnav.

zawier@zawier-garuda ~/P/libspnav (master)> make
cc -O3 -g -std=c89 -fPIC -pedantic -Wall -fno-strict-aliasing -I. -I/usr/local/include -I/usr/X11R6/include  -c src/spnav.c -o src/spnav.o
cc -O3 -g -std=c89 -fPIC -pedantic -Wall -fno-strict-aliasing -I. -I/usr/local/include -I/usr/X11R6/include  -c src/proto.c -o src/proto.o
cc -O3 -g -std=c89 -fPIC -pedantic -Wall -fno-strict-aliasing -I. -I/usr/local/include -I/usr/X11R6/include  -c src/util.c -o src/util.o
cc -O3 -g -std=c89 -fPIC -pedantic -Wall -fno-strict-aliasing -I. -I/usr/local/include -I/usr/X11R6/include  -c src/spnav_magellan.c -o src/spnav_magellan.o
ar rcs libspnav.a src/spnav.o src/proto.o src/util.o src/spnav_magellan.o
cc -shared -Wl,-soname,libspnav.so.0 -o libspnav.so.0.3 src/spnav.o src/proto.o src/util.o src/spnav_magellan.o -L/usr/local/lib -L/usr/X11R6/lib  -lX11
zawier@zawier-garuda ~/P/libspnav (master)>  cd /home/zawier/Pobrane/libspnav/examples
zawier@zawier-garuda ~/P/l/examples (master)>  cd /home/zawier/Pobrane/libspnav/examples/simple
zawier@zawier-garuda ~/P/l/e/simple (master)> make
gcc -pedantic -Wall -g -I../.. -I../../src -I/usr/local/include -DBUILD_X11 -o simple_x11 simple.c -L../.. -L/usr/local/lib -lspnav -lX11
gcc -pedantic -Wall -g -I../.. -I../../src -I/usr/local/include -DBUILD_AF_UNIX -o simple_af_unix simple.c -L../.. -L/usr/local/lib -lspnav -lX11
zawier@zawier-garuda ~/P/l/e/simple (master)> ./simple_af_unix
failed to connect to spacenavd
zawier@zawier-garuda ~/P/l/e/simple (master) [1]>  cd /home/zawier/Pobrane/libspnav/examples
zawier@zawier-garuda ~/P/l/examples (master)>  cd /home/zawier/Pobrane/libspnav/examples/fly
zawier@zawier-garuda ~/P/l/e/fly (master)> make
cc -pedantic -Wall -g -I../.. -I../../src -I/usr/local/include   -c -o fly.o fly.c
cc -pedantic -Wall -g -I../.. -I../../src -I/usr/local/include   -c -o xwin.o xwin.c
cc -o fly fly.o xwin.o -L../.. -L/usr/local/lib -lX11 -lGL -lGLU -lspnav -lm
zawier@zawier-garuda ~/P/l/e/fly (master)> ./fly
failed to connect to the spacenav driver
zawier@zawier-garuda ~/P/l/e/fly (master) [1]>  cd /home/zawier/Pobrane/libspnav/examples
zawier@zawier-garuda ~/P/l/examples (master)>  cd /home/zawier/Pobrane/libspnav/examples/cube
zawier@zawier-garuda ~/P/l/e/cube (master)> make
gcc -pedantic -Wall -g -I../.. -I../../src -I/usr/local/include   -c -o cube.o cube.c
gcc -o cube cube.o -L../.. -L/usr/local/lib -lX11 -lGL -lGLU -lspnav -lm
zawier@zawier-garuda ~/P/l/e/cube (master)> ./cube
failed to connect to the space navigator daemon
So even if I have spacenavd installed it requires to start it as deamon. Which I wasn't able to achieve.
wmayer wrote: Tue May 31, 2022 8:43 am Does your FreeCAD installation link to the spacenav library
Well when I started FreeCAD --log-file /tmp/freecad.log as you adviced:

Code: Select all

╭─zawier@zawier in ~ took 619ms
[🔴] × FreeCAD --log-file /tmp/freecad.log
FreeCAD 0.19, Libs: 0.19R24415 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2021
FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.
FreeCAD wouldn't be possible without FreeCAD community.
#####                 ####  ###   ####
#                    #      # #   #   #
#     ##  #### ####  #     #   #  #   #
####  # # #  # #  #  #     #####  #   #
#     #   #### ####  #    #     # #   #
#     #   #    #     #    #     # #   #  ##  ##  ##
#     #   #### ####   ### #     # ####   ##  ##  ##
So it really looks like spacenavd isn't connected to FreeCad here.
wmayer wrote: Tue May 31, 2022 8:43 am there is probably a problem with the spacenav daemon.
It's look exactly like that at least for me. Should I one more time download from git , compile etc.. ?
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: spaceball again and again 2022

Post by wmayer »

It's look exactly like that at least for me. Should I one more time download from git , compile etc.. ?
It looks like you have to. However, building FreeCAD is not as easy as to build the spacenav sources. So, as a help check the wiki: https://wiki.freecad.org/Compile_on_Linux

Unlike to many configurable switches there is a little oddity with spacenav support with FreeCAD on Linux (this should be changed IMO):
we don't have a parameter where you can explicitly switch it on or off but it is automatically enabled if CMake can find the library and header files.
You will see if it was found when you run the Configure step in CMake in the summary report: You either see a message
SPNAV: not found
or
SPNAV: [<library name>] [<include path>]
Only for the latter it will be activated.
User avatar
M4x
Veteran
Posts: 1472
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: spaceball again and again 2022

Post by M4x »

Could you try the latest 0.20 AppImage? https://github.com/FreeCAD/FreeCAD-Bund ... kly-builds


I'll have a look at the wiki the next time I'm going to install a spacenavd and make adjustments if necessary.
zawier
Posts: 10
Joined: Mon May 30, 2022 6:13 pm

Re: spaceball again and again 2022

Post by zawier »

M4x wrote: Tue May 31, 2022 3:36 pm Could you try the latest 0.20 AppImage?
Sure! I have downloaded 0.20 image, AppImages works with no problem on my machine, BUT that varsion of FreeCad also doesn't recognize my manipulator. I think it's not problem with FreeCad but with spacenavd.
wmayer wrote: Tue May 31, 2022 3:11 pm building FreeCAD is not as easy as to build the spacenav sources.
I haven't compiled it by myself. I used pacman manager to install it. I see also there is a never version already available:

Code: Select all

╭─zawier@zawier in ~
╰─λ pacman -Ss freecad
community/freecad 0.19.4-2 [installed]
General purpose 3D CAD modeler
chaotic-aur/freecad-git 0.20.0.28943.g8676d67a87-1
A general purpose 3D CAD modeler - git checkout
But is it worth to install in case when AppImage v0.20 doesn't work in my case?
User avatar
M4x
Veteran
Posts: 1472
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: spaceball again and again 2022

Post by M4x »

If it's not working with the AppImage, it's not useful to install a newer version / compile FreeCAD yourself I think.

Did I get it right that you weren't able to get the cube example to work? If that's the case, it's probably useless to try FreeCAD. ;)
zawier
Posts: 10
Joined: Mon May 30, 2022 6:13 pm

Re: spaceball again and again 2022

Post by zawier »

M4x wrote: Tue May 31, 2022 7:56 pm Did I get it right that you weren't able to get the cube example to work?
Yep, exactly, you get it correctly.

Code: Select all

zawier@zawier-garuda ~/P/l/e/fly (master) [1]>  cd /home/zawier/Pobrane/libspnav/examples
zawier@zawier-garuda ~/P/l/examples (master)>  cd /home/zawier/Pobrane/libspnav/examples/cube
zawier@zawier-garuda ~/P/l/e/cube (master)> make
gcc -pedantic -Wall -g -I../.. -I../../src -I/usr/local/include   -c -o cube.o cube.c
gcc -o cube cube.o -L../.. -L/usr/local/lib -lX11 -lGL -lGLU -lspnav -lm
zawier@zawier-garuda ~/P/l/e/cube (master)> ./cube
failed to connect to the space navigator daemon
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: spaceball again and again 2022

Post by adrianinsaval »

Have you considered building the spacenav stuff from AUR: https://aur.archlinux.org/packages/spacenavd https://aur.archlinux.org/packages/spnavcfg they probably figured out if there are extra steps or other arch specific stuff to do, for example I see in the spacenavd script that they copy over the systemd service to the correct location so I assume running make install doesn't do that.
zawier
Posts: 10
Joined: Mon May 30, 2022 6:13 pm

Re: spaceball again and again 2022

Post by zawier »

adrianinsaval wrote: Tue May 31, 2022 8:19 pm Have you considered building the spacenav stuff from AUR: https://aur.archlinux.org/packages/spacenavd
Yes, but pacman wasn't able to find a such package. Even if you go to site: https://aur.archlinux.org/packages/spacenavd and then try open https://aur.archlinux.org/spacenavd.git then finally you will get 404 - Page Not Found :)

But no worries, I didn't give up.

Code: Select all

git clone https://aur.archlinux.org/spacenavd.git
It was clonned succesfully! Cool! So let's check inside content:

Code: Select all

cd spacenavd/
╭─zawier@zawier in repo: spacenavd on  master took 1ms
╰─λ ls -la
drwxr-xr-x    - zawier 31 maj 22:41  .
drwx------    - zawier 31 maj 22:41  ..
drwxr-xr-x    - zawier 31 maj 22:41  .git
.rw-r--r--   38 zawier 31 maj 22:41  .gitignore
.rw-r--r--  706 zawier 31 maj 22:41  .SRCINFO
.rw-r--r-- 1,2k zawier 31 maj 22:41  PKGBUILD
.rw-r--r--  179 zawier 31 maj 22:41  spacenavd.service
So far so good! We have got PKGBUILD so let's play with that futher:

Code: Select all

makepkg -si PKGBUILD
It was correctly installed! Prommising.. Let's check then systemctl status:

Code: Select all

╭─zawier@zawier in repo: spacenavd on  master as 🧙 took 16ms
[🔴] × systemctl status spacenavd
○ spacenavd.service - Userspace Daemon of the spacenav driver.
Loaded: loaded (/etc/systemd/system/spacenavd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Ok. Let's enable and start that baby:

Code: Select all

sudo systemctl enable spacenavd
sudo systemctl start spacenavd
╭─zawier@zawier in repo: spacenavd on  master as 🧙 took 31ms
✦2  ╰─λ systemctl status spacenavd
● spacenavd.service - Userspace Daemon of the spacenav driver.
Loaded: loaded (/etc/systemd/system/spacenavd.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2022-05-31 23:02:28 CEST; 2s ago
Process: 48105 ExecStart=/usr/bin/spacenavd (code=exited, status=0/SUCCESS)
Main PID: 48106 (spacenavd)
Tasks: 1 (limit: 14291)
Memory: 396.0K
CPU: 3ms
CGroup: /system.slice/spacenavd.service
└─48106 /usr/bin/spacenavd
Running up Freecad , going to SpaceBall settings- and voilla! here it is! I'm able to use it again!!!!! :D :D :D :D :D
Lovely!

So summarizing - it's arch repo issue in my opinion. Installing like described above it works fine.

I'd like to thank you all guys for your support and help! I have learnt a new things which previously I wasn't aware.
One more time BIG THANK you : M4x, adrianinsaval , wmayer , PrzemoF (sorry in advance if I missed somebody) - you are my heros ;)

Additionally I was able to finally make a tests:

Code: Select all

╭─zawier@zawier in repo: libspnav/examples/simple on  master via C v12.1.0-gcc took 17s
✦  ╰─λ ./simple_af_unix
spacenav AF_UNIX protocol version: 1
Device: 3Dconnexion SpaceNavigator
Path: /dev/input/event16
Buttons: 2
Axes: 6

got motion event: t(5, -7, 0) r(0, 0, -2)
got motion event: t(5, -7, 7) r(0, 0, -2)
got motion event: t(5, -7, 7) r(-9, 0, -2)
got motion event: t(5, -7, 12) r(-9, 0, -2)
got motion event: t(5, -7, 12) r(-14, 0, -2)
Fly test - correctly! Nice test BTW!

Only Cude failed:

Code: Select all

╭─zawier@zawier in repo: libspnav/examples/cube on  master via C v12.1.0-gcc took 1ms
✦2  ╰─λ ./cube
failed to connect to the space navigator daemon
But I don't care bying hones ;) Or should I care? :?: :roll:
Last edited by zawier on Tue May 31, 2022 9:44 pm, edited 1 time in total.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: spaceball again and again 2022

Post by adrianinsaval »

zawier wrote: Tue May 31, 2022 9:31 pm So summarizing - it's arch repo issue in my opinion. Installing like described above it works fine.
nope, AUR stands for Arch User Repository and it only contains community provided scripts to build packages that are not available in the default repos and the git link is only meant for cloning the repo, nothing to see in the browser, so everything is working as expected.
Manually cloning repos and running makepkg can be tedious so you may use an AUR helper like pamac or paru but it's normal that those packages aren't found by pacman.
One more time BIG THANK you : M4x, adrianinsaval , wmayer , PrzemoF (sorry in advance if I missed somebody) - you are my heros ;)
Happy to help! Note that it might be necessary to rebuild the package if one of it's dependencies gets updated so if it stops working after an update try cloning the PKGBUILD repo again and rebuilding.
Post Reply