Asus XTion PRO Live: OpenNI2 compilation and install instructions

[Last update: 2015 , 8th January]

MyzharBot uses an Asus Xtion Pro Live RGB-D sensor to detect obstacles, to create a 3D map of the environment and to localize itself in the map. Asus Xtion Pro Live is fully supported by the ROS framework (follow the guide), but if you want to use it outside ROS you need to compile OpenNI2 by yourself following this guide.

You can compile OpenNI2 by yourfself following this guide, or you can download the precompiled package and install it jumping directly to “Installation”.

Compilation phase

  1. Open a terminal (Ctrl+Alt+t)
  2. Install dependencies:
  3. Create a “devel” folder:
  4. Navigate to “devel” folder:
  5. Clone OpenNI2 repository:
  6. Navigate to OpenNI2 folder:
  7. Set the compile flags to build for the Jetson:
    1. Run:

      You will get:
      ./ThirdParty/PSCommon/BuildSystem/Platform.Arm
    2. Run gedit:

      1. Find:
        CFLAGS += -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard
      2. Replace with:
      3. Save the file and exit
  8. Add support for pthread library:

    1. Search the line
      [Line 97] LDFLAGS += -Wl,-rpath ./
      and the line
      [Line 98] OUTPUT_COMMAND = $(CXX) -o $(OUTPUT_FILE) $(OBJ_FILES) $(LDFLAGS)
      Add the code between the two lines:
      LDFLAGS += -Wl,-rpath ./

      OUTPUT_COMMAND = $(CXX) -o $(OUTPUT_FILE) $(OBJ_FILES) $(LDFLAGS)
    2. Save the file and exit
  9. Add Samples to the build chain to test the correctness of the installation:
      1. Add this line at the end of the file:
    1. Save the file and exit
  10. Start compilation:
  11. Compile tools to get “NiViewer” (NiViewer needs GLUT enabled):

OpenNI2 default Test

  1. Navigate to samples folder:
  2. Connect Asus Xtion Pro Live to the front USB Port
  3. Test “SimpleRead”:

    If everything is ok you can see a list of number constantly updating… this is the distance from the center point of the sensor to the nearest object in front of it.
  4. Test “NiViewer”:

    If everything is ok you can see two images as in the following figures. The image on the left is the depth map, the image on the right is the RGB image. You can try many settings, press “?” for the full list of commands.

Generate redistributable package

  1. Navigate to Packaging directory:
  2. Generate redistributable:
  3. At the end of the long process you will find the redistributable in the folder “~/devel/OpenNI2/Final

Installation

Install the compiled OpenNI2 library:

  1. Move to “Package” folder:
  2. Go to the new directory:
  3. Run the installation script to install the udev rule:
  4. Copy “lib” files and “include” files to system path:
  5. Update the library cache:
  6. Set permission to be able to use the sensor:
  7. Create a Package Config file:
    1. Create the file and edit:
    2. Fill the file with:
  8. To make sure it is correctly found, run:

    You should get 2.2.0.0 as reply

Precompiled OpenNI2

You can avoid to compile OpenNI2 by yourself downloading the precompiled version from the following link:

Precompiled OpenNI2 for NVidia Jetson TK1
Precompiled OpenNI2 for NVidia Jetson TK1
OpenNI-Linux-Arm-2.2.tar.bz2
Version: 2.2.0
2.7 MiB
351 Downloads
Details
  1. Extract the archive:
  2. Follow the above installation procedure starting by “Step 2”

ROS

If you want to use OpenNI2 and Asus Xtion Pro Live with ROS framework you can follow the apposite guide.

[Many thanks to Jetson Hack for the contribution]

Precompiled OpenNI2 for NVidia Jetson TK1
Precompiled OpenNI2 for NVidia Jetson TK1
OpenNI-Linux-Arm-2.2.tar.bz2
Version: 2.2.0
2.7 MiB
351 Downloads
Details

20 Comments:

  1. Pingback: Added a guide to compile OpenNI2 for NVidia Jetson TK1 - MyzharBot v3.1.1

  2. Pingback: Building OpenNI2 for the Structure Sensor - NVIDIA Jetson TK1 Dev

  3. Pingback: OpenNI2 ASUS Xtion - NVIDIA Jetson TK1 Dev

  4. Pingback: Asus Xtion Pro added to ROS on NVidia Jetson TK1 - MyzharBot v3.1.1

  5. In step 3 of the OpenNI2 default Test section I continue to get and error where it says “Failed to open the USB device!” and lists the specific device. I ran lsusb and it was there and the Asus is working on my Windows Computer. Have you had this issue?

    • I just ran “sudo ./SimpleRead” and it worked. What can I do so it doesn’t need super user permissions to run? Will this be an issue with ROS integration?

  6. GLUT_SUPPORTED=1 make tools -j4 gives an error:
    *** No rule to make target tools. Stop.

    A little help please?

  7. Nice tutorial. Thanks. Can you provide windows installation guide?

  8. ram@ram-ThinkPad-L440:~/devel/OpenNI2$ PLATFORM=Arm make
    ThirdParty/PSCommon/BuildSystem/CommonDefs.mak:36: *** Cross-Compilation error. Can’t find ARM_CXX and ARM_STAGING. Stop.

    Can you please help on the above error…

    • Actually i didn’t know it was for Jetson kit…so instead of changing files as mentioned, I directly did a make after cloning and it worked :-)… sorry for the trouble…

  9. When I run the install.sh script from the pre-compiled installation, there is no Bin directory. In fact, the directory structure is quite different. Does that method even work?

  10. I’m failing to get this to work with OpenCV2. Instead of repeating everything here, I’ll direct you to my post on Nvidia’s forum. I’ve tried rebuilding; NiViewer works just fine. I just can’t for the life of me get OpenCV to do video capture the ASUS.

    https://devtalk.nvidia.com/default/topic/983034/jetson-tk1/cannot-capture-video-from-asus-xtion-using-opencv-on-jetson-tk1/

Leave a Comment