Kinect v2 – Kinect xbox one on ROS noetic – ubuntu 20.04 – Cuda 10.1

Exploring Kinect v2 – Kinect xbox one on ROS noetic – ubuntu 20.04 – Cuda 10.1

Software required, cuda its optional

cuda 10.1

libfreenect2

iai-kinect2

 

https://www.notaboutmy.life/posts/run-kinect-2-on-ubuntu-20-lts/

I followed the document available on  address above, to successfully install the cuda and libfreenect2 with cuda.

As is, the procedure described failed. I need  to add some more steps. The steps are found after hours of trial and error.

This process install the cuda 10.1 from the ubuntu 20.04 repos. Before this procedure I tried the installation form nvidia repos, but i never had success.

Install and test nvidia cuda from ubuntu repos

apt-get install cuda-toolkit -y

After install you may check the installed cuda compiler version with

nvcc –version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243

Then to check if the cuda is working, you need to compile the hello.cu code available in the following address:

https://linuxconfig.org/how-to-install-cuda-on-ubuntu-20-04-focal-fossa-linux

Compile a Sample CUDA code

$ nvcc -o hello hello.cu
$ ./hello
Max error: 0.000000

The result must be

Max error: 0.000000

if we get the following, something is wrong

Max error: 2.000000

You can proceed with libfreenect2 installation, but cuda will not work

 

Prepare the install of libfreenect2, installing the build tools and libraries

sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libusb-1.0-0-dev
sudo apt-get install libturbojpeg0-dev
sudo apt-get install libglfw3-dev
sudo apt-get install libva-dev libjpeg-dev
sudo apt-get install libopenni2-dev
sudo apt-get install doxygen
sudo apt-get install nvidia-opencl-dev

You need gcc 8 to compile libfreenect2 with cuda

sudo apt -y install gcc-7 g++-7 gcc-8 g++-8 gcc-9 g++-9
sudo update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-7 7
sudo update-alternatives –install /usr/bin/g++ g++ /usr/bin/g++-7 7
sudo update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-8 8
sudo update-alternatives –install /usr/bin/g++ g++ /usr/bin/g++-8 8
sudo update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-9 9
sudo update-alternatives –install /usr/bin/g++ g++ /usr/bin/g++-9 9

# select v8:

sudo update-alternatives –config gcc
sudo update-alternatives –config g++

# check version

gcc –version
g++ –version