Difference between revisions of "PCL/OpenNI troubleshooting"

From robotica.unileon.es
Jump to: navigation, search
m
m
 
(40 intermediate revisions by the same user not shown)
Line 1: Line 1:
This page try to covers all of the issues I ran into while trying to get my Kinect device ready for developing with PCL. If you have any questions regarding this subject or know of a different bug, feel free to send me an email describing it, and I will add it to this section. Just remember to try Google first!
+
Go to root: [[PhD-3D-Object-Tracking]]
 +
 
 +
----
 +
----
 +
 
 +
 
 +
This page tries to cover all of the issues I ran into while trying to get my Kinect device ready for developing with PCL. If you have any questions regarding this subject or know of a different bug, feel free to send me an email describing it, and I will add it to this section. Just remember to try Google first!
 +
 
 +
=CUDA=
 +
 
 +
==Unsupported configuration==
 +
 
 +
When you run the CUDA installer on a fairly modern Linux, you may get a message saying that you are trying to install it on an unsupported configuration. What this means is that CUDA can not work with the newest versions of the GCC compiler. As of version 7, the highest compatible GCC is 4.8.2 for Ubuntu 14.04 LTS and 4.9.1 for 14.10 (12.04 LTS has been deprecated). Check the compatibility table [http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/#system-requirements here].
 +
 
 +
In order to solve this, you must install an older version, like 4.6 for Ubuntu 12.04, and set it as the "official" alternative for compiling (change 4.7 for your current version):
 +
 
 +
<syntaxhighlight lang=Bash>sudo apt-get install gcc-4.6 g++-4.6
 +
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
 +
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7</syntaxhighlight>
 +
 
 +
Now, run the following command and choose GCC 4.6 as alternative:
 +
 
 +
<syntaxhighlight lang=Bash>sudo update-alternatives --config gcc</syntaxhighlight>
 +
 
 +
Whenever you want to switch back to GCC 4.7 or newer, re-run the previous command. Please mind, that both C and C++ compilers are changed, not just C.
 +
 
 +
==Unsupported GPU architecture==
 +
 
 +
When compiling PCL with CUDA support enabled, you may get a <span style="color:#FF1493">''"nvcc fatal : Unsupported gpu architecture 'compute_52'"''</span> error or similar. This means that your current graphic card does not support some of the capabilities of the most modern versions of CUDA, and the SDK can not compile the binaries. You can see the compatibility info for your card model [https://en.wikipedia.org/wiki/CUDA#Supported_GPUs here].
 +
 
 +
In order to solve this, you must clean your PCL build folder by erasing all content:
 +
 
 +
<syntaxhighlight lang=Bash>rm -rf ./*</syntaxhighlight>
 +
 
 +
Configure again with CMake:
 +
 
 +
<syntaxhighlight lang=Bash>cmake ..
 +
ccmake .</syntaxhighlight>
 +
 
 +
And look for the <span style="color:#FF1493">"CUDA_ARCH_BIN"</span> option. Edit it and remove any architectures that are not compatible with your GPU, like for example 5.2 (in the above case). Then, configure and generate as usual with <span style="color:#228B22">'''C'''</span> and <span style="color:#228B22">'''G'''</span>, and compile.
 +
 
 +
=Apt=
 +
 
 +
==Unmet dependencies==
 +
 
 +
If you get an error like <span style="color:#FF1493">''"Depends: X but it is not going to be installed"''</span> while installing a package through apt (''X'' being the name of another package), it probably means that there is a conflict between two repositories offering different versions of the same package (e.g. PCL and ROS ones). To solve this, you will have to completely remove one of the repositories and stick with the other.
 +
 
 +
Another possibility is that the package in question is just broken, maybe because it is deprecated and pending removal, or because you are using a very recent release of Ubuntu and there is no version for it. I used to get this error a lot when trying to install OpenNI, but I solved it by following the advice above. Also, you can try compiling everything from source.
 +
 
 +
==Trying to overwrite X, which is also in package Y==
 +
 
 +
During the installation of the PrimeSense drivers (using the ROS approach), you may get an error that says <span style="color:#FF1493">''"trying to overwrite '/etc/openni/GlobalDefaults.ini', which is also in package libopenni-sensor-pointclouds0"''</span>. This is actually a common problem, that can happen with other packages. It means that a file included in one of the new packages is also provided by another package that is already installed. In this case, it is the <span style="color:#1E90FF">''/etc/openni/GlobalDefaults.ini''</span> file, which is already included in the package <span style="color:#228B22">''libopenni-sensor-pointclouds0''</span>, making the installation of <span style="color:#228B22">''libopenni-sensor-primesense0''</span> fail.
 +
 
 +
In order to fix it, run the following command to manually retry the installation (change the file name as necessary):
 +
 
 +
<syntaxhighlight lang=Bash>sudo dpkg -i --force-overwrite /var/cache/apt/archives/libopenni-sensor-primesense0_5.1.0.41-3+trusty1_amd64.deb</syntaxhighlight>
 +
 
 +
This time, you will be prompted whether or not you want to overwrite the file. Choose yes, and then use the following command to make sure there are no packages left pending:
 +
 
 +
<syntaxhighlight lang=Bash>sudo apt-get -f install</syntaxhighlight>
 +
 
 +
=CMake=
 +
 
 +
==VTK warnings==
 +
 
 +
When running CMake to configure your PCL project before building it, you may get a lot of messages that say something like this:
 +
 
 +
<syntaxhighlight lang=make>-- The imported target "vtkPythonCore" references the file
 +
    "/usr/lib/libvtkPythonCore.so.5.8.0"
 +
but this file does not exist.  Possible reasons include:
 +
* The file was deleted, renamed, or moved to another location.
 +
* An install or uninstall procedure did not complete successfully.
 +
* The installation package was faulty and contained
 +
    "/usr/lib/vtk-5.8/VTKTargets-release.cmake"
 +
but not all the files it references.</syntaxhighlight>
 +
 
 +
The program will build anyway, so this is not a big issue. But if you find the messages annoying, you can fix it by installing two packages:
 +
 
 +
<syntaxhighlight lang=Bash>sudo apt-get install python-vtk libvtk-java</syntaxhighlight>
 +
 
 +
==QVTK_LIBRARY_DEBUG or QVTK_LIBRARY_RELEASE not found==
 +
 
 +
If this error comes up when trying to configure the CMake build of PCL trunk, then you must install these two packages:
 +
 
 +
<syntaxhighlight lang=Bash>sudo apt-get install libvtk6-dev libqt5opengl5-dev</syntaxhighlight>
 +
 
 +
Doing this will replace VTK 5 with version 6 and Qt 4 with version 5, which are the ones now officially supported by PCL 1.8.
 +
 
 +
=GCC=
 +
 
 +
==No such instruction==
 +
 
 +
When building PCL, it is possible that compilation will fail with a message like <span style="color:#FF1493">''"no such instruction: `vfmadd312ss 32(%rsp),%xmm15,%xmm7'"''</span>. What this means is that you have a combination of a brand new i7 CPU and an outdated compiler (such as GCC 4.6, which comes with Ubuntu 12.04). You could try to update to GCC 4.8, with it is a bit complicated, but there is an easier solution. Configure again the project with:
 +
 
 +
<syntaxhighlight lang=Bash>ccmake .</syntaxhighlight>
 +
 
 +
Now, you must press <span style="color:#228B22">'''T'''</span> to toggle advanced mode. Then, look for the <span style="color:#FF1493">"CMAKE_C_FLAGS"</span> and <span style="color:#FF1493">"CMAKE_CXX_FLAGS"</span> options. Edit them and add <span style="color:#FF1493">"-march=corei7"</span> (by default, <span style="color:#FF1493">"-march=native"</span> is set in the Makefiles). Configure and generate (<span style="color:#228B22">'''C'''</span> and <span style="color:#228B22">'''G'''</span>), and resume the compilation.
 +
 
 +
=PCL=
 +
 
 +
==Point type not properly registered==
 +
 
 +
You will get this error if you try to save or load a descriptor that does not have its own defined custom PointType (and uses <span style="color:#FF1493">"pcl::Histogram<>"</span>). See [[PCL/OpenNI_tutorial_4:_3D_object_recognition_%28descriptors%29#Saving_and_loading|this]] for the solution.
 +
 
 +
=OpenNI=
  
 
==No device found / No devices connected==
 
==No device found / No devices connected==
 +
 +
===Microsoft Kinect===
  
 
If your system does not seem to be able to use Kinect, despite it being correctly plugged and listed by <span style="color:#228B22">''lsusb''</span>, then you may have a problem with the installed drivers. I eventually discovered that, in 32-bit Ubuntu, it was necessary to downgrade <span style="color:#228B22">''openni-dev''</span> and <span style="color:#228B22">''ps-engine''</span> to versions 1.3.2.1 and 5.0.3.3 respectively, using your package manager.
 
If your system does not seem to be able to use Kinect, despite it being correctly plugged and listed by <span style="color:#228B22">''lsusb''</span>, then you may have a problem with the installed drivers. I eventually discovered that, in 32-bit Ubuntu, it was necessary to downgrade <span style="color:#228B22">''openni-dev''</span> and <span style="color:#228B22">''ps-engine''</span> to versions 1.3.2.1 and 5.0.3.3 respectively, using your package manager.
Line 7: Line 113:
 
If you use <span style="color:#228B22">''Synaptic''</span>, the instructions are simple. Select both mentioned packages, press <span style="color:#228B22">'''Ctrl+E'''</span> to choose the desired version you want installed, and then apply the changes, accepting to overwrite any files. Then, to prevent them from being restored in the next upgrade, select each and click the <span style="color:#228B22">''"Lock Version"''</span> option in the <span style="color:#228B22">''"Package"''</span> menu. The packages will then be picked up by the <span style="color:#FF1493">"Status: Pinned"</span> filter on the left. Reboot, and everything should be working now.
 
If you use <span style="color:#228B22">''Synaptic''</span>, the instructions are simple. Select both mentioned packages, press <span style="color:#228B22">'''Ctrl+E'''</span> to choose the desired version you want installed, and then apply the changes, accepting to overwrite any files. Then, to prevent them from being restored in the next upgrade, select each and click the <span style="color:#228B22">''"Lock Version"''</span> option in the <span style="color:#228B22">''"Package"''</span> menu. The packages will then be picked up by the <span style="color:#FF1493">"Status: Pinned"</span> filter on the left. Reboot, and everything should be working now.
  
[[Image:Synaptic_Kinect_lock.png|thumb|none|700px|Downgraded and locked ''openni-dev'' and ''ps-engine'' in Synaptic package manager.]]
+
[[Image:Synaptic_Kinect_lock.png|thumb|center|700px|Downgraded and locked ''openni-dev'' and ''ps-engine'' in Synaptic package manager.]]
 +
 
 +
===ASUS Xtion PRO===
 +
 
 +
In order to get our Xtion device working with OpenNI, we have to modify a configuration file:
 +
 
 +
<syntaxhighlight lang=Bash>sudo nano /etc/openni/GlobalDefaults.ini</syntaxhighlight>
 +
 
 +
If you installed OpenNI manually instead of using the repositories, the file is located in a different path:
 +
 
 +
<syntaxhighlight lang=Bash>sudo nano /usr/etc/primesense/GlobalDefaults.ini</syntaxhighlight>
 +
 
 +
Find (<span style="color:#228B22">'''Ctrl+W'''</span>) the line that says <span style="color:#FF1493">";UsbInterface=2"</span> and uncomment it (remove the semicolon at the start). Save the file (<span style="color:#228B22">'''Ctrl+O'''</span>) and close (<span style="color:#228B22">'''Ctrl+X'''</span>). Reboot your computer, and you should be able to use your Xtion device with OpenNI/PCL. Whenever you want to switch back to a Kinect, you must comment the line, or else you will get the same <span style="color:#FF1493">''"No devices connected"''</span> or <span style="color:#FF1493">''"USB interface is not supported!"''</span> error.
 +
 
 +
If you still get this error, or you have another problem, like inconsistent framerate or freeze-ups, check that your Xtion is not plugged to an USB 3.0 port. Sadly, the firmware has a bug that prevents the device from working with 3.0 ports. Either switch to a 2.0 one (if your computer does not have one, you can use a [https://en.wikipedia.org/wiki/USB_hub hub]) or try applying [https://github.com/nh2/asus-xtion-fix this fix].
  
 
==glInit() not found / OpenGL isues==
 
==glInit() not found / OpenGL isues==
Line 25: Line 145:
 
==Permission denied==
 
==Permission denied==
  
If you get this error related to some header (.h) in <span style="color:#FF8C00">''/usr/include/''</span>, it means that some installer has given the wrong permissions when moving files there, and the compiler can not access them. Locate the faulty file and change its permissions to allow reading for everyone:
+
If you get this error related to some header (.h) in <span style="color:#FF8C00">''/usr/include/''</span>, it means that OpenNI's installer has given the wrong permissions when moving files there, and the compiler can not access them. Locate the faulty file and change its permissions to allow reading for everyone:
 +
 
 +
<syntaxhighlight lang=Bash>sudo chmod +r -R /usr/include/<file></syntaxhighlight>
 +
 
 +
For example, a very drastic (and not recommended) way of fixing this for OpenNI's headers would be:
 +
 
 +
<syntaxhighlight lang=Bash>sudo chmod 0777 -R /usr/include/ni/</syntaxhighlight>
 +
 
 +
 
 +
----
 +
----
 +
 
 +
Go to root: [[PhD-3D-Object-Tracking]]
 +
 
 +
Links to articles:
 +
 
 +
[[PCL/OpenNI tutorial 0: The very basics]]
 +
 
 +
[[PCL/OpenNI tutorial 1: Installing and testing]]
 +
 
 +
[[PCL/OpenNI tutorial 2: Cloud processing (basic)]]
 +
 
 +
[[PCL/OpenNI tutorial 3: Cloud processing (advanced)]]
 +
 
 +
[[PCL/OpenNI tutorial 4: 3D object recognition (descriptors)]]
 +
 
 +
[[PCL/OpenNI tutorial 5: 3D object recognition (pipeline)]]
  
<syntaxhighlight lang=Bash>sudo chmod +r /usr/include/<file></syntaxhighlight>
+
[[PCL/OpenNI troubleshooting]]

Latest revision as of 23:29, 1 November 2015

Go to root: PhD-3D-Object-Tracking




This page tries to cover all of the issues I ran into while trying to get my Kinect device ready for developing with PCL. If you have any questions regarding this subject or know of a different bug, feel free to send me an email describing it, and I will add it to this section. Just remember to try Google first!

CUDA

Unsupported configuration

When you run the CUDA installer on a fairly modern Linux, you may get a message saying that you are trying to install it on an unsupported configuration. What this means is that CUDA can not work with the newest versions of the GCC compiler. As of version 7, the highest compatible GCC is 4.8.2 for Ubuntu 14.04 LTS and 4.9.1 for 14.10 (12.04 LTS has been deprecated). Check the compatibility table here.

In order to solve this, you must install an older version, like 4.6 for Ubuntu 12.04, and set it as the "official" alternative for compiling (change 4.7 for your current version):

sudo apt-get install gcc-4.6 g++-4.6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6 
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7

Now, run the following command and choose GCC 4.6 as alternative:

sudo update-alternatives --config gcc

Whenever you want to switch back to GCC 4.7 or newer, re-run the previous command. Please mind, that both C and C++ compilers are changed, not just C.

Unsupported GPU architecture

When compiling PCL with CUDA support enabled, you may get a "nvcc fatal : Unsupported gpu architecture 'compute_52'" error or similar. This means that your current graphic card does not support some of the capabilities of the most modern versions of CUDA, and the SDK can not compile the binaries. You can see the compatibility info for your card model here.

In order to solve this, you must clean your PCL build folder by erasing all content:

rm -rf ./*

Configure again with CMake:

cmake ..
ccmake .

And look for the "CUDA_ARCH_BIN" option. Edit it and remove any architectures that are not compatible with your GPU, like for example 5.2 (in the above case). Then, configure and generate as usual with C and G, and compile.

Apt

Unmet dependencies

If you get an error like "Depends: X but it is not going to be installed" while installing a package through apt (X being the name of another package), it probably means that there is a conflict between two repositories offering different versions of the same package (e.g. PCL and ROS ones). To solve this, you will have to completely remove one of the repositories and stick with the other.

Another possibility is that the package in question is just broken, maybe because it is deprecated and pending removal, or because you are using a very recent release of Ubuntu and there is no version for it. I used to get this error a lot when trying to install OpenNI, but I solved it by following the advice above. Also, you can try compiling everything from source.

Trying to overwrite X, which is also in package Y

During the installation of the PrimeSense drivers (using the ROS approach), you may get an error that says "trying to overwrite '/etc/openni/GlobalDefaults.ini', which is also in package libopenni-sensor-pointclouds0". This is actually a common problem, that can happen with other packages. It means that a file included in one of the new packages is also provided by another package that is already installed. In this case, it is the /etc/openni/GlobalDefaults.ini file, which is already included in the package libopenni-sensor-pointclouds0, making the installation of libopenni-sensor-primesense0 fail.

In order to fix it, run the following command to manually retry the installation (change the file name as necessary):

sudo dpkg -i --force-overwrite /var/cache/apt/archives/libopenni-sensor-primesense0_5.1.0.41-3+trusty1_amd64.deb

This time, you will be prompted whether or not you want to overwrite the file. Choose yes, and then use the following command to make sure there are no packages left pending:

sudo apt-get -f install

CMake

VTK warnings

When running CMake to configure your PCL project before building it, you may get a lot of messages that say something like this:

-- The imported target "vtkPythonCore" references the file
    "/usr/lib/libvtkPythonCore.so.5.8.0"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
    "/usr/lib/vtk-5.8/VTKTargets-release.cmake"
but not all the files it references.

The program will build anyway, so this is not a big issue. But if you find the messages annoying, you can fix it by installing two packages:

sudo apt-get install python-vtk libvtk-java

QVTK_LIBRARY_DEBUG or QVTK_LIBRARY_RELEASE not found

If this error comes up when trying to configure the CMake build of PCL trunk, then you must install these two packages:

sudo apt-get install libvtk6-dev libqt5opengl5-dev

Doing this will replace VTK 5 with version 6 and Qt 4 with version 5, which are the ones now officially supported by PCL 1.8.

GCC

No such instruction

When building PCL, it is possible that compilation will fail with a message like "no such instruction: `vfmadd312ss 32(%rsp),%xmm15,%xmm7'". What this means is that you have a combination of a brand new i7 CPU and an outdated compiler (such as GCC 4.6, which comes with Ubuntu 12.04). You could try to update to GCC 4.8, with it is a bit complicated, but there is an easier solution. Configure again the project with:

ccmake .

Now, you must press T to toggle advanced mode. Then, look for the "CMAKE_C_FLAGS" and "CMAKE_CXX_FLAGS" options. Edit them and add "-march=corei7" (by default, "-march=native" is set in the Makefiles). Configure and generate (C and G), and resume the compilation.

PCL

Point type not properly registered

You will get this error if you try to save or load a descriptor that does not have its own defined custom PointType (and uses "pcl::Histogram<>"). See this for the solution.

OpenNI

No device found / No devices connected

Microsoft Kinect

If your system does not seem to be able to use Kinect, despite it being correctly plugged and listed by lsusb, then you may have a problem with the installed drivers. I eventually discovered that, in 32-bit Ubuntu, it was necessary to downgrade openni-dev and ps-engine to versions 1.3.2.1 and 5.0.3.3 respectively, using your package manager.

If you use Synaptic, the instructions are simple. Select both mentioned packages, press Ctrl+E to choose the desired version you want installed, and then apply the changes, accepting to overwrite any files. Then, to prevent them from being restored in the next upgrade, select each and click the "Lock Version" option in the "Package" menu. The packages will then be picked up by the "Status: Pinned" filter on the left. Reboot, and everything should be working now.

Downgraded and locked openni-dev and ps-engine in Synaptic package manager.

ASUS Xtion PRO

In order to get our Xtion device working with OpenNI, we have to modify a configuration file:

sudo nano /etc/openni/GlobalDefaults.ini

If you installed OpenNI manually instead of using the repositories, the file is located in a different path:

sudo nano /usr/etc/primesense/GlobalDefaults.ini

Find (Ctrl+W) the line that says ";UsbInterface=2" and uncomment it (remove the semicolon at the start). Save the file (Ctrl+O) and close (Ctrl+X). Reboot your computer, and you should be able to use your Xtion device with OpenNI/PCL. Whenever you want to switch back to a Kinect, you must comment the line, or else you will get the same "No devices connected" or "USB interface is not supported!" error.

If you still get this error, or you have another problem, like inconsistent framerate or freeze-ups, check that your Xtion is not plugged to an USB 3.0 port. Sadly, the firmware has a bug that prevents the device from working with 3.0 ports. Either switch to a 2.0 one (if your computer does not have one, you can use a hub) or try applying this fix.

glInit() not found / OpenGL isues

If you get this error while compiling OpenNI, and you are sure you have installed all dependencies, then this is due to faulty Makefiles that do not link against GL libraries where they should.

Go to the Platform/Linux/Build/Samples/ subdirectory and find the samples that are giving errors (look at the compiler output to find them). For each one, enter its subdirectory and open the Makefile you will find there. Go to the line that says:

USED_LIBS += glut

And change it to the following:

USED_LIBS += glut GL

The samples should now compile.

Permission denied

If you get this error related to some header (.h) in /usr/include/, it means that OpenNI's installer has given the wrong permissions when moving files there, and the compiler can not access them. Locate the faulty file and change its permissions to allow reading for everyone:

sudo chmod +r -R /usr/include/<file>

For example, a very drastic (and not recommended) way of fixing this for OpenNI's headers would be:

sudo chmod 0777 -R /usr/include/ni/




Go to root: PhD-3D-Object-Tracking

Links to articles:

PCL/OpenNI tutorial 0: The very basics

PCL/OpenNI tutorial 1: Installing and testing

PCL/OpenNI tutorial 2: Cloud processing (basic)

PCL/OpenNI tutorial 3: Cloud processing (advanced)

PCL/OpenNI tutorial 4: 3D object recognition (descriptors)

PCL/OpenNI tutorial 5: 3D object recognition (pipeline)

PCL/OpenNI troubleshooting