July 26, 2020

[Note] Leap Motion on Ubuntu 20.04

Installation note for Leap Motion on Ubutnu 20.04.



Leap Motion


I think I got this almost 10 years ago.  It's a great device and inexpensive, but unfortunately, it didn't get too popular.  It supports Windows, Mac, Linux.  Windows with the latest SDK, for Linux, only the old version of SDK works.  It still works well.  Just like early speech recognition era, it's easier/faster to use mouse.  As with Siri, Google Voice, Alexa, motion capture technology will be used widely some day.

It can be purchased at https://www.adafruit.com/product/2106 for $89.


Installing on Ubuntu

Not straight forward - but still works.  I just finished installing it but didn't try with Java/Python SDK yet.

It works on Ubuntu 20.04, except LeapControlPanel.  Not a big deal.  Seems like upto Ubutnu 15, it worked fine, but after Ubutnu changed a few things, it doesn't any more and Leap Motion never updated SDK for Linux.



(Above is someone else's video.)


Simplified Steps

This section, just steps to install -- no output. Just follow the steps.  For detailed output see further down:

(1) Install required pacakge
$ sudo apt-get install libgl1-mesa-glx

(2) Download V2 for Linux, https://developer.leapmotion.com/setup/desktop
uncompress the downloaded file, 
$ tar zxf Leap_Motion_SDK_Linux_2.3.1.tgz

Install the deb
$ sudo dpkg -i Leap-2.3.1+31549-x64.deb 

(3) Fix Service
$ sudo vi /lib/systemd/system/leapd.service

Then add this:
[Unit]
Description=LeapMotion Daemon
After=syslog.target

[Service]
Type=simple
ExecStart=/usr/sbin/leapd

[Install]
WantedBy=multi-user.target


(4) Make a symoblic link, and start service,
$ sudo ln -s /lib/systemd/system/leapd.service /etc/systemd/system/leapd.service
$ sudo systemctl daemon-reload
$ sudo service leapd start



For Python SDK: 

export PYTHONPATH=$PYTHONPATH:$HOME/LeapSDK/lib:$HOME/LeapSDK/lib/x64


Executable apps are:
  • Playground - demo program
  • Visualizer - test program
  • Recalibrate - to calibrate Leap device, but after running this, it actually messed up the calibration.  Run Visualizer and Playground first to see if it works fine.  If it works fine, then no need to run this.  If your calibration gets messed up, just kill leapd and restart it.
  • LeapControlPanel - does not work properly.  It runs but not visible.




Only one hand is shown as I had to press keys to take the screenshot.

Details

You can skip this.

* V2 SDK, https://developer.leapmotion.com/sdk/v2

"The V2 software may be used to build with our standard tracking on OSX or Linux, or with tool tracking or touchscreen-style gestures. However, many of the development assets associated with V2 are outdated, and the software is no longer supported. We strongly recommend using the more recent software versions."

* If installed w/o the required package, will get this error,

$ sudo dpkg -i Leap-2.3.1+31549-x64.deb

Selecting previously unselected package leap.
(Reading database ... 397385 files and directories currently installed.)
Preparing to unpack Leap-2.3.1+31549-x64.deb ...
Unpacking leap (2.3.1+31549) ...
dpkg: dependency problems prevent configuration of leap:
 leap depends on libgl1-mesa-glx (>= 7.7.1) | libgl1-mesa-glx-lts-precise (>= 7.7.1) | libgl1-mesa-glx-lts-quantal (>= 7.7.1) | libgl1-mesa-glx-lts-raring (>= 7.7.1) | libgl1-mesa-glx-lts-saucy (>= 7.7.1) | libgl1-mesa-glx-lts-trusty (>= 7.7.1) | libgl1-mesa-glx-lts-utopic (>= 7.7.1) | libgl1-mesa-glx-lts-vivid (>= 7.7.1); however:
  Package libgl1-mesa-glx-lts-precise is not installed.
  Package libgl1-mesa-glx-lts-quantal is not installed.
  Package libgl1-mesa-glx-lts-raring is not installed.
  Package libgl1-mesa-glx-lts-saucy is not installed.
  Package libgl1-mesa-glx-lts-trusty is not installed.
  Package libgl1-mesa-glx-lts-utopic is not installed.
  Package libgl1-mesa-glx-lts-vivid is not installed.

dpkg: error processing package leap (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 leap


libgl1-mesa-glx-lts-* The '*' is just Ubuntu version names, and the latest Ubuntu version that has libgl1-mesa-glx-lts package is "vivid" which is 15.04.
For Ubuntu versions, see https://en.wikipedia.org/wiki/Ubuntu_version_history


* Find libgl package for 20.04 (focal)

$ apt-cache search libgl shows:
(partial list)
libgl-dev - Vendor neutral GL dispatch library -- GL development files
libgl1 - Vendor neutral GL dispatch library -- legacy GL support
libgl1-mesa-dev - transitional dummy package
libgl1-mesa-dri - free implementation of the OpenGL API -- DRI modules
libgl1-mesa-glx - transitional dummy package
libglapi-mesa - free implementation of the GL API -- shared library
libglx-mesa0 - free implementation of the OpenGL API -- GLX vendor library
libglx0 - Vendor neutral GL dispatch library -- GLX support

...

libgl1-mesa-glx is 'transitional dummy package'.  Install this will fix the problem.  See:

$ sudo apt-get install libgl1-mesa-glx
[sudo] password for kkim:
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following NEW packages will be installed:
  libgl1-mesa-glx
0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.
1 not fully installed or removed.
Need to get 5,532 B of archives.
After this operation, 78.8 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libgl1-mesa-glx amd64 20.0.8-0ubuntu1~20.04.1 [5,532
B]
Fetched 5,532 B in 5s (1,065 B/s)         
Selecting previously unselected package libgl1-mesa-glx:amd64.
(Reading database ... 397498 files and directories currently installed.)
Preparing to unpack .../libgl1-mesa-glx_20.0.8-0ubuntu1~20.04.1_amd64.deb ...
Unpacking libgl1-mesa-glx:amd64 (20.0.8-0ubuntu1~20.04.1) ...
Setting up libgl1-mesa-glx:amd64 (20.0.8-0ubuntu1~20.04.1) ...
Setting up leap (2.3.1+31549) ...
Leap Motion installed under /usr/bin and /usr/sbin
To start the Leap Motion daemon, run:
  sudo leapd
This does not appear to be an Debian or Ubuntu-compatible distro
If you would like Leap Motion to run as a service, it is up to you
to configure systemd or /etc/init.d appropriately.
Open the Leap Motion GUI with:
  LeapControlPanel
See /usr/share/Leap/README.linux for more information.



What files are installed:

$ dpkg-query -L leap
/etc
/etc/init
/etc/init/leapd.conf
/lib
/lib/udev
/lib/udev/rules.d
/lib/udev/rules.d/25-com-leapmotion-leap.rules
/usr
/usr/sbin
/usr/sbin/leapd
/usr/bin
/usr/bin/platforms
/usr/bin/platforms/libqxcb.so
/usr/bin/libnssutil3.so
/usr/bin/Playground
/usr/bin/libfreebl3.so
/usr/bin/Recalibrate
/usr/bin/libnspr4.so
/usr/bin/libsqlite3.so
/usr/bin/Visualizer
/usr/bin/LeapControlPanel
/usr/bin/libplc4.so
/usr/bin/libsoftokn3.so
/usr/bin/Playground_Data
/usr/bin/Playground_Data/level0
/usr/bin/Playground_Data/ScreenSelector.png
/usr/bin/Playground_Data/sharedassets1.assets
/usr/bin/Playground_Data/Managed
/usr/bin/Playground_Data/Managed/Mono.Security.dll
/usr/bin/Playground_Data/Managed/UnityEngine.dll
/usr/bin/Playground_Data/Managed/LeapCSharp.NET3.5.dll
/usr/bin/Playground_Data/Managed/Boo.Lang.dll
/usr/bin/Playground_Data/Managed/Assembly-CSharp-firstpass.dll
/usr/bin/Playground_Data/Managed/UnityScript.Lang.dll
/usr/bin/Playground_Data/Managed/Assembly-UnityScript-firstpass.dll
/usr/bin/Playground_Data/Managed/System.dll
/usr/bin/Playground_Data/Managed/UnityEngine.dll.mdb
/usr/bin/Playground_Data/Managed/System.Core.dll
/usr/bin/Playground_Data/Managed/mscorlib.dll
/usr/bin/Playground_Data/Managed/Assembly-CSharp.dll
/usr/bin/Playground_Data/Plugins
/usr/bin/Playground_Data/Plugins/x86_64
/usr/bin/Playground_Data/Plugins/x86_64/libLeap.so
/usr/bin/Playground_Data/Plugins/x86_64/ScreenSelector.so
/usr/bin/Playground_Data/Plugins/x86_64/libLeapCSharp.so
/usr/bin/Playground_Data/resources.assets
/usr/bin/Playground_Data/level1
/usr/bin/Playground_Data/PlayerConnectionConfigFile
/usr/bin/Playground_Data/mainData
/usr/bin/Playground_Data/level2
/usr/bin/Playground_Data/Mono
/usr/bin/Playground_Data/Mono/etc
/usr/bin/Playground_Data/Mono/etc/mono
/usr/bin/Playground_Data/Mono/etc/mono/1.0
/usr/bin/Playground_Data/Mono/etc/mono/1.0/machine.config
/usr/bin/Playground_Data/Mono/etc/mono/1.0/DefaultWsdlHelpGenerator.aspx
/usr/bin/Playground_Data/Mono/etc/mono/browscap.ini
/usr/bin/Playground_Data/Mono/etc/mono/mconfig
/usr/bin/Playground_Data/Mono/etc/mono/mconfig/config.xml
/usr/bin/Playground_Data/Mono/etc/mono/config
/usr/bin/Playground_Data/Mono/etc/mono/2.0
/usr/bin/Playground_Data/Mono/etc/mono/2.0/Browsers
/usr/bin/Playground_Data/Mono/etc/mono/2.0/Browsers/Compat.browser
/usr/bin/Playground_Data/Mono/etc/mono/2.0/machine.config
/usr/bin/Playground_Data/Mono/etc/mono/2.0/DefaultWsdlHelpGenerator.aspx
/usr/bin/Playground_Data/Mono/etc/mono/2.0/web.config
/usr/bin/Playground_Data/Mono/etc/mono/2.0/settings.map
/usr/bin/Playground_Data/Mono/x86_64
/usr/bin/Playground_Data/Mono/x86_64/libmono.so
/usr/bin/Playground_Data/sharedassets0.assets
/usr/bin/Playground_Data/sharedassets3.assets
/usr/bin/Playground_Data/sharedassets2.assets
/usr/bin/Playground_Data/Resources
/usr/bin/Playground_Data/Resources/unity_builtin_extra
/usr/bin/Playground_Data/Resources/unity default resources
/usr/bin/libnssdbm3.so
/usr/bin/libplds4.so
/usr/lib
/usr/lib/Leap
/usr/lib/Leap/libQt5DBus.so.5.2.1
/usr/lib/Leap/libQt5Widgets.so.5.2.1
/usr/lib/Leap/libQt5Network.so.5.2.1
/usr/lib/Leap/libQt5Gui.so.5.2.1
/usr/lib/Leap/libQt5MultimediaWidgets.so.5.2.1
/usr/lib/Leap/libQt5WebKitWidgets.so.5.2.1
/usr/lib/Leap/libQt5PrintSupport.so.5.2.1
/usr/lib/Leap/libQt5Script.so.5.2.1
/usr/lib/Leap/libQt5Sql.so.5.2.1
/usr/lib/Leap/libusb-1.0.so.0
/usr/lib/Leap/libQt5Multimedia.so.5.2.1
/usr/lib/Leap/libQt5Sensors.so.5.2.1
/usr/lib/Leap/libQt5Core.so.5.2.1
/usr/lib/Leap/libQt5Qml.so.5.2.1
/usr/lib/Leap/libQt5Quick.so.5.2.1
/usr/lib/Leap/libQt5OpenGL.so.5.2.1
/usr/lib/Leap/libQt5WebKit.so.5.2.1
/usr/lib/Leap/libQt5Positioning.so.5.2.1
/usr/share
/usr/share/Leap
/usr/share/Leap/trparams_hmd.ldat
/usr/share/Leap/README.linux
/usr/share/Leap/CyUVCDevice.ldat
/usr/share/Leap/CyUVCBootstrap.ldat
/usr/share/Leap/CyBootProgrammer.ldat
/usr/share/Leap/trparams.ldat
/usr/share/Leap/OV580.ldat
/usr/lib/Leap/libQt5Core.so.5
/usr/lib/Leap/libQt5PrintSupport.so.5
/usr/lib/Leap/libQt5Sql.so.5
/usr/lib/Leap/libQt5Gui.so.5
/usr/lib/Leap/libQt5Script.so.5
/usr/lib/Leap/libQt5WebKit.so.5
/usr/lib/Leap/libQt5Positioning.so.5
/usr/lib/Leap/libQt5Quick.so.5
/usr/lib/Leap/libQt5OpenGL.so.5
/usr/lib/Leap/libQt5Sensors.so.5
/usr/lib/Leap/libQt5MultimediaWidgets.so.5
/usr/lib/Leap/libQt5Multimedia.so.5
/usr/lib/Leap/libQt5Qml.so.5
/usr/lib/Leap/libQt5Network.so.5
/usr/lib/Leap/libQt5WebKitWidgets.so.5
/usr/lib/Leap/libQt5Widgets.so.5
/usr/lib/Leap/libQt5DBus.so.5



Other S/W

Reference






2 comments:

  1. Thanks for this!! I wasn't sure how to resolve the libgl1-mesa-glx dependency issue on my own, and I had no idea how to find the samples without the control panel, so I really appreciate you posting this.

    ReplyDelete