Thursday, January 14, 2016

Installing Asus Xtion (on Ubuntu 14.04)

As of writing these lines (14/01/2016), the PrimeSense / Asus Xtion is a rather old device now. It has not really found its equivalent as a standard in depth sensing though and is still very much the standard in depth-based dev (i.e. SLAM...). Because of this we will show you some steps which have worked for us to install an Asus Xtion on a Gigabyte P34 laptop running Ubuntu 14.04.5 (also tested with 14.04.2).

Let's first start by stating that it takes a few seconds to set-up when you know the steps to follow but it takes hours to get to know which steps are relevant (in jungle of possible problems found on the Internet.

The painful symptom is that whatever you do, the device is not found:
  • The error output is:
After initialization:
SimpleViewer: Device open failed:
DeviceOpen using default: no devices found

  • Despite ASUS being listed when using lsusb
  • And despite the device being recognized when plugging it and running dmesg

What was tested and does NOT work (device not found):
  • Installing the OpenNI 2 binaries from the Structure website
    • The solution uses OpenNI 2 but recompiled 
  •  Recompiling the primesense driver from github/primesense
    • It is still available
    • There were 2 errors during the compilation (XnOS.h is not found and when I look at it from the source, it is only present in the PSCommon folder, which does not look right... There is also a 2nd error...)
  • A lot of posts on the web refer to using the Asus Xtion with ROS
    • These advices are irrelevant to our case that do not include ROS
  • Installing libfreenect and OpenNI2-FreenectDriver from OpenKinect 
    • These are for the Kinect (v1), not for the Asus Xtion 

Uncertain steps (we have no idea whether they had an influence):
  • We have updated the firmware
    • This operation has to be done on windows
    • The Firmware update is provided on the Asus website (windows section)
    • The device was of type 0600 before the firmware update and 0601 after (use lsusb to check)
  • Under windows the device only works if the XHCI mode is disabled in the BIOS
    • Not sure about this (I have not re-enabled the XHCI mode)
    • In a general way there seem to be problems with using the device on a USB 3 port. Disabling XHCI transforms USB 3 ports in USB 2
    • Some more explanations here

What has worked:
  • In folder Tools, create folder AsusXtion/Sensor
  • Installing the Linux drivers & SDK binaries from the Asus website
    • The version to download comes from the linux platform (not the Ubuntu platform)
    • This file Xtion_Driver_SDK.zip contains a folder SDK, which itself contains a Linux_x64_20.2.0.rar file. Unrar this file (the unrar package need to be installed) and copy the content of archive Sensor_Bin_Linux64_v5.0.2.3.tar.bz2 into folder Tools/AsusXtion/Sensor
    • Then I have called script sudo ./install
      • It outputs a log error: niReg is not found, at line 50, and you should not mind about this error message
    • OpenNI + NITE (nothing to do for these - we do not use them)
      • The OpenNI and NITE version provided by Asus in Xtion_Driver_SDK.zip where not used
      • Asus also propose another version of the OpenNI package (v20.4.2.20) which I have not tested
  • Recompiling OpenNI 2 from occipital the Structure website
    • The sources are here in github/occipital
      • Les cloner dans Tools/AsusXtion
    • Use branch develop
    • There are few dependencies to install 
      • Suivre les indications du Readme.md
      • Among them the java dev kit (jdk)
        • Otherwise it gives (hardly noticeable) errors
        • Type javac in a terminal to know if it is installed
    • make 
      • From Tools/asusXtion/OpenNI2
      • make
    • install 
      • From folder Tools/asusXtion/OpenNI2/Packaging/Linux
      • sudo ./install  
  • Tester avec NiViewer:
    • cd Tools/AsusXtion/OpenNI2/Bin/x64_Release
    • ./NiViewer
    • I had to wait a bit after the compilation / install of OpenNI2 for the system to work, I have also plugged / unplugged a few times... 

NOTE:
  • Because they are so important to us:
    • Archive Xtion_Driver_SDK.zip was saved into the dev folder of our google drive
    • Repo github.com/occipital/openni2 was forked in our github

Useful links: