Ask Your Question
1

Unabe to Install freenect in ROS-Melodic/Ubuntu 18.04

asked 2019-01-27 04:59:02 -0500

athul gravatar image

I wanted to install freenect in ROS to take depth images using Kinect XBOX 360 1473. I cloned the repository from https://github.com/ros-drivers/freene... and kept it in ~/catkin_ws/src under the folder name freenect_stack. Upon running catkin_make in ~/catkin_ws I get the following error:

[ 21%] Building CXX object freenect_stack/freenect_camera/CMakeFiles/freenect_nodelet.dir/src/nodelets/driver.cpp.o
In file included from /home/athul/catkin_ws/src/freenect_stack/freenect_camera/src/nodelets/driver.h:54:0,
                 from /home/athul/catkin_ws/src/freenect_stack/freenect_camera/src/nodelets/driver.cpp:39:
/home/athul/catkin_ws/src/freenect_stack/freenect_camera/include/freenect_camera/freenect_driver.hpp:4:10: fatal error: libfreenect/libfreenect.h: No such file or directory
 #include <libfreenect/libfreenect.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
freenect_stack/freenect_camera/CMakeFiles/freenect_nodelet.dir/build.make:62: recipe for target 'freenect_stack/freenect_camera/CMakeFiles/freenect_nodelet.dir/src/nodelets/driver.cpp.o' failed
make[2]: *** [freenect_stack/freenect_camera/CMakeFiles/freenect_nodelet.dir/src/nodelets/driver.cpp.o] Error 1
CMakeFiles/Makefile2:2697: recipe for target 'freenect_stack/freenect_camera/CMakeFiles/freenect_nodelet.dir/all' failed
make[1]: *** [freenect_stack/freenect_camera/CMakeFiles/freenect_nodelet.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j1 -l1" failed

Please help. Any input is welcome.

edit retag flag offensive close merge delete

5 Answers

Sort by ยป oldest newest most voted
2

answered 2019-07-22 21:09:03 -0500

WyattAutomation gravatar image

I was able to install this, and I don't know if it's going to work like I'm expecting but I now have libfreenect and the ros freenect_launch and other freenect_node stuff all installed in Melodic on Ubuntu18.04, per the commands below:

Compile/install libfreenect from source, NOT an apt install of libfreenect-dev (if you installed that via apt it shouldn't hurt, it just won't work. No need to remove that apt package afaik):

cd  ~    
git clone https://github.com/OpenKinect/libfreenect.git    
cd libfreenect    
mkdir build   
cd build    
cmake -L ..    
make
sudo make install

Then, cd into your catkin workspace source, (I'm assuming yours is "~/catkin_workspace/src" but you may need to change that if yours is different). Clone the repo, then cd up one directory back into your catkin workspace root, and run catkin_make:

cd ~/catkin_workspace/src
git clone https://github.com/ros-drivers/freenect_stack.git
cd ..
catkin_make

I'm on Ubuntu 18.04 running ROS Melodic, and was able to get this installed the day of this post (July20-22, 2019).

Whoever is running this repo really should just update the package to make it installable via apt, it already appears to work with Melodic, it's just grief for us noobs..

(just kidding, I appreciate the work that's been put into this; without it my $8 Xbox 360 Kinect from a thrift store wouldn't be of any use to me. Would really like to help make this easier to install on Melodic, but the repo looks so dead I don't even want to put in a pull request..)

Let me know if you run into problems with this; I haven't tested it at all but it DOES install.

It's still a very useful tool you know? What's 2019 if you can't build robots of doom out of scrap consumer electronics?..

edit flag offensive delete link more
1

answered 2019-01-27 13:12:28 -0500

jayess gravatar image

Is there a reason that you can't install the binary?

Anyways, try installing the dependencies before compiling. From the root of your workspace, run

~/catkin_ws$ rosdep install --from-paths src -i
~/catkin_ws$ catkin_make
edit flag offensive delete link more

Comments

Is there a reason that you can't install the binary?

afaict, freenect_stack hasn't been released for Melodic.

gvdhoorn gravatar image gvdhoorn  ( 2019-01-28 03:02:40 -0500 )edit

@gvdhoorn Thanks. I figured as much, wasn't sure though

jayess gravatar image jayess  ( 2019-01-28 03:18:31 -0500 )edit

I guess libfreenect does not work with melodic :(

The error I got when I ran rosdep:

ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
freenect_camera: Cannot locate rosdep definition for [libfreenect]

@gvdhoorn@jayess Thanks

athul gravatar image athul  ( 2019-01-28 03:49:33 -0500 )edit

I'm having the same issue. I have libfreenect and libfreenect-dev installed, but freenect_stack won't build.

wesliao gravatar image wesliao  ( 2019-02-05 15:13:18 -0500 )edit

same problem :-(

ChriMo gravatar image ChriMo  ( 2019-02-13 12:51:57 -0500 )edit

see my answer posted itt; I was able to get it installed and preliminary tests suggest it works fine.

WyattAutomation gravatar image WyattAutomation  ( 2019-07-22 21:10:18 -0500 )edit
0

answered 2020-02-27 14:38:28 -0500

As @skakareko mentioned, the issue is the way the headers are specified. The header files are installed in a different location when libfreenect is installed through ubunut deb vs ros-drivers. The way freenect_stack was written assumes libfreenect is installed the through the ros-drivers repository.

If you checkout the fork from this pull request, it utilizes the deb installation of libfreenect rather than being held up on a melodic release of ros-drivers/libfreenect which is no longer maintained.

edit flag offensive delete link more
0

answered 2020-02-21 10:32:11 -0500

You can build freenect_stack with the version of freenect library installed by apt package manager.

Compiler could not find libfreenect/libfreenect.h, because after installation of libfreenect-dev package, the header file is located at /usr/include/libfreenect.h (note absence of libfreenect folder).

You can create symlinks for libfreenect header files to avoid messing around with the source code:

sudo mkdir /usr/include/libfreenect
sudo ln -s /usr/include/libfreenect*.h /usr/include/libfreenect/

I was able to build the package afterwards.
A quick test with RGB and depth images was fine.

edit flag offensive delete link more
0

answered 2020-05-10 04:18:10 -0500

Wintermute gravatar image

Just in case anybody encounters it, in search of solutions - I recently wrote an article about using Kinect 360 and RTAB-MAP ROS Melodic with Rasberry Pi 4, with some tweaks it does work now! https://www.hackster.io/dmitrywat/rgb...

edit flag offensive delete link more

Comments

1

+100 for sharing your solution with the community, but link-only answers are not very nice: if (when) your blog changes, the link will 404 or be located somewhere else. Future readers cannot benefit from it any more then.

It would be good if you could post the important parts of your solution here in your answer to make it stand-alone.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-10 04:28:15 -0500 )edit

There shouldn't be any need to clone freenect-stack directly on Melodic as the latest binary release should have taken care of the issue in the question. If cloning and compiling from source is still required, please open an issue on the freenect github!

maxsvetlik gravatar image maxsvetlik  ( 2020-05-12 10:14:27 -0500 )edit

Point taken :) The article itself is quite long, so I cannot post all of it - besides for freenect driver and freenect_stack the procedure is the same as in https://answers.ros.org/question/3138... What took most of my time and was difficult to figure out is this: " as soon as I would try accessing two streams simultaneously the Kinect would start timing out. Then in one of GitHub's issues I saw an account of a person who said their Kinect was unstable, until they "loaded the USB bus" by connecting WiFi dongle. I tried that and it worked. On the one hand, I'm glad that it worked. On the other hand, somebody is really ought to fix that. " This issue is very likely Raspberry Pi 4 specific and related to libusb or freenect drivers.

Wintermute gravatar image Wintermute  ( 2020-05-12 20:52:31 -0500 )edit

maxsvetlik the article is about ROS Melodic on Debian Buster - it doesn't have pre-built binaries :) so still need to build from source

Wintermute gravatar image Wintermute  ( 2020-05-12 20:54:04 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2019-01-27 04:59:02 -0500

Seen: 1,778 times

Last updated: May 10