Coder Social home page Coder Social logo

iai_kinect2's Introduction

IAI Kinect2

Maintainer

Read this first

Please read this README and the ones of the individual components throughly before asking questions. We get a lot of repeated questions, so when you have a problem, we urge everyone to check the github issues (including closed ones). Your issue is very likely discussed there already.

The goal of this project is to give you a driver and the tools needed to receive data from the Kinect-2 sensor, in a way useful for robotics. You will still need to know how to use ROS to make use of it. Please follow the ROS tutorials. You will also need to learn how to work with point-clouds, or depth-clouds, or images (computer vision) to do useful things with the data.

Note: Please use the GitHub issues for questions and problems regarding the iai_kinect2 package and its components. Do not write emails.

Table of contents

Description

This is a collection of tools and libraries for a ROS Interface to the Kinect One (Kinect v2).

It contains:

FAQ

If I have any question or someting is not working, what should I do first?

First you should look at this FAQ and the FAQ from libfreenect2. Secondly, look at issue page from libfreenect2 and the issue page of iai_kinect2 for similar issues and solutions.

Point clouds are not being published?

Point clouds are only published when the launch file is used. Make sure to start kinect2_bridge with roslaunch kinect2_bridge kinect2_bridge.launch.

Will it work with OpenCV 3.0

Short answer: No.

Long answer: Yes, it is possible to compile this package with OpenCV 3.0, but it will not work. This is because cv_bridge is used, which itself is compiled with OpenCV 2.4.x in ROS Indigo/Jade and linking against both OpenCV versions is not possible. Working support for OpenCV 3.0 might come with a future ROS release.

kinect2_bridge is not working / crashing, what is wrong?

There are many reasons why kinect2_bridge might not working. The first thing to find out whether the problem is related to kinect2_bridge or libfreenect2. A good tool for testing is Protonect, it is a binary located in libfreenect2/build/bin/Protonect. It uses libfreenect2 directly with a minimal dependency on other libraries, so it is a good tool for the first tests.

Execute:

  • ./Protonect gl to test OpenGL support.
  • ./Protonect cl to test OpenCL support.
  • ./Protonect cpu to test CPU support.

Before running kinect2_bridge please make sure Protonect is working and showing color, depth and ir images. If some of them are black, than there is a problem not related to kinect2_bridge and you should look at the issues from the libfreenect2 GitHub page for help.

If one of them works, try out the one that worked with kinect2_bridge: rosrun kinect2_bridge kinect2_bridge _depth_method:=<opengl|opencl|cpu>. You can also change the registration method with _reg_method:=<cpu|opencl>.

Protonect works fine, but kinect2_bridge is still not working / crashing.

If that is the case, you have to make sure that Protonect uses the same version of libfreenect2 as kinect2_bridge does. To do so, run make and sudo make install in the build folder again. And try out kinect2_bridge again.

cd libfreenect2/build
make & sudo make install

Also make sure that you are not using OpenCV 3.0.

If it is still crashing, compile it in debug and run it with gdb:

cd <catkin_ws>
catkin_make -DCMAKE_BUILD_TYPE="Debug"
cd devel/lib/kinect2_bridge
gdb kinect2_bridge
# inside gdb: run until it crashes and do a backtrace
run
bt
quit

Open an issue and post the problem description and the output from the backtrace (bt).

kinect2_bridge hangs and prints "waiting for clients to connect"

This is the normal behavior. 'kinect2_bridge' will only process data when clients are connected (ROS nodes listening to at least one of the topics). This saves CPU and GPU resources. As soon as you start the kinect_viewer or rostopic hz on one of the topics, processing should start.

rosdep: Cannot locate rosdep definition for [kinect2_bridge] or [kinect2_registration]

rosdep will output errors on not being able to locate [kinect2_bridge] and [kinect2_registration]. That is fine because they are all part of the iai_kinect2 package and rosdep does not know these packages.

Protonect or kinect2_bridge outputs [TransferPool::submit] failed to submit transfer

This indicates problems with the USB connection.

I still have an issue, what should I do?

First of all, check the issue pages on GitHub for similar issues, as they might contain solutions for them. By default you will only see the open issues, but if you click on closed you will the the ones solved. There is also a search field which helps to find similar issues.

If you found no solution in the issues, feel free to open a new issue for your problem. Please describe your problem in detail and provide error messages and log output.

Dependencies

  • ROS Hydro/Indigo
  • OpenCV (2.4.x, using the one from the official Ubuntu repositories is recommended)
  • PCL (1.7.x, using the one from the official Ubuntu repositories is recommended)
  • Eigen (optional, but recommended)
  • OpenCL (optional, but recommended)
  • libfreenect2 (>= v0.2.0, for stability checkout the latest stable release)

Install

  1. Install the ROS. Instructions for Ubuntu 14.04

  2. Setup your ROS environment

  3. Install libfreenect2:

    Follow the instructions and enable C++11 by using cmake .. -DENABLE_CXX11=ON instead of cmake ... If you are compiling libfreenect2 with CUDA, use cmake .. -DENABLE_CXX11=ON -DCUDA_PROPAGATE_HOST_FLAGS=off.

    If something is not working, check out the latest stable release, for example git checkout v0.2.0.

  4. Clone this repository into your catkin workspace, install the dependencies and build it:

    cd ~/catkin_ws/src/
    git clone https://github.com/code-iai/iai_kinect2.git
    cd iai_kinect2
    rosdep install -r --from-paths .
    cd ~/catkin_ws
    catkin_make -DCMAKE_BUILD_TYPE="Release"

    Note: rosdep will output errors on not being able to locate [kinect2_bridge] and [depth_registration]. That is fine because they are all part of the iai_kinect2 package and rosdep does not know these packages.

    Note: If you installed libfreenect2 somewhere else than in $HOME/freenect2 or a standard location like /usr/local you have to specify the path to it by adding -Dfreenect2_DIR=path_to_freenect2/lib/cmake/freenect2 to catkin_make.

  5. Connect your sensor and run kinect2_bridge:

    roslaunch kinect2_bridge kinect2_bridge.launch
  6. Calibrate your sensor using the kinect2_calibration. Further details

  7. Add the calibration files to the kinect2_bridge/data/<serialnumber> folder. Further details

  8. Restart kinect2_bridge and view the results using rosrun kinect2_viewer kinect2_viewer kinect2 sd cloud.

GPU acceleration

OpenCL with AMD

Install the latest version of the AMD Catalyst drivers from https://support.amd.com and follow the instructions. Also install opencl-headers.

sudo apt-get install opencl-headers

OpenCL/CUDA with Nvidia

Go to developer.nvidia.com/cuda-downloads and select linux, x86_64, Ubuntu, 14.04, deb(network). Download the file and follow the instructions. Also install nvidia-modprobe and opencl-headers.

sudo apt-get install nvidia-modprobe opencl-headers

You also need to add CUDA paths to the system environment, add these lines to you ~/.bashrc:

export LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"
export PATH="/usr/local/cuda/bin:${PATH}"

A system-wide configuration of the libary path can be created with the following commands:

echo "/usr/local/cuda/lib64" | sudo tee /etc/ld.so.conf.d/cuda.conf
sudo ldconfig

OpenCL with Intel

You can either install a binary package from a PPA like ppa:floe/beignet, or build beignet yourself. It's recommended to use the binary from the PPA.

sudo add-apt-repository ppa:floe/beignet && sudo apt-get update
sudo apt-get install beignet beignet-dev opencl-headers

Citation

If you used iai_kinect2 for your work, please cite it.

@misc{iai_kinect2,
  author = {Wiedemeyer, Thiemo},
  title = {{IAI Kinect2}},
  organization = {Institute for Artificial Intelligence},
  address = {University Bremen},
  year = {2014 -- 2015},
  howpublished = {\url{https://github.com/code-iai/iai\_kinect2}},
  note = {Accessed June 12, 2015}
}

The result should look something similar to this (may depend on the bibliography style used):

T. Wiedemeyer, “IAI Kinect2,” https://github.com/code-iai/iai_kinect2,
Institute for Artificial Intelligence, University Bremen, 2014 – 2015,
accessed June 12, 2015.

Screenshots

Here are some screenshots from our toolkit: color image depth image point cloud image viewer

iai_kinect2's People

Contributors

ahundt avatar airballking avatar amaldo avatar andre-nguyen avatar awhampton avatar bbferka avatar christian-rauch avatar de-vri-es avatar eisoku9618 avatar fjonath1 avatar furushchev avatar jordimm avatar jworch avatar klaren avatar mintar avatar niosus avatar peterkty avatar samarth-robo avatar svtter avatar tobias-fischer avatar wkentaro avatar xlz avatar yoneken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iai_kinect2's Issues

libopencv-dev rosdep definitions missing for Ubuntu 12.04 / Hydro?

I am working on getting this built on a setup with Ubuntu 12.04 with ROS Hydro and get the following error when running rosdep install -r --from-paths .

hemes@jake:~/ros_ws/src/iai_kinect2$ rosdep install -r --from-paths .
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
registration_viewer: No definition of [libopencv-dev] for OS version [precise]
kinect2_calibration: No definition of [libopencv-dev] for OS version [precise]
kinect2_bridge: No definition of [libopencv-dev] for OS version [precise]
depth_registration: No definition of [libopencv-dev] for OS version [precise]
Continuing to install resolvable dependencies...
#All required rosdeps installed successfully

After investigating a bit it seems that there were changes with where OpenCV lives from Hydro to Indigo and libopencv-dev is the rosdep key for Indigo. Per the Indigo migration document (http://wiki.ros.org/indigo/Migration#OpenCV) I believe these dependencies should be replaced with cv_bridge.

After making the above change on my build, the error went away.

Installation Problem after cloning

Hi!

I have installed all the dependencies required, but after I cloned the repository to my catkin workspace, errors appears when I am using catkin_make, any idea to solve it? Thank you >.<

"/home/m2/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:96:3: error: ‘FrameMap’ in namespace ‘libfreenect2’ does not name a type
libfreenect2::FrameMap frames;
^
/home/m2/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp: In member function ‘bool Kinect2Bridge::init(const string&, const string&)’:
/home/m2/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:197:16: error: ‘create’ is not a member of ‘libfreenect2::FrameListener’
listener = libfreenect2::FrameListener::create(libfreenect2::Frame::Color | libfreenect2::Frame::Ir | libfreenect2::Frame::Depth);
^
/home/m2/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp: In member function ‘void Kinect2Bridge::run()’:
/home/m2/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:379:17: error: ‘class libfreenect2::FrameListener’ has no member named ‘waitForNewFrame’
listener->waitForNewFrame(frames);
^
/home/m2/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:379:33: error: ‘frames’ was not declared in this scope
listener->waitForNewFrame(frames);
^
/home/m2/catkin_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:392:17: error: ‘class libfreenect2::FrameListener’ has no member named ‘release’
listener->release(frames);
^
make[2]: *** [iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge.dir/src/kinect2_bridge.cpp.o] Error 1
make[1]: *** [iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed"

Trouble building with Ubuntu 12.04 and ROS Hydro (cxx11 support and boost issues)

I am not sure if this is actually an issue or just a result of my Linux ineptitude so please be gentle :)
Here is the progress I have made...

After some minor hiccups I was able to get a build going that made it all the way to kinect2_bridge before failing. The error I got was

[100%] Building CXX object iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge.dir/src/kinect2_bridge.cpp.o
/home/hemes/ros_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp: In member function ‘void Kinect2Bridge::run()’:
/home/hemes/ros_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:372:62: error: no matching function for call to ‘libfreenect2::SyncMultiFrameListener::waitForNewFrame(libfreenect2::FrameMap&, int)’
/home/hemes/ros_ws/src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:372:62: note: candidate is:
/usr/local/include/libfreenect2/frame_listener_impl.h:54:8: note: void libfreenect2::SyncMultiFrameListener::waitForNewFrame(libfreenect2::FrameMap&)
/usr/local/include/libfreenect2/frame_listener_impl.h:54:8: note:   candidate expects 1 argument, 2 provided
make[2]: *** [iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge.dir/src/kinect2_bridge.cpp.o] Error 1
make[1]: *** [iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed

After digging some I realized that libfreenect2 was compiling without cxx11 support and thus the member function causing the error was never defined. See libfreenect2/frame_listener_impl.h:50

...
    #ifdef LIBFREENECT2_THREADING_STDLIB
      bool waitForNewFrame(FrameMap &frame, int milliseconds);
...

Turns out that the gcc that ships with 12.04 (Version 4.6) does not have cxx11 support so I tried upgrading to 4.8. This solved my cxx11 support issue and I was able to build libfreenect2 again and got rid of the above error.

However, my shiny new version of gcc now causes some issues with the version of boost in 12.04 (Version 1.48.0.2). I now get a plethora of errors regarding use of deleted functions. Some representative output is as follows:

[ 80%] Built target depth_registration
[100%] Building CXX object iai_kinect2/kinect2_bridge/CMakeFiles/kinect2_bridge.dir/src/kinect2_bridge.cpp.o
In file included from /home/hemes/ros_ws/src/iai_kinect2/kinect2_calibration/src/kinect2_calibration.cpp:37:0:
/opt/ros/hydro/include/cv_bridge/cv_bridge.h: In constructor ‘cv_bridge::CvImage::CvImage(const Header&, const string&, const cv::Mat&)’:
/opt/ros/hydro/include/cv_bridge/cv_bridge.h:77:54: error: use of deleted function ‘std_msgs::Header_<std::allocator<void> >::Header_(const std_msgs::Header_<std::allocator<void> >&)’
     : header(header), encoding(encoding), image(image)
                                                      ^
In file included from /opt/ros/hydro/include/sensor_msgs/CameraInfo.h:51:0,
                 from /home/hemes/ros_ws/src/iai_kinect2/kinect2_calibration/src/kinect2_calibration.cpp:34:
/opt/ros/hydro/include/std_msgs/Header.h:55:8: note: ‘std_msgs::Header_<std::allocator<void> >::Header_(const std_msgs::Header_<std::allocator<void> >&)’ is implicitly deleted because the default definition would be ill-formed:
 struct Header_
        ^
/opt/ros/hydro/include/std_msgs/Header.h:55:8: error: use of deleted function ‘boost::shared_ptr<std::map<std::basic_string<char>, std::basic_string<char> > >::shared_ptr(const boost::shared_ptr<std::map<std::basic_string<char>, std::basic_string<char> > >&)’
...

I saw references that this issue was addressed in revision 1.48.0.3. If I try to update boost, however, apt-get wants to remove all of ROS Hydro... is there any hope besides building ROS from source with newer versions of gcc/boost?

I am in this predicament because ROS-Industrial is still in Hydro. I believe they have an Indigo release scheduled for some time before April of this year but I would like to get this going before that.

OS X C++11 support detection fails

ERRORThe compiler /usr/bin/c++ has no C++11 support. Please use a different C++ compiler.

In my case /usr/bin/c++ is:

Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

Later in the compilation run I get a ton of issues but i guess those are not the underlying issue.

15 Hz Limit

I am on a K7 5820K with a GTX980
However i seem to get a rather slow update of 15 Hz

Output from kinect2_bridge seems to be fine

[OpenCLDepthPacketProcessor] avg. time: 2.58556ms -> ~386.764Hz
[OpenCLDepthPacketProcessor] avg. time: 2.60462ms -> ~383.933Hz
[TurboJpegRgbPacketProcessor] avg. time: 22.4375ms -> ~44.5682Hz
[OpenCLDepthPacketProcessor] avg. time: 2.59951ms -> ~384.688Hz
[OpenCLDepthPacketProcessor] avg. time: 2.61145ms -> ~382.929Hz
[TurboJpegRgbPacketProcessor] avg. time: 22.5549ms -> ~44.3363Hz
[OpenCLDepthPacketProcessor] avg. time: 2.61456ms -> ~382.473Hz

But when subscribing to topics i get.

➜  workspace git:(master) ✗ rostopic hz /kinect2_head/depth/image     
subscribed to [/kinect2_head/depth/image]
average rate: 15.000
        min: 0.057s max: 0.076s std dev: 0.00460s window: 75
average rate: 15.012
        min: 0.056s max: 0.076s std dev: 0.00473s window: 90
average rate: 14.993
        min: 0.056s max: 0.076s std dev: 0.00459s window: 105
average rate: 15.002
        min: 0.056s max: 0.076s std dev: 0.00460s window: 120
average rate: 15.005
        min: 0.056s max: 0.076s std dev: 0.00469s window: 135
Caverage rate: 14.999
        min: 0.056s max: 0.076s std dev: 0.00477s window: 147

Any ideas ?

Ubuntu + K4W2

I have installed libfreenect and everything needed, but protonect will not run. I only have USB 2.0 on this computer right now, I don't know if thats an issue though.
This is the error I get:

ubuntu@ubuntu:~/libfreenect2/examples/protonect$ sudo ./bin/Protonect
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 8 usb devices connected
[Freenect2Impl] found valid Kinect v2 @2:6 with serial 500386642042
[Freenect2Impl] found 1 devices
[Freenect2DeviceImpl] opening...
[UsbControl::claimInterfaces(IrInterfaceId)] failed! libusb error -6: LIBUSB_ERROR_BUSY
[Freenect2DeviceImpl] closing...
[Freenect2DeviceImpl] deallocating usb transfer pools...
[Freenect2DeviceImpl] closing usb device...
[Freenect2DeviceImpl] closed
[Freenect2DeviceImpl] failed to open Kinect v2 @2:6!
no device connected or failure opening the default one!

A large black screen appears for one second then closes. Any help would be appreciated, thanks!

ROS dependency issues

to compile iai_kinect2 with catkin I had to install ros-indigo-image-transport-plugins and pcl by hand. I thought they should be installed by rosdep install iai_kinect2. Am I wrong or are there some dependency entries in the package.xml missing? I'm not yet used to the new ROS dependency management / build system.

clGetPlatformIDs(-1001) error after a driver update

I re-installed the Nvidia drivers in my laptop and then kinect2_bridge started not working anymore.
I tried to re-install everything from stratch but nothing.
The fact that astonish me is that the example program provided by freenect2 (freeenect2/examples/protonec/bin/Protonec) is perfectly working.
Any suggestion?

ERROR: clCreateContextFromType(-1) error when launching kinect2_bridge

Hello,

When I run the command
roslaunch kinect2_bridge kinect2_bridge.launch

I get:

[kinect2_bridge-1] restarting process
process[kinect2_bridge-1]: started with pid [2953]
Using OpenCL registration method!
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 13 usb devices connected
[Freenect2Impl] found valid Kinect v2 @4:1 with serial 500431141942
[Freenect2Impl] found 1 devices
[Freenect2DeviceImpl] opening...
[Freenect2DeviceImpl] opened

starting kinect2

[Freenect2DeviceImpl] starting...
[Freenect2DeviceImpl] ReadData0x14 response
92 bytes of raw data
0x0000: 00 00 12 00 00 00 00 00 01 00 00 00 43 c1 1f 41 ............C..A
0x0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0020: 0a 21 33 55 c2 00 17 20 00 08 00 00 10 00 00 00 .!3U... ........
0x0030: 00 01 00 00 00 10 00 00 00 00 80 00 01 00 00 00 ................
0x0040: 31 33 00 00 00 0a 08 06 47 4d 58 36 31 30 2e 31 13......GMX610.1
0x0050: 58 00 00 00 00 00 00 00 00 00 00 00 X...........

ERROR: clCreateContextFromType(-1)
terminate called after throwing an instance of 'cl::Error'
what(): clCreateContextFromType
[kinect2_bridge-1] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done

My laptop has both a nvidia graphics card with Optimus technology and an intel 4th generation graphics card. I suspect that the optimus technology might be the problem, since it uses the intel integrated graphics controller by default and the does not automatically switch to the nvidia graphics controller on Ubuntu. I tried installing and configuring the bumblebee package which allows programs to be manually run with the nvidia graphics card. When I run optirun (which is the command that manually uses the nvidia graphics card):

optirun rosrun kinect2_bridge kinect2_bridge

I get:

< Using OpenCL registration method! [Freenect2Impl] enumerating devices...
[Freenect2Impl] 13 usb devices connected
/home/samme/hydro_ws/devel/lib/kinect2_bridge/kinect2_bridge: symbol lookup error: /usr/local``/lib/libfreenect2.so: undefined symbol: libusb_get_port_number >

I tried runnung the Protonect directly from the libfreenect2/examples/protonect/bin folder:

<samme@samme-Dell-Precision-M3800:~/libfreenect2/examples/protonect/bin$ ./Protonect
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 13 usb devices connected
[Freenect2Impl] found valid Kinect v2 @4:1 with serial 500431141942
[Freenect2Impl] found 1 devices
[Freenect2DeviceImpl] opening...
[Freenect2DeviceImpl] opened
[Freenect2DeviceImpl] starting...
[Freenect2DeviceImpl] ReadData0x14 response
92 bytes of raw data
0x0000: 00 00 12 00 00 00 00 00 01 00 00 00 43 c1 1f 41 ............C..A
0x0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0020: 0a 21 33 55 c2 00 17 20 00 08 00 00 10 00 00 00 .!3U... ........
0x0030: 00 01 00 00 00 10 00 00 00 00 80 00 01 00 00 00 ................
0x0040: 31 33 00 00 00 0a 08 06 47 4d 58 36 31 30 2e 31 13......GMX610.1
0x0050: 58 00 00 00 00 00 00 00 00 00 00 00 X...........

ERROR: clCreateContextFromType(-1)
terminate called after throwing an instance of 'cl::Error'
what(): clCreateContextFromType
Aborted (core dumped) >

When I run it with the <optirun> command I get:

<samme@samme-Dell-Precision-M3800:~/libfreenect2/examples/protonect/bin$ optirun ./Protonect
Xlib: extension "GLX" missing on display ":8".>

Thanks alot of your help, any thoughts?

Regards,
Khalid

Accesing the accelerometer on the kinect

Hello,
I was wondering, whether the accelerometer data on the kinect is accesible. Also when I viewed the pointcloud data in RVIZ, I can see that the kinect can sense the pitch and yaw correspondingly. Any comments on this?.

Can't build wiedemeyer fork of libfreenect2

Using the linked fork from the readme or making the modifications manually I get a bunch of undefined referenced to udev when building Protonect.cpp. The errors seem to originate from "Change line 102 from 'usb-1.0' to 'usb-1.0.a'". If I leave this as usb-1.0 it builds and runs. However, when changed to usb-1.0.a I get the output below. Thanks, Brett.

...
Scanning dependencies of target Protonect
[ 97%] Building CXX object CMakeFiles/Protonect.dir/Protonect.cpp.o
Linking CXX executable bin/Protonect
lib/libfreenect2.so: undefined reference to udev_monitor_unref' lib/libfreenect2.so: undefined reference toudev_enumerate_scan_devices'
lib/libfreenect2.so: undefined reference to udev_new' ... lib/libfreenect2.so: undefined reference toudev_enumerate_add_match_subsystem'
collect2: ld returned 1 exit status
make[2]: *** [bin/Protonect] Error 1
make[1]: *** [CMakeFiles/Protonect.dir/all] Error 2
make: *** [all] Error 2

Noise in data from kinect2_bridge Devel Branch

I am having a strange issue with noise in the data from bridge. It is only noticeable when I do a integration scan with kinect fusion. It only happens in the development branch. I have been looking over the code in kinect2_bridge.cpp but I have not been able to figure out what introduces the noise. I also tried to add a depth topic with float resolution to kinect2_bridge, but still same problem.

I get depth data from

std::string topicDepth = K2_TOPIC_IMAGE_DEPTH K2_TOPIC_RAW;

Below is example images from the my scanner application, only difference is the version of iai_kinect2.

Any ideas on what might introduce this noise?.

Master Branch

Devel Branch

Reducing CPU load in Ubuntu 12.04 with ROS hydro

Hi,

I've built this in Ubuntu 12.04 for ROS hydro. I've got an intel core i7-4790 and an nvidia GeForce GTX 745. When I run kinect2_bridge it only seems to be detecting the cpu.

[DepthRegistration::New] Using OpenCL registration method!
[DepthRegistration::New] Using OpenCL registration method!
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 16 usb devices connected
[Freenect2Impl] found valid Kinect v2 @4:8 with serial 500902543042
[Freenect2Impl] found valid Kinect v2 @4:10 with serial 503614242542
[Freenect2Impl] found 2 devices
Kinect2 devices found: 
  0: 500902543042 (selected)
  1: 503614242542
[Freenect2DeviceImpl] opening...
[Freenect2DeviceImpl] opened

starting kinect2

[Freenect2DeviceImpl] starting...
[Freenect2DeviceImpl] ReadData0x14 response
92 bytes of raw data
0x0000:  00 00 12 00 00 00 00 00 01 00 00 00 43 c1 1f 41    ............C..A
0x0010:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
0x0020:  0a 21 33 55 20 00 17 ba 00 08 00 00 10 00 00 00    .!3U ...........
0x0030:  00 01 00 00 00 10 00 00 00 00 80 00 01 00 00 00    ................
0x0040:  31 33 00 00 00 06 10 08 47 4d 42 30 31 34 2e 31    13......GMB014.1
0x0050:  58 00 00 00 00 00 00 00 00 00 00 00                X...........

[OpenCLDepthPacketProcessor::listDevice]  devices:
  0: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (CPU)[Intel(R) Corporation]
[OpenCLDepthPacketProcessor::init]  selected device: Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz 
(CPU)[Intel(R) Corporation]

Here's what I'm getting as my cpu usage.

image

My goal is to get 3 Kinect2 sensors running simultaneously on an intel core i5. Is there a way to reduce CPU load while staying with Ubuntu 12.04 and ROS hydro?

Andrew

Install on Ubuntu 14.04

I am having problems installing the dependencies - I'm taking notes to improve the documentation but please help me figure it out...

First install basic dependencies:

sudo apt-get install libusb-dev libturbojpeg opencl-headers 

Then install

git clone https://github.com/wiedemeyer/libfreenect2.git
cd libfreenect2/depends
sh install_ubuntu.sh

# might be required:
sudo ln -s /usr/lib/x86_64-linux-gnu/libturbojpeg.so.0.0.0 /usr/lib/x86_64-linux-gnu/libturbojpeg.so

# continue:
cd ../examples/protonect/
cmake CMakeLists.txt
make && sudo make install

But then I get the error

Linking C shared library /home/dave/ros/ws_base/src/libfreenect2/examples/protonect/lib/libglfw.so
[ 46%] Built target glfw
Linking CXX executable bin/generate_resources_tool
[ 48%] Built target generate_resources_tool
[ 51%] Generating src/resources.inc
Scanning dependencies of target freenect2
[ 53%] Building CXX object CMakeFiles/freenect2.dir/src/transfer_pool.cpp.o
In file included from /home/dave/ros/ws_base/src/libfreenect2/examples/protonect/src/transfer_pool.cpp:27:0:
/home/dave/ros/ws_base/src/libfreenect2/examples/protonect/include/libfreenect2/usb/transfer_pool.h:30:20: fatal error: libusb.h: No such file or directory
 #include <libusb.h>
                    ^
compilation terminated.

It appears it is looking for a directoy that does not exist in the CMakeLists.txt:

INCLUDE_DIRECTORIES("${DEPENDS_DIR}/libusb/include/libusb-1.0/")

Because libusb has been renamed to libusb_src in the repo. Also, there does not appear to be any include subfolder in that libusb_src folder.

I have double checked that I have the following Ubuntu packages installed:

  • libusb-0.1-4
  • libusb-1.0.0
  • libusb-1.0.0-dev
  • libusb-1.0-doc
  • libusb-dev
  • libusbmuxd2

Any help is appreciated!

kinect2_bridge: bulk transfer failed

Hi,
I am running Kinect2_bridge on ROS hydro on ubuntu 12.04.
I have the Renesas µPD720202 USB host controller.

I get the following error:

[DepthRegistration::New] Using OpenCL registration method!
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 16 usb devices connected
[Freenect2Impl] found valid Kinect v2 @4:1 with serial 089096334447
[Freenect2Impl] found 1 devices
[Freenect2DeviceImpl] opening...
[Freenect2DeviceImpl] opened

starting kinect2

[Freenect2DeviceImpl] starting...
[Freenect2DeviceImpl] ReadData0x14 response
92 bytes of raw data
0x0000: 00 00 12 00 00 00 00 00 01 00 00 00 43 c1 1f 41 ............C..A
0x0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0020: 0a 21 33 55 c2 00 17 20 00 08 00 00 10 00 00 00 .!3U... ........
0x0030: 00 01 00 00 00 10 00 00 00 00 80 00 01 00 00 00 ................
0x0040: 31 33 00 00 00 09 08 05 47 4b 41 39 32 37 2e 31 13......GKA927.1
0x0050: 58 00 00 00 00 00 00 00 00 00 00 00 X...........

[CommandTransaction::receive] bulk transfer failed! libusb error -7: LIBUSB_ERROR_TIMEOUT
[CommandTransaction::execute] missing response complete!
*** glibc detected *** /home/shray/dev/hydro_ws/devel/lib/kinect2_bridge/kinect2_bridge: double free or corruption (top): 0x00000000025d45d0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7e846)[0x7ff82c21e846]
/usr/lib/nvidia-304/tls/libnvidia-tls.so.304.116(+0x1cd1)[0x7ff820b09cd1]
======= Memory map: ========
00400000-0041e000 r-xp 00000000 08:15 55445351 /home/shray/dev/hydro_ws/devel/lib/kinect2_bridge/kinect2_bridge
0061d000-0061e000 r--p 0001d000 08:15 55445351 /home/shray/dev/hydro_ws/devel/lib/kinect2_bridge/kinect2_bridge
0061e000-0061f000 rw-p 0001e000 08:15 55445351 /home/shray/dev/hydro_ws/devel/lib/kinect2_bridge/kinect2_bridge
020b6000-027b5000 rw-p 00000000 00:00 0 [heap]
7ff7fe5ad000-7ff800000000 rw-p 00000000 00:00 0
7ff800000000-7ff800021000 rw-p 00000000 00:00 0
7ff800021000-7ff804000000 ---p 00000000 00:00 0
7ff804000000-7ff804021000 rw-p 00000000 00:00 0
7ff804021000-7ff808000000 ---p 00000000 00:00 0
7ff808000000-7ff808021000 rw-p 00000000 00:00 0
7ff808021000-7ff80c000000 ---p 00000000 00:00 0
7ff80c000000-7ff80c021000 rw-p 00000000 00:00 0
7ff80c021000-7ff810000000 ---p 00000000 00:00 0
7ff810134000-7ff810135000 ---p 00000000 00:00 0
7ff810135000-7ff811513000 rw-p 00000000 00:00 0 [stack:21407]
7ff811513000-7ff811514000 ---p 00000000 00:00 0
7ff811514000-7ff8127fd000 rw-p 00000000 00:00 0 [stack:21406]
7ff8127fd000-7ff8127fe000 ---p 00000000 00:00 0
7ff8127fe000-7ff812ffe000 rw-p 00000000 00:00 0 [stack:21405]
7ff812ffe000-7ff812fff000 ---p 00000000 00:00 0
7ff812fff000-7ff8137ff000 rw-p 00000000 00:00 0 [stack:21404]
7ff8137ff000-7ff813800000 ---p 00000000 00:00 0
7ff813800000-7ff814000000 rw-p 00000000 00:00 0 [stack:21403]
7ff814000000-7ff814021000 rw-p 00000000 00:00 0
7ff814021000-7ff818000000 ---p 00000000 00:00 0
7ff81803a000-7ff818629000 rw-p 00000000 00:00 0
7ff818629000-7ff81862a000 ---p 00000000 00:00 0
7ff81862a000-7ff818e2a000 rw-p 00000000 00:00 0 [stack:21402]
7ff818e2a000-7ff818e2b000 ---p 00000000 00:00 0
7ff818e2b000-7ff81962b000 rw-p 00000000 00:00 0 [stack:21401]
7ff81962b000-7ff81962c000 ---p 00000000 00:00 0
7ff81962c000-7ff819e2c000 rw-p 00000000 00:00 0
7ff819e2c000-7ff81a50f000 r--p 00000000 08:07 2365837 /usr/lib/locale/locale-archive
7ff81a51a000-7ff81b689000 r-xp 00000000 08:07 2369669 /usr/lib/libicudata.so.48.1.1
7ff81b689000-7ff81b888000 ---p 0116f000 08:07 2369669 /usr/lib/libicudata.so.48.1.1
7ff81b888000-7ff81b889000 r--p 0116e000 08:07 2369669 /usr/lib/libicudata.so.48.1.1
7ff81b889000-7ff81b88a000 rw-p 0116f000 08:07 2369669 /usr/lib/libicudata.so.48.1.1
7ff81b88a000-7ff81b88e000 r-xp 00000000 08:07 2887949 /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7ff81b88e000-7ff81ba8d000 ---p 00004000 08:07 2887949 /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7ff81ba8d000-7ff81ba8e000 r--p 00003000 08:07 2887949 /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7ff81ba8e000-7ff81ba8f000 rw-p 00004000 08:07 2887949 /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7ff81ba8f000-7ff81ba98000 r-xp 00000000 08:07 2887787 /lib/x86_64-linux-gnu/libcrypt-2.15.so
7ff81ba98000-7ff81bc98000 ---p 00009000 08:07 2887787 /lib/x86_64-linux-gnu/libcrypt-2.15.so
7ff81bc98000-7ff81bc99000 r--p 00009000 08:07 2887787 /lib/x86_64-linux-gnu/libcrypt-2.15.so
7ff81bc99000-7ff81bc9a000 rw-p 0000a000 08:07 2887787 /lib/x86_64-linux-gnu/libcrypt-2.15.so
7ff81bc9a000-7ff81bcc8000 rw-p 00000000 00:00 0
7ff81bcc8000-7ff81bccd000 r-xp 00000000 08:07 2366522 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7ff81bccd000-7ff81becc000 ---p 00005000 08:07 2366522 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7ff81becc000-7ff81becd000 r--p 00004000 08:07 2366522 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7ff81becd000-7ff81bece000 rw-p 00005000 08:07 2366522 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7ff81bece000-7ff81bed0000 r-xp 00000000 08:07 2366511 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7ff81bed0000-7ff81c0cf000 ---p 00002000 08:07 2366511 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7ff81c0cf000-7ff81c0d0000 r--p 00001000 08:07 2366511 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7ff81c0d0000-7ff81c0d1000 rw-p 00002000 08:07 2366511 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7ff81c0d1000-7ff81c28c000 r-xp 00000000 08:07 2369673 /usr/lib/libicui18n.so.48.1.1
7ff81c28c000-7ff81c48b000 ---p 001bb000 08:07 2369673 /usr/lib/libicui18n.so.48.1.1
7ff81c48b000-7ff81c497000 r--p 001ba000 08:07 2369673 /usr/lib/libicui18n.so.48.1.1
7ff81c497000-7ff81c499000 rw-p 001c6000 08:07 2369673 /usr/lib/libicui18n.so.48.1.1
7ff81c499000-7ff81c5ee000 r-xp 00000000 08:07 2369675 /usr/lib/libicuuc.so.48.1.1
7ff81c5ee000-7ff81c7ee000 ---p 00155000 08:07 2369675 /usr/lib/libicuuc.so.48.1.1
7ff81c7ee000-7ff81c7fe000 r--p 00155000 08:07 2369675 /usr/lib/libicuuc.so.48.1.1
7ff81c7fe000-7ff81c7ff000 rw-p 00165000 08:07 2369675 /usr/lib/libicuuc.so.48.1.1
7ff81c7ff000-7ff81c803000 rw-p 00000000 00:00 0
7ff81c803000-7ff81c83b000 r-xp 00000000 08:07 2363954 /usr/lib/libapr-1.so.0.4.6
7ff81c83b000-7ff81ca3a000 ---p 00038000 08:07 2363954 /usr/lib/libapr-1.so.0.4.6
7ff81ca3a000-7ff81ca3b000 r--p 00037000 08:07 2363954 /usr/lib/libapr-1.so.0.4.6
7ff81ca3b000-7ff81ca3c000 rw-p 00038000 08:07 2363954 /usr/lib/libapr-1.so.0.4.6
7ff81ca3c000-7ff81ca5d000 r-xp 00000000 08:07 2363956 /usr/lib/libaprutil-1.so.0.3.12
7ff81ca5d000-7ff81cc5d000 ---p 00021000 08:07 2363956 /usr/lib/libaprutil-1.so.0.3.12
7ff81cc5d000-7ff81cc5e000 r--p 00021000 08:07 2363956 /usr/lib/libaprutil-1.so.0.3.12
7ff81cc5e000-7ff81cc5f000 rw-p 00022000 08:07 2363956 /usr/lib/libaprutil-1.so.0.3.12Aborted (core dumped)

Any ideas on what might be causing this issue?

SegFault when using OpenCL on Intel integrared GPU

I was able to compile libfreenect2 and iai_bridge to use CPU depth registration. However, I am only getting <5FPS and CPU load is high. Hence, I would like to make use of the OpenCL 1.2 capabilities of the intergarted Intel GPU. The output is:

rosrun kinect2_bridge kinect2_bridge 
[DepthRegistration::New] Using OpenCL registration method!
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 14 usb devices connected
[Freenect2Impl] found valid Kinect v2 @4:1 with serial 500637743142
[Freenect2Impl] found 1 devices
[Freenect2DeviceImpl] opening...
[Freenect2DeviceImpl] opened

starting kinect2

[Freenect2DeviceImpl] starting...
[Freenect2DeviceImpl] ReadData0x14 response
92 bytes of raw data
0x0000:  00 00 12 00 00 00 00 00 01 00 00 00 43 c1 1f 41    ............C..A
0x0010:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
0x0020:  0a 21 33 55 c2 00 17 20 00 08 00 00 10 00 00 00    .!3U... ........
0x0030:  00 01 00 00 00 10 00 00 00 00 80 00 01 00 00 00    ................
0x0040:  31 33 00 00 00 05 14 01 47 4b 53 39 31 36 2e 31    13......GKS916.1
0x0050:  58 00 00 00 00 00 00 00 00 00 00 00                X...........

[OpenCLDepthPacketProcessor::selectDevice] found platform: Intel(R) OpenCL vendor: Intel(R) Corporation
***** devices.size() = 1
[OpenCLDepthPacketProcessor::selectDevice] found device:       Intel(R) Core(TM) i7-3840QM CPU @ 2.80GHz vendor: Intel(R) Corporation
[Freenect2DeviceImpl] ReadStatus0x090000 response
4 bytes of raw data
0x0000:  7f 26 00 00                                        &..

[Freenect2DeviceImpl] ReadStatus0x090000 response
4 bytes of raw data
0x0000:  7f 26 00 00                                        &..

[Freenect2DeviceImpl] enabling usb transfer submission...
[Freenect2DeviceImpl] submitting usb transfers...
[Freenect2DeviceImpl] started

device serial: 500637743142
device firmware: 2.3.3912.0.7

default ir camera parameters: 
fx 365.812, fy 365.812, cx 261.678, cy 201.378
k1 0.0910358, k2 -0.271328, p1 0, p2 0, k3 0.0980072

default color camera parameters: 
fx 1081.37, fy 1081.37, cx 959.5, cy 539.5

could not load calibration data from "/home/ros/overlay_ws/src/iai_kinect2/kinect2_bridge/data/500637743142". using sensor defaults.

camera parameters used:
camera matrix color:
[1081.3720703125, 0, 959.5;
  0, 1081.3720703125, 539.5;
  0, 0, 1]
distortion coefficients color:
[0, 0, 0, 0, 0]
camera matrix ir:
[365.8121948242188, 0, 261.6781005859375;
  0, 365.8121948242188, 201.3784027099609;
  0, 0, 1]
distortion coefficients ir:
[0.09103578329086304, -0.2713280022144318, 0, 0, 0.0980072021484375]
rotation:
[1, 0, 0;
  0, 1, 0;
  0, 0, 1]
translation:
[0;
  0;
  0]

[DepthPacketStreamParser::handleNewData] not all subsequences received 0
Segmentation fault

Using gdb, I can pinpoint the issue to this line:

kinec2_bridge.cpp
Line 280:
cv::ocl::setDevice(devices[0]);

My setup
Ubuntu 13.04
ROS Hydro
Intel mobile Core i7 with integraded GPU / OpenCL 1.2

GPU driver: intel-linux-graphics-installer_1.0.2-0intel3_amd64
OpenCL driver: intel_sdk_for_ocl_applications_2014_ubuntu_4.6.0.92_x64

I followed the GitHub Gist Install Intel-CPU OpenCL on Ubuntu and get this output: when running the test program:

clDeviceQuery Starting...

1 OpenCL Platforms found

 CL_PLATFORM_NAME:      Intel(R) OpenCL
 CL_PLATFORM_VERSION:   OpenCL 1.2 LINUX
OpenCL Device Info:

 1 devices found supporting OpenCL on: Intel(R) OpenCL

 ----------------------------------
 Device       Intel(R) Core(TM) i7-3840QM CPU @ 2.80GHz
 ---------------------------------
  CL_DEVICE_NAME:                             Intel(R) Core(TM) i7-3840QM CPU @ 2.80GHz
  CL_DEVICE_VENDOR:                     Intel(R) Corporation
  CL_DRIVER_VERSION:                    1.2.0.92
  CL_DEVICE_TYPE:                       CL_DEVICE_TYPE_CPU
  CL_DEVICE_MAX_COMPUTE_UNITS:          8
  CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS:   3
  CL_DEVICE_MAX_WORK_ITEM_SIZES:        8192 / 8192 / 8192 
  CL_DEVICE_MAX_WORK_GROUP_SIZE:        8192
  CL_DEVICE_MAX_CLOCK_FREQUENCY:        2800 MHz
  CL_DEVICE_ADDRESS_BITS:               64
  CL_DEVICE_MAX_MEM_ALLOC_SIZE:         1950 MByte
  CL_DEVICE_GLOBAL_MEM_SIZE:            7801 MByte
  CL_DEVICE_ERROR_CORRECTION_SUPPORT:   no
  CL_DEVICE_LOCAL_MEM_TYPE:             global
  CL_DEVICE_LOCAL_MEM_SIZE:             32 KByte
  CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE:   128 KByte
  CL_DEVICE_QUEUE_PROPERTIES:           CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
  CL_DEVICE_QUEUE_PROPERTIES:           CL_QUEUE_PROFILING_ENABLE
  CL_DEVICE_IMAGE_SUPPORT:              1
  CL_DEVICE_MAX_READ_IMAGE_ARGS:        480
  CL_DEVICE_MAX_WRITE_IMAGE_ARGS:       480

  CL_DEVICE_IMAGE <dim>                 2D_MAX_WIDTH     16384
                                        2D_MAX_HEIGHT    16384
                                        3D_MAX_WIDTH     2048
                                        3D_MAX_HEIGHT    2048
                                        3D_MAX_DEPTH     2048
  CL_DEVICE_PREFERRED_VECTOR_WIDTH_<t>  CHAR 1, SHORT 1, INT 1, FLOAT 1, DOUBLE 1


clDeviceQuery, Platform Name = Intel(R) OpenCL, Platform Version = OpenCL 1.2 LINUX, NumDevs = 1, Device =       Intel(R) Core(TM) i7-384

System Info: 

 Local Time/Date =  11:32:40, 10/27/2014
 CPU Name: Intel(R) Core(TM) i7-3840QM CPU @ 2.80GHz 
 # of CPU processors: 8
 Linux version 3.16.0-031600-generic (apw@gomeisa) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #201408031935 SMP Sun Aug 3 23:36:


TEST PASSED

I also read the discussion of issue #7, but this this is a different issue.

Thanks, any help is appreciated!

Creating a pcl grabber without Ros

Hello,
I am working on simple wrapper to use libfreenect2 to get a pcl point cloud without ros.
I used part of your code for registration and I did the following


  typename pcl::PointCloud<PointT>::Ptr
  GetCloud(){

    frames_ =  *GetRawFrames();
    rgb_ = frames_[libfreenect2::Frame::Color];
    depth_ = frames_[libfreenect2::Frame::Depth];
    tmp_depth_ = cv::Mat(depth_->height, depth_->width, CV_32FC1, depth_->data);
    tmp_rgb_ = cv::Mat(rgb_->height, rgb_->width, CV_8UC3, rgb_->data);

    typename pcl::PointCloud<PointT>::Ptr cloud(new pcl::PointCloud<PointT>());
    cloud->height = tmp_rgb_.rows;
    cloud->width = tmp_rgb_.cols;
    cloud->is_dense = false;
    cloud->points.resize(cloud->height * cloud->width);

    if(depthReg_ == 0){
      cameraMatrixColor_ = (cv::Mat_<double>(3,3) <<  
        1.0660120360637927e+03,  0,                      9.4558752751085558e+02,
        0,                       1.0688708399911650e+03, 5.2006994012356529e+02,
        0,                       0,                      1                      );
      cameraMatrixDepth_ = (cv::Mat_<double>(3,3) <<
        3.6638346288148574e+02,  0,                      2.5564531890330468e+02,
        0,                       3.6714380707081017e+02, 2.0398020160452000e+02,
        0,                       0,                      1                      );

      createLookup(tmp_rgb_.cols, tmp_rgb_.rows);

      depthReg_ = new DepthRegistrationCPU(cv::Size(tmp_rgb_.cols, tmp_rgb_.rows),
                    cv::Size(tmp_depth_.cols, tmp_depth_.rows),
                    cv::Size(tmp_depth_.cols, tmp_depth_.rows),
                    0.5f, 20.0f);
      depthReg_->init(cameraMatrixColor_, cameraMatrixDepth_, 
                    cv::Mat::eye(3, 3, CV_64F), cv::Mat::zeros(1, 3, CV_64F),
                    cv::Mat::zeros(tmp_depth_.rows, tmp_depth_.cols, CV_32F),
                    cv::Mat::zeros(tmp_depth_.rows, tmp_depth_.cols, CV_32F));
    }

    depthReg_->depthToRGBResolution(tmp_depth_, scaled_);
    depthReg_->registerDepth(scaled_, scaled_registered_ );
    createCloud(scaled_registered_, tmp_rgb_, cloud);

    return cloud;
  }

I am not sure about the registration API and I am not getting a nice cloud. Is the call order correct?
Thanks

registration_viewer -both broken on OS X

Hi Thiemo,

rosrun registration_viewer viewer -kinect2 -both crashes for me now with the attached errorlog. rosrun registration_viewer viewer -kinect2 -image or rosrun registration_viewer viewer -kinect2 -cloud on their own work fine. Its not too important to fix it, probably not too difficult either :)

topic color: /kinect2_head/rgb_lowres/image
topic depth: /kinect2_head/depth_lowres/image
starting receiver...
_RegisterApplication(), FAILED TO REGISTER PROCESS WITH CPS/CoreGraphics in WindowServer, err=-50
2014-12-09 16:55:34.209 viewer[51411:418188] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
2014-12-09 16:55:34.212 viewer[51411:418188] *** Assertion failure in -[NSApplication init], /SourceCache/AppKit/AppKit-1343.16/AppKit.subproj/NSApplication.m:1720
2014-12-09 16:55:34.272 viewer[51411:418188] An uncaught exception was raised
2014-12-09 16:55:34.273 viewer[51411:418188] Creating more than one Application
2014-12-09 16:55:34.273 viewer[51411:418188](0 CoreFoundation 0x00007fff8cfb264c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8d1f46de objc_exception_throw + 43
2 CoreFoundation 0x00007fff8cfb242a +[NSException raise:format:arguments:] + 106
3 Foundation 0x00007fff9137e5b9 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 AppKit 0x00007fff82d113f6 -[NSApplication init] + 131
5 AppKit 0x00007fff82d1119f +[NSApplication sharedApplication] + 138
6 libvtkRendering.5.10.dylib 0x00000001075c04bb _ZN20vtkCocoaRenderWindow13CreateAWindowEv + 101
7 libvtkRendering.5.10.dylib 0x00000001075c0e71 _ZN20vtkCocoaRenderWindow10InitializeEv + 191
8 libvtkRendering.5.10.dylib 0x00000001075becd0 _ZN20vtkCocoaRenderWindow5StartEv + 18
9 libvtkRendering.5.10.dylib 0x00000001075bcb32 _ZN30vtkCocoaRenderWindowInteractor10InitializeEv + 56
10 libpcl_visualization.1.8.dylib 0x000000010d01f599 _ZN3pcl13visualization13PCLVisualizer16createInteractorEv + 213
11 libpcl_visualization.1.8.dylib 0x000000010d01f342 _ZN3pcl13visualization13PCLVisualizerC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb + 838
12 viewer 0x00000001043675c6 _ZN8Receiver11cloudViewerEv + 358
13 viewer 0x0000000104361a38 _ZN8Receiver5startENS_4ModeE + 3960
14 viewer 0x000000010435e0ac main + 1468
15 libdyld.dylib 0x00007fff89d7f5c9 start + 1
16 ??? 0x0000000000000003 0x0 + 3)
2014-12-09 16:55:34.273 viewer[51411:418188] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Creating more than one Application'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff8cfb264c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8d1f46de objc_exception_throw + 43
2 CoreFoundation 0x00007fff8cfb242a +[NSException raise:format:arguments:] + 106
3 Foundation 0x00007fff9137e5b9 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 AppKit 0x00007fff82d113f6 -[NSApplication init] + 131
5 AppKit 0x00007fff82d1119f +[NSApplication sharedApplication] + 138
6 libvtkRendering.5.10.dylib 0x00000001075c04bb _ZN20vtkCocoaRenderWindow13CreateAWindowEv + 101
7 libvtkRendering.5.10.dylib 0x00000001075c0e71 _ZN20vtkCocoaRenderWindow10InitializeEv + 191
8 libvtkRendering.5.10.dylib 0x00000001075becd0 _ZN20vtkCocoaRenderWindow5StartEv + 18
9 libvtkRendering.5.10.dylib 0x00000001075bcb32 _ZN30vtkCocoaRenderWindowInteractor10InitializeEv + 56
10 libpcl_visualization.1.8.dylib 0x000000010d01f599 _ZN3pcl13visualization13PCLVisualizer16createInteractorEv + 213
11 libpcl_visualization.1.8.dylib 0x000000010d01f342 _ZN3pcl13visualization13PCLVisualizerC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb + 838
12 viewer 0x00000001043675c6 _ZN8Receiver11cloudViewerEv + 358
13 viewer 0x0000000104361a38 _ZN8Receiver5startENS_4ModeE + 3960
14 viewer 0x000000010435e0ac main + 1468
15 libdyld.dylib 0x00007fff89d7f5c9 start + 1
16 ??? 0x0000000000000003 0x0 + 3
)
libc++abi.dylib: terminating with uncaught exception of type NSException
[1] 51411 abort rosrun registration_viewer viewer -kinect2 -both

Any one get data in ubuntu 12.04?

I am trying to deal with the IAI_Kinect2 package in ubuntu 12.04 ros- hydro, I wonder if any one got the correct data? So this is what I got:
(1). I could compile the libfreenect2 and by running the Protonect and all the data (RGB depth ir ) could be visualized. Though a little bit lag(Soon I figure out the GPU is not available, almost costing 1 cpu core)
GPU info:
###################
CL_PLATFORM_NAME: NVIDIA CUDA
CL_PLATFORM_VERSION: OpenCL 1.1 CUDA 6.5.18
OpenCL Device Info:
1 devices found supporting OpenCL on: NVIDIA CUDA


Device Quadro 4000


$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Qz1: Is that the version of the opencl that make it so? Should I use a opencl version >1.2? Since repos in 12.04 is opencl1.1, while I have tried opencl1.2, which may cause link error, which requests ocl-icd-opencl-dev package which no repos for 12.04 and also get conflict with nvidia-opencl. $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

(2). For the IAI_Kinect2 ros package, I was trying to compile using CPU by:
comment out "#define CV_OCL" in line 31 of the kinect2_bridge and it will not use any opencv opencl functionality at all. When the depth registration is initialized in line 143 of the kinect2_bridge you can choose CPU instead of OPENCL.
The output differs, If using opencl, u got output like: (no such output for CPU)

[DepthPacketStreamParser::handleNewData] not all subsequences received 0
OpenCL device: Quadro 4000 FULL_PROFILE
[DepthRegistrationOpenCL::selectDevice] found platform: NVIDIA CUDA vendor: NVIDIA Corporation
[DepthRegistrationOpenCL::selectDevice] found device: Quadro 4000 vendor: NVIDIA Corporation
starting main loop

However, I tried both but neither works. The output is the same as Protonect, but as I run:
rosrun registration_viewer viewer -kinect2 -image
Output:
topic color: /kinect2_head/rgb_lowres/image
topic depth: /kinect2_head/depth_lowres/image
starting receiver...
(seems halt without output)
Also I tried rviz, as I subscribed to the image topic, and resulted in just black image............

Perhaps I need to upgrade my ubuntu distribution. But I haven't found any nvidia-opencl
driver that provide opencl >1.2 to my GPU.
Also pitifully the CPU is old Xeon without Core-gpu. :(

camera_calibration shows only white screen on osx

When I try to record some calibration pictures like this:
rosrun kinect2_bridge kinect2_bridge
rosrun camera_calibration camera_calibration record color chess9x6x0.08
I just see a white window and frames are not stored upon pressing w

Any ideas?

rosrun camera_calibration camera_calibration record color chess9x6x0.08
Start settings:
Mode: record
Source: color
Board: chess
Dimensions: 9 x 6
Field size: 0.08
Topic color: kinect2_head/mono/image
Topic ir: kinect2_head/ir/image
Path: ./

starting recorder...
starting loop...
w
w
q
^Cstopping recording...

switch back to upstream libfreenect2 repository?

Hi Thiemo,

as the upstream libfreenect2 repository contains now all the required changes, would it be possible to switch back? This might simplify future maintenance and reduce divergence?

Best,
Christian

Jetson TK1 deployment

As suggested by @wiedemeyer, here are some deployment notes on Jetson TK1 I sent him earlier. I will follow up here.

Jetson TK1 offers 300 Gflops at 10W with USB 3.0 and GbE. It seems perfectly capable of handling Kinect2 data while consumes little power. But Nvidia provides no OpenCL support for Jetson TK1 so this project will need some CUDA code (I might write some).

Compiling this without OpenCL will requires some changes to the code. Besides some tweaking of CMakeLists.txt, @wiedemeyer suggested to

comment out "#define CV_OCL" in line 31 of the kinect2_bridge and it will not use any opencv opencl functionality at all. When the depth registration is initialized in line 143 of the kinect2_bridge you can choose CPU instead of OPENCL. And in libfreenect2 change the depth processor to the CPU or OpenGL one.

However Jetson TK1 CPU is weak. I don't think it can handle depth registration by CPU alone.

libfreenect2 compiled but didn't get any data from Kinect2. Protonect got stuck waiting for the first frame, after good initialization. dmesg had some warnings (add later) about tegra-xhci. This is hard to debug. It's possible this new device and new driver just don't work with Kinect2. I'll get a NEC uDP720202 and see if this one works. And then test this project.

Kinect2 Calibration viewer window doesn't get updated

I just started to use your package and kinect2. Apologize if I am asking a stupid question. I managed to get almost all the commands to run. But when running 'rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record color', Kinect2 Calibration viewer window doesn't get updated, so that I can only record one picture (or multiple same ones). I am not sure if it was designed like this, but I was expecting to record a bunch of different images for calibration. From your example on README, it seems you were using ~400 images for calibration. Could you please let me know if I am wrong and where I should check?

Thank you in advance!

OpenCL registration method not available

I tried to run kinect2 in ubuntu 14.04 and got the following error.

jihoonl@whoola:~/research/ros/freenect2/devel$ rosrun kinect2_bridge kinect2_bridge 
^[[A[DepthRegistration::New] OpenCL registration method not available!
[DepthRegistration::New] OpenCL registration method not available!
[OpenGLContext] failed to initialize glew for the current context!
Segmentation fault (core dumped)

kinect2_bridge can't find libGLEWmx.so.1.11

Hello,

when I try to run kinect2_bridge I get the following error:

error while loading shared libraries: libGLEWmx.so.1.11: cannot open shared object file: No such file or directory

I compiled libfreenect2 with CpuDepthRegistration and Protonect works fine.
I'm running on Intel i7 with Ubuntu 14.04 and ROS Indigo.

Do I have to link the library manually?

Sensor serial id does not get passed trough

The serial number does not seem to be parsed trough.
Tested some of the other arguments they seem to be working fine.

➜  workspace git:(master) ✗ rosrun kinect2_bridge kinect2_bridge _sensor:=500560540242                  
[OpenCLDepthPacketProcessor::listDevice]  devices:
  0: GeForce GTX 980 (GPU)[NVIDIA Corporation]
[OpenCLDepthPacketProcessor::init]  selected device: GeForce GTX 980 (GPU)[NVIDIA Corporation]
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 25 usb devices connected
[Freenect2Impl] found valid Kinect v2 @4:7 with serial 501224741942
[Freenect2Impl] found valid Kinect v2 @4:5 with serial 500560540242
[Freenect2Impl] found 2 devices
Kinect2 devices found: 
  0: 501224741942 (selected)
  1: 500560540242
[Freenect2DeviceImpl] opening...
[Freenect2DeviceImpl] opened

starting kinect2

[Freenect2DeviceImpl] starting...
[Freenect2DeviceImpl] ReadData0x14 response
92 bytes of raw data

Support for multiple devices

Is there currently a way to get this working with multiple devices? As far as I can tell right now when kinect2_bridge is run, one device is selected by default and that's the only one that runs.

Andrew

ERROR: clBuildProgram(-11)

Hello,

when I run the kinect2_bridge it fails with:

Build Log: :76:19: error: expected ';' at end of declaration
const int xD = i widthD;
^
but in depth depth_registration.cl at line 76 the statement seems correct:
const int xD = i % widthD;

Any ideas?


rosrun kinect2_bridge kinect2_bridge
Using OpenCL registration method!
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 4 usb devices connected
[Freenect2Impl] found valid Kinect v2 @21:1 with serial 052891334147
[Freenect2Impl] found 1 devices
[Freenect2DeviceImpl] opening...
[Freenect2DeviceImpl] opened
device serial: xxx

Could not load calibration data from "/Users/tatsch/catkin_ws/src/iai_kinect2/kinect2_bridge/data/xxx". Using sensor defaults.

OpenCL device: Iris FULL_PROFILE
ERROR: clBuildProgram(-11)
Build Status: -2
Build Options:
Build Log: :76:19: error: expected ';' at end of declaration
const int xD = i widthD;
^
;
:82:33: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 projX = (float4)(r00, r01, r02, tx);
^
:19:13: note: expanded from macro 'r00'

define r00 1.00000000000000e+00

        ^

:82:38: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 projX = (float4)(r00, r01, r02, tx);
^
:20:13: note: expanded from macro 'r01'

define r01 0.00000000000000e+00

        ^

:82:43: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 projX = (float4)(r00, r01, r02, tx);
^
:21:13: note: expanded from macro 'r02'

define r02 0.00000000000000e+00

        ^

:82:48: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 projX = (float4)(r00, r01, r02, tx);
^
:30:12: note: expanded from macro 'tx'

define tx 0.00000000000000e+00

       ^

:83:33: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 projY = (float4)(r10, r11, r12, ty);
^
:22:13: note: expanded from macro 'r10'

define r10 0.00000000000000e+00

        ^

:83:38: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 projY = (float4)(r10, r11, r12, ty);
^
:23:13: note: expanded from macro 'r11'

define r11 1.00000000000000e+00

        ^

:83:43: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 projY = (float4)(r10, r11, r12, ty);
^
:24:13: note: expanded from macro 'r12'

define r12 0.00000000000000e+00

        ^

:83:48: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 projY = (float4)(r10, r11, r12, ty);
^
:31:12: note: expanded from macro 'ty'

define ty 0.00000000000000e+00

       ^

:84:33: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 projZ = (float4)(r20, r21, r22, tz);
^
:25:13: note: expanded from macro 'r20'

define r20 0.00000000000000e+00

        ^

:84:38: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 projZ = (float4)(r20, r21, r22, tz);
^
:26:13: note: expanded from macro 'r21'

define r21 0.00000000000000e+00

        ^

:84:43: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 projZ = (float4)(r20, r21, r22, tz);
^
:27:13: note: expanded from macro 'r22'

define r22 1.00000000000000e+00

        ^

:84:48: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 projZ = (float4)(r20, r21, r22, tz);
^
:32:12: note: expanded from macro 'tz'

define tz 0.00000000000000e+00

       ^

:88:39: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 point = (float4)((xD - cxD) * fxDInv * z, (yD - cyD) * fyDInv * z, z, 1.0f);
^
:37:13: note: expanded from macro 'cxD'

define cxD 0.00000000000000e+00

        ^

:88:46: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 point = (float4)((xD - cxD) * fxDInv * z, (yD - cyD) * fyDInv * z, z, 1.0f);
^
:39:24: note: expanded from macro 'fxDInv'

define fxDInv (1.0f / fxD)

                   ^

:35:13: note: expanded from macro 'fxD'

define fxD 0.00000000000000e+00

        ^

:88:64: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 point = (float4)((xD - cxD) * fxDInv * z, (yD - cyD) * fyDInv * z, z, 1.0f);
^
:38:13: note: expanded from macro 'cyD'

define cyD 0.00000000000000e+00

        ^

:88:71: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 point = (float4)((xD - cxD) * fxDInv * z, (yD - cyD) * fyDInv * z, z, 1.0f);
^
:40:24: note: expanded from macro 'fyDInv'

define fyDInv (1.0f / fyD)

                   ^

:36:13: note: expanded from macro 'fyD'

define fyD 0.00000000000000e+00

        ^

:96:20: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float x = (fxD * projected.x) * invZ + cxD;
^
:35:13: note: expanded from macro 'fxD'

define fxD 0.00000000000000e+00

        ^

:96:48: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float x = (fxD * projected.x) * invZ + cxD;
^
:37:13: note: expanded from macro 'cxD'

define cxD 0.00000000000000e+00

        ^

:97:20: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float y = (fyD * projected.y) * invZ + cyD;
^
:36:13: note: expanded from macro 'fyD'

define fyD 0.00000000000000e+00

        ^

:97:48: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float y = (fyD * projected.y) * invZ + cyD;
^
:38:13: note: expanded from macro 'cyD'

define cyD 0.00000000000000e+00

        ^

:161:24: warning: double precision constant requires cl_khr_fp64, casting to single precision
const ushort thres = 0.01 * zI;
^
:291:23: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float thres = 0.01 * avg;
^
:302:36: warning: double precision constant requires cl_khr_fp64, casting to single precision
const float4 tmp = (float4)(sqrt(2.0));
^
/System/Library/Frameworks/OpenCL.framework/Versions/A/lib/clang/3.2/include/cl_kernel.h:4741:33: note: expanded from macro 'sqrt'
#define sqrt(__x) __cl_sqrt(__x)
^
:307:35: warning: double precision constant requires cl_khr_fp64, casting to single precision
out[i] = (dot(p, dist) / sum) + 0.5;
^

Initialization failed!
[Freenect2DeviceImpl] closing...
[Freenect2DeviceImpl] releasing usb interfaces...
[Freenect2DeviceImpl] deallocating usb transfer pools...
[Freenect2DeviceImpl] closing usb device...
[Freenect2DeviceImpl] closed

Calibration OpenCV Error

I am trying to use the calibration system. Any idea why i am getting this assertion from OpenCV

➜  rgb git:(master) ✗ rosrun kinect2_calibration kinect2_calibration calibrate color
Start settings:
Mode: calibrate
Source: color
Board: chess
Dimensions: 7 x 6
Field size: 0.108
Topic color: /kinect2_head/mono/image
Topic ir: /kinect2_head/ir/image
Path: ./

restoring files...
restoring file: 0000_color_points.yaml
restoring file: 0023_color_points.yaml
restoring file: 0031_color_points.yaml
restoring file: 0015_color_points.yaml
restoring file: 0027_color_points.yaml
restoring file: 0005_color_points.yaml
restoring file: 0019_color_points.yaml
restoring file: 0010_color_points.yaml
restoring file: 0024_color_points.yaml
restoring file: 0020_color_points.yaml
restoring file: 0016_color_points.yaml
restoring file: 0001_color_points.yaml
restoring file: 0006_color_points.yaml
restoring file: 0032_color_points.yaml
restoring file: 0011_color_points.yaml
restoring file: 0028_color_points.yaml
restoring file: 0002_color_points.yaml
restoring file: 0025_color_points.yaml
restoring file: 0017_color_points.yaml
restoring file: 0021_color_points.yaml
restoring file: 0007_color_points.yaml
restoring file: 0018_color_points.yaml
restoring file: 0003_color_points.yaml
restoring file: 0029_color_points.yaml
restoring file: 0012_color_points.yaml
restoring file: 0022_color_points.yaml
restoring file: 0026_color_points.yaml
restoring file: 0008_color_points.yaml
restoring file: 0004_color_points.yaml
restoring file: 0030_color_points.yaml
restoring file: 0013_color_points.yaml
restoring file: 0009_color_points.yaml
restoring file: 0033_color_points.yaml
restoring file: 0014_color_points.yaml
restoring file: 0034_color_points.yaml
starting calibration...
calibrating intrinsics...
OpenCV Error: Assertion failed (ni > 0 && ni == ni1) in collectCalibrationData, file /home/juw/checkout/opencv/modules/calib3d/src/calibration.cpp, line 3193
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/juw/checkout/opencv/modules/calib3d/src/calibration.cpp:3193: error: (-215) ni > 0 && ni == ni1 in function collectCalibrationData

[1]    9092 abort (core dumped)  rosrun kinect2_calibration kinect2_calibration calibrate color
``'

kinect2_calibration freezes at start

I've started rosrun kinect2_bridge kinect2_bridge showing some output like

[OpenCLDepthPacketProcessor] avg. time: 12.6462ms -> ~79.0754Hz
[OpenCLDepthPacketProcessor] avg. time: 12.5004ms -> ~79.9973Hz
[DepthPacketStreamParser::handleNewData] image data too short!
[DepthPacketStreamParser::handleNewData] image data too short!
[DepthPacketStreamParser::handleNewData] not all subsequences received 1019
[OpenCLDepthPacketProcessor] avg. time: 12.3645ms -> ~80.8766Hz
[OpenCLDepthPacketProcessor] avg. time: 12.4767ms -> ~80.1495Hz
[OpenCLDepthPacketProcessor] avg. time: 12.338ms -> ~81.0507Hz

and tried to calibrate my camera rosrun kinect2_calibration kinect2_calibration record color chess10x6x0.05

but this freezes at

Start settings:
Mode: record
Source: color
Board: chess
Dimensions: 10 x 6
Field size: 0.05
Topic color: kinect2_head/mono/image
Topic ir: kinect2_head/ir/image
Path: ./

starting recorder...

I can't even close it with CTRL+C but have to kill it.

Any idea what could be wrong here? Also, how is width and height specified for the checkerboard? Are these defined as usual as the inner transitions between squares? For example, what would be the width and height for http://docs.opencv.org/_downloads/pattern.png?

find_package called with invalid argument "CONFIG"

When attemping to build iai_kinect2 on 12.04/Hydro setup I get the following error:

CMake Error at iai_kinect2/kinect2_bridge/CMakeLists.txt:27 (find_package):
  find_package called with invalid argument "CONFIG"

I am not aware of a CONFIG argument to find_package. If I remove it or replace it with something like REQUIRED cmake is happy.

The full output is as follows:

hemes@jake:~/ros_ws$ catkin_make -DCMAKE_BUILD_TYPE="Release"
Base path: /home/hemes/ros_ws
Source space: /home/hemes/ros_ws/src
Build space: /home/hemes/ros_ws/build
Devel space: /home/hemes/ros_ws/devel
Install space: /home/hemes/ros_ws/install
####
#### Running command: "cmake /home/hemes/ros_ws/src -DCATKIN_DEVEL_PREFIX=/home/hemes/ros_ws/devel -DCMAKE_INSTALL_PREFIX=/home/hemes/ros_ws/install -DCMAKE_BUILD_TYPE=Release" in "/home/hemes/ros_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/hemes/ros_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/hemes/ros_ws/devel;/opt/ros/hydro
-- This workspace overlays: /home/hemes/ros_ws/devel;/opt/ros/hydro
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Python version: 2.7
-- Using Debian Python package layout
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/hemes/ros_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- catkin 0.5.89
-- BUILD_SHARED_LIBS is on
WARNING: Package "ompl" does not follow the version conventions. It should not contain leading zeros (unless the number is 0).
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 5 packages in topological order:
-- ~~  - iai_kinect2 (metapackage)
-- ~~  - depth_registration
-- ~~  - kinect2_bridge
-- ~~  - kinect2_calibration
-- ~~  - registration_viewer
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin metapackage: 'iai_kinect2'
-- ==> add_subdirectory(iai_kinect2/iai_kinect2)
-- +++ processing catkin package: 'depth_registration'
-- ==> add_subdirectory(iai_kinect2/depth_registration)
-- Eigen found (include: /usr/include/eigen3)
-- Could NOT find OpenCL (missing:  OPENCL_INCLUDE_DIRS) 
-- CPU based depth registration enabled
-- OpenCL based depth registration disabled
-- +++ processing catkin package: 'kinect2_bridge'
-- ==> add_subdirectory(iai_kinect2/kinect2_bridge)
CMake Error at iai_kinect2/kinect2_bridge/CMakeLists.txt:27 (find_package):
  find_package called with invalid argument "CONFIG"


-- Using these message generators: gencpp;genlisp;genpy
-- +++ processing catkin package: 'kinect2_calibration'
-- ==> add_subdirectory(iai_kinect2/kinect2_calibration)
-- Using these message generators: gencpp;genlisp;genpy
-- +++ processing catkin package: 'registration_viewer'
-- ==> add_subdirectory(iai_kinect2/registration_viewer)
-- Using these message generators: gencpp;genlisp;genpy
-- checking for module 'openni-dev'
--   package 'openni-dev' not found
-- checking for module 'openni-dev'
--   package 'openni-dev' not found
-- checking for module 'openni-dev'
--   package 'openni-dev' not found
-- looking for PCL_COMMON
-- looking for PCL_KDTREE
-- looking for PCL_OCTREE
-- looking for PCL_SEARCH
-- looking for PCL_IO
-- looking for PCL_SAMPLE_CONSENSUS
-- looking for PCL_FILTERS
-- looking for PCL_GEOMETRY
-- looking for PCL_VISUALIZATION
-- looking for PCL_OUTOFCORE
-- looking for PCL_FEATURES
-- looking for PCL_SEGMENTATION
-- looking for PCL_PEOPLE
-- looking for PCL_REGISTRATION
-- looking for PCL_RECOGNITION
-- looking for PCL_KEYPOINTS
-- looking for PCL_SURFACE
-- looking for PCL_TRACKING
-- looking for PCL_APPS
-- Configuring incomplete, errors occurred!
Invoking "cmake" failed

Viewer crashes on OSX

I assume this comes from pcl_visualization using outdated api, correct? If so, I will raise an issue upstream...

rosrun registration_viewer viewer -kinect2 -cloud
topic color: /kinect2_head/rgb_lowres/image
topic depth: /kinect2_head/depth_lowres/image
starting receiver...
starting loop...
2014-09-16 17:22:49.750 viewer[12065:2c03] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
2014-09-16 17:22:49.777 viewer[12065:2c03] *** WARNING: Method userSpaceScaleFactor in class NSWindow is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
2014-09-16 17:22:50.089 viewer[12065:2c03] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /SourceCache/Foundation/Foundation-1056.13/Misc.subproj/NSUndoManager.m:328
2014-09-16 17:22:50.090 viewer[12065:2c03] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.
2014-09-16 17:22:50.091 viewer[12065:2c03] (
0 CoreFoundation 0x00007fff9062925c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff98811e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff90629038 +[NSException raise:format:arguments:] + 104
3 Foundation 0x00007fff978dcd41 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
4 Foundation 0x00007fff9784728c +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 156
5 AppKit 0x00007fff8aec6a23 -[NSApplication run] + 688
6 libpcl_visualization.1.8.dylib 0x0000000111622a52 _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 282
7 viewer 0x0000000108c76a3e _ZN8Receiver11cloudViewerEv + 3358
8 viewer 0x0000000108c7dc51 ZNSt3__114__thread_proxyINS_5tupleIJM8ReceiverFvvEPS2_EEEEEPvS7 + 113
9 libsystem_pthread.dylib 0x00007fff9500d899 _pthread_body + 138
10 libsystem_pthread.dylib 0x00007fff9500d72a _pthread_struct_init + 0
11 libsystem_pthread.dylib 0x00007fff95011fc9 thread_start + 13
)
2014-09-16 17:22:50.092 viewer[12065:2c03] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /SourceCache/Foundation/Foundation-1056.13/Misc.subproj/NSUndoManager.m:328
2014-09-16 17:22:50.093 viewer[12065:2c03] An uncaught exception was raised
2014-09-16 17:22:50.093 viewer[12065:2c03] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.
2014-09-16 17:22:50.093 viewer[12065:2c03] (
0 CoreFoundation 0x00007fff9062925c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff98811e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff90629038 +[NSException raise:format:arguments:] + 104
3 Foundation 0x00007fff978dcd41 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
4 Foundation 0x00007fff9784728c +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 156
5 AppKit 0x00007fff8aec6acd -[NSApplication run] + 858
6 libpcl_visualization.1.8.dylib 0x0000000111622a52 _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 282
7 viewer 0x0000000108c76a3e _ZN8Receiver11cloudViewerEv + 3358
8 viewer 0x0000000108c7dc51 ZNSt3__114__thread_proxyINS_5tupleIJM8ReceiverFvvEPS2_EEEEEPvS7 + 113
9 libsystem_pthread.dylib 0x00007fff9500d899 _pthread_body + 138
10 libsystem_pthread.dylib 0x00007fff9500d72a _pthread_struct_init + 0
11 libsystem_pthread.dylib 0x00007fff95011fc9 thread_start + 13
)
2014-09-16 17:22:50.094 viewer[12065:2c03] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff9062925c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff98811e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff90629038 +[NSException raise:format:arguments:] + 104
3 Foundation 0x00007fff978dcd41 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
4 Foundation 0x00007fff9784728c +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 156
5 AppKit 0x00007fff8aec6acd -[NSApplication run] + 858
6 libpcl_visualization.1.8.dylib 0x0000000111622a52 _ZN3pcl13visualization13PCLVisualizer8spinOnceEib + 282
7 viewer 0x0000000108c76a3e _ZN8Receiver11cloudViewerEv + 3358
8 viewer 0x0000000108c7dc51 ZNSt3__114__thread_proxyINS_5tupleIJM8ReceiverFvvEPS2_EEEEEPvS7 + 113
9 libsystem_pthread.dylib 0x00007fff9500d899 _pthread_body + 138
10 libsystem_pthread.dylib 0x00007fff9500d72a _pthread_struct_init + 0
11 libsystem_pthread.dylib 0x00007fff95011fc9 thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
[2] 12065 abort rosrun registration_viewer viewer -kinect2 -cloud

Install libfreenet2 in a linux mint 15 (based in Ubuntu 13.04)

Hi, I tried to install the libfreenet2 fork in a linux mint 15 (based in Ubuntu 13.04) using the instructions provided by davetcoleman but I get a compile error in the make command.
davetcoleman/libfreenect2@ae663fe

[ 47%] Built target glfw
[ 50%] Generating src/resources.inc
Scanning dependencies of target freenect2
[ 52%] Building CXX object CMakeFiles/freenect2.dir/src/opengl.cpp.o
/home/jordi/tfmws/src/libfreenect2/examples/protonect/src/opengl.cpp:59:8: error: ‘thread_local’ does not name a type
/home/jordi/tfmws/src/libfreenect2/examples/protonect/src/opengl.cpp: In member function ‘void libfreenect2::OpenGLContext::makeCurrent() const’:
/home/jordi/tfmws/src/libfreenect2/examples/protonect/src/opengl.cpp:65:3: error: ‘current_ctx’ was not declared in this scope
/home/jordi/tfmws/src/libfreenect2/examples/protonect/src/opengl.cpp: In static member function ‘static void libfreenect2::OpenGLContext::detachCurrent()’:
/home/jordi/tfmws/src/libfreenect2/examples/protonect/src/opengl.cpp:73:3: error: ‘current_ctx’ was not declared in this scope
/home/jordi/tfmws/src/libfreenect2/examples/protonect/src/opengl.cpp: In static member function ‘static const libfreenect2::OpenGLContext* libfreenect2::OpenGLContext::current()’:
/home/jordi/tfmws/src/libfreenect2/examples/protonect/src/opengl.cpp:78:10: error: ‘current_ctx’ was not declared in this scope
make[2]: *** [CMakeFiles/freenect2.dir/src/opengl.cpp.o] Error 1
make[1]: *** [CMakeFiles/freenect2.dir/all] Error 2
make: *** [all] Error 2

Any Idea what could be the problem?

No publication of depth images in Kinect Bridge

Hey there,
Really enjoying the Kinect bridge, thanks for your hard work. I've unfortunately run into a problem where everything seems to work fine, except the depth data isn't captured and published. This happens regardless of using CPU or the OpenCL acceleration on my GPU.

What we see is ...

starting 8 worker threads
starting main loop

[kinect2_bridge] depth avg. time: inf -> ~0 Hz
[kinect2_bridge] color avg. time: 0.0354116 -> ~28.2394 Hz
[TurboJpegRgbPacketProcessor] avg. time: 16.8243ms -> ~59.4378Hz
[kinect2_bridge] depth avg. time: inf -> ~0 Hz
[kinect2_bridge] color avg. time: 0.0330776 -> ~30.2319 Hz

As the depth avg. time is 0, we don't get any depth images output.

Any guesses?

libfreenect2/libfreenect2.hpp: No such file or directory

Hi,

I just tried to get this running on our system, but I get the error

src/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp:48:41: fatal error: libfreenect2/libfreenect2.hpp: No such file or directory
 #include <libfreenect2/libfreenect2.hpp>

when compiling.

I already followed the libfreenet2 installation tutorial and got the Kinect2 running. But libfreenect2 header files don't get installed it seems and so catkin can't find them. Any ideas how to solve that?

Thanks.

Building iai_kinect2 with catkin

I have libfreenect2 built now, but kinect2_bridge is failing with the following error (built using the new catkin_tools):

Starting ==> kinect2_bridge                                                                                            

[kinect2_bridge] ==> '/home/dave/ros/ws_base/build/kinect2_bridge/build_env.sh /usr/bin/make -j12 -l12' in '/home/dave/ros/ws_base/build/kinect2_bridge'
Scanning dependencies of target kinect2_bridge
[100%] Building CXX object CMakeFiles/kinect2_bridge.dir/src/kinect2_bridge.cpp.o
Linking CXX executable /home/dave/ros/ws_base/devel/lib/kinect2_bridge/kinect2_bridge
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clReleaseMemObject@OPENCL_1.0'
//usr/local/lib/libfreenect2.so: undefined reference to `clRetainEvent@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clReleaseKernel@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clReleaseCommandQueue@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clReleaseEvent@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clEnqueueWriteBuffer@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clCreateBuffer@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clBuildProgram@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clReleaseDevice@OPENCL_1.2'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clSetKernelArg@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clRetainKernel@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clCreateContext@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clReleaseProgram@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clGetDeviceIDs@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clRetainDevice@OPENCL_1.2'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clGetPlatformInfo@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clRetainCommandQueue@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clCreateProgramWithSource@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clCreateKernel@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clGetDeviceInfo@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clReleaseContext@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clRetainContext@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clCreateCommandQueue@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clEnqueueNDRangeKernel@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clWaitForEvents@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clEnqueueReadBuffer@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clRetainProgram@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clGetProgramBuildInfo@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clGetPlatformIDs@OPENCL_1.0'
/home/dave/ros/ws_base/devel/lib/libdepth_registration.so: undefined reference to `clRetainMemObject@OPENCL_1.0'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/dave/ros/ws_base/devel/lib/kinect2_bridge/kinect2_bridge] Error 1
make[1]: *** [CMakeFiles/kinect2_bridge.dir/all] Error 2
[kinect2_bridge] <== '/home/dave/ros/ws_base/build/kinect2_bridge/build_env.sh /usr/bin/make -j12 -l12' failed with return code '2'

[build] There were errors:                                                                                             

    Failed to build package 'kinect2_bridge' because the following command:

        # Command run in directory: /home/dave/ros/ws_base/build/kinect2_bridge
        /home/dave/ros/ws_base/build/kinect2_bridge/build_env.sh /usr/bin/make -j12 -l12

    Exited with return code: 2 
[build] Runtime: 10.8 seconds 

Any thoughts how to fix this? Build OpenCL from source?

libfreenect2-fork: undefined symbol udev_new

Hello Thiemo,
I hope you can help me with this. Today I just switched from an older version (wiedemeyer/libfreenect2 branch:old_master commit:22eeda006eedc03f02815809bb2a7d4ce2351d1f: "implemented a better device selection [...]" from 9 Oct. 2014) to the most current one (wiedemeyer/libfreenect2 branch:iai_kinect2 commit:318b52be2353a752628ad4148f089d36fa43573b:"modifications for iai_kinect2").

Obviously, quite a few things have changed. The result is that I cannot get ./Protonect to run on my setup anymore. My setup is:

Distribution: Ubuntu 14.04.01 
Kernel: 3.13.0-43-generic
Hardware: Intel Core i7-3840QM CPU with integrated Intel HD Graphics IvyBridge GPU
OpenCL Platform: OpenCL 1.2 beignet 1.0

As this is a minimal Ubuntu server installation without x-server components, OpenGL is not available. With the old version (commit:22eeda0) this was no problem as the OpenClDepthPacketProcessor was used.

However the latest version of wiedemeyer/libfreenect2 the situation is as follows:

  • Branch master (commit 5466b57): libfreenect2.so compiles, when I run it I get:
~/libs/libfreenect2/examples/protonect$ bin/Protonect 
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
[OpenGLContext] failed to initialize glew for the current context!
Segmentation fault

which is expected (due to non-working OpenGL).

  • Branch iai_kinect2 (commit 318b52b): libfreenect2.so compiles, when I run it I get:
~/libs/libfreenect2/examples/protonect/bin$ ./Protonect 
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
./Protonect: symbol lookup error: /home/ros/libs/libfreenect2/examples/protonect/lib/libfreenect2.so: undefined symbol: udev_new

This looks like two issues to me: (1) Broken OpenGL; (2) undefined symbol: udev_new

I pretty much spent all day trying to resolve this, but to no avail. Hence, my questions for you are:

  1. How to compile libfreenect2 without OpenGL support?
  2. Any idea how to resolve the undefined symbol error?

Thanks!

kinect2_bridge crashes

Hello,

I am using Ubuntu 14.04 with ROS Indigo and I am trying to get the Kinect2 tools to work. I first tried to install libfreenect2 (from https://github.com/wiedemeyer/libfreenect2) by running install_ubuntu.sh and then by building Protonect. However, during this process I got an error saying that the file CL/cl.hpp was not found.

My question is: what is the correct way to install this modified version of libfreenect2? I installed OpenCL as well (although the description page says it's optional) and managed to eventually compile libfreenect2. But, when I run kinect2_bridge, I get the following error:

Using OpenCL registration method!
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 10 usb devices connected
[Freenect2Impl] found valid Kinect v2 @4:1 with serial 502205743042
[Freenect2Impl] found 1 devices
[Freenect2DeviceImpl] opening...
[Freenect2DeviceImpl] opened

starting kinect2

[Freenect2DeviceImpl] starting...
[Freenect2DeviceImpl] ReadData0x14 response
92 bytes of raw data
0x0000: 00 00 12 00 00 00 00 00 01 00 00 00 43 c1 1f 41 ............C..A
0x0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x0020: 0a 21 33 55 20 00 17 ba 00 08 00 00 10 00 00 00 .!3U ...........
0x0030: 00 01 00 00 00 10 00 00 00 00 80 00 01 00 00 00 ................
0x0040: 31 33 00 00 00 02 10 18 47 4e 4b 39 32 31 2e 31 13......GNK921.1
0x0050: 58 00 00 00 00 00 00 00 00 00 00 00 X...........

ERROR: clGetPlatformIDs(-1001)
terminate called after throwing an instance of 'cl::Error'
what(): clGetPlatformIDs
Aborted (core dumped)

Has anyone experienced this? I really cannot get this to work on my system (Intel Core i5, 4GB RAM, Intel HD Graphics 4000, Ubuntu 14.04, ROS Indigo). Is it possible to avoid using OpenCL?

Regards,

Mihai Morariu

kinect2_bridge SegFault issue

Hi, I'm running into a Segmentation Fault when trying to launch kinect2_bridge via roslaunch on Ubuntu 14.04 using OpenCLPacketPipeline with Beignet installed.

Trying to follow the known working configuration for Intel GPU (IvyBridge), my system is currently:

  • Ubuntu 14.04 (Linux version 3.13.0-43-generic )
  • Beignet v1.0

Building the libfreenect2 library was successful and Protonect example works fine with OpenCL, and building the Beignet v1.0 package also went relatively smoothly.

Though after building the iai_kinect2 library and attempting to run 'roslaunch kinect2_bridge kinect2_bridge.launch' I get the following result:

SUMMARY
========

PARAMETERS
 * /rosdistro: indigo
 * /rosversion: 1.11.9

NODES
  /
    kinect2_bridge (kinect2_bridge/kinect2_bridge)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[kinect2_bridge-1]: started with pid [3771]
[DepthRegistration::New] Using OpenCL registration method!
[DepthRegistration::New] Using OpenCL registration method!
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 14 usb devices connected
[Freenect2Impl] found valid Kinect v2 @4:3 with serial 508862642542
[Freenect2Impl] found 1 devices
[kinect2_bridge-1] process has died [pid 3771, exit code -11, cmd /home/colin/catkin_ws/src/iai_kinect2/kinect2_bridge/devel/lib/kinect2_bridge/kinect2_bridge __name:=kinect2_bridge __log:=/home/colin/.ros/log/a893f52a-99c9-11e4-befa-542696d42fef/kinect2_bridge-1.log].
log file: /home/colin/.ros/log/a893f52a-99c9-11e4-befa-542696d42fef/kinect2_bridge-1*.log
[kinect2_bridge-1] restarting process

Where the process just continues to die and and restart until Ctrl+C.

Running kinect2_bridge through gdb produces the following:

(gdb) run
Starting program: /home/colin/catkin_ws/src/iai_kinect2/kinect2_bridge/devel/lib/kinect2_bridge/kinect2_bridge 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe19e2700 (LWP 3365)]
[New Thread 0x7fffe0aff700 (LWP 3366)]
[New Thread 0x7fffdbfff700 (LWP 3368)]
[New Thread 0x7fffdb7fe700 (LWP 3369)]
[New Thread 0x7fffdaffd700 (LWP 3370)]
[New Thread 0x7fffda7fc700 (LWP 3375)]
[DepthRegistration::New] Using OpenCL registration method!
[DepthRegistration::New] Using OpenCL registration method!
[Freenect2Impl] enumerating devices...
[Freenect2Impl] 14 usb devices connected
[Freenect2Impl] found valid Kinect v2 @4:3 with serial 508862642542
[Freenect2Impl] found 1 devices

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5fb0694 in libfreenect2::Freenect2DeviceImpl::Freenect2DeviceImpl (this=0x6ce350, context=<optimized out>, pipeline=
    0x7ffff7f9a890, usb_device=<optimized out>, usb_device_handle=<optimized out>, serial=...)
    at /home/colin/libfreenect2/examples/protonect/src/libfreenect2.cpp:329
329   rgb_transfer_pool_.setCallback(pipeline_->getRgbPacketParser());
(gdb) bt full
#0  0x00007ffff5fb0694 in libfreenect2::Freenect2DeviceImpl::Freenect2DeviceImpl (this=0x6ce350, context=<optimized out>, 
    pipeline=0x7ffff7f9a890, usb_device=<optimized out>, usb_device_handle=<optimized out>, serial=...)
    at /home/colin/libfreenect2/examples/protonect/src/libfreenect2.cpp:329
No locals.
#1  0x00007ffff5fb094f in libfreenect2::Freenect2::openDevice (this=0x7fffffffd9a8, idx=0, pipeline=0x7ffff7f9a890, 
    attempting_reset=<optimized out>) at /home/colin/libfreenect2/examples/protonect/src/libfreenect2.cpp:706
        device = 0x0
        dev = @0x683880: {dev = 0x6c8dc0, serial = {static npos = <optimized out>, 
            _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, 
              _M_p = 0x6c91a8 "508862642542"}}}
        dev_handle = 0x6dbbb0
        num_devices = <optimized out>
        r = <optimized out>
#2  0x000000000043402e in Kinect2Bridge::init(std::string const&) ()
No symbol table info available.
#3  0x0000000000430e1f in main ()
No symbol table info available.

Just wondering if anyone has run into similar problems in their installations (could be missing something silly.. I'm new at this :)) -- Many thanks for any help!

Opencl depth packer processor no longer works..

I have been using your version of libfreenect2(https://github.com/wiedemeyer/libfreenect2) for a while and it was working well with opencl depth packet processing.

But recently after some system updates, the opencl depth packet processing no longer works. It is giving this error:
"[OpenCLDepthPacketProcessor::init] ERROR: clGetPlatformIDs(-1001)
terminate called after throwing an instance of 'cl::Error'
what(): clGetPlatformIDs
Aborted (core dumped)"

I was able to use the cpu depth processing and still get the sensor working, but it much slower compared to before for my task.

I am working on ubuntu 14.04(64 bit), ros indigo and NVIDIA Corporation GK106 [GeForce GTX 660] controller

I still want to use the opencl depth packet processor and not cpu. Please let me know what to do, Thank you!

include libfreenect2/libfreenect2.hpp not found

the freenect2Config.cmake generated by libfreenect2 upstream make install sets freenect2_INCLUDE_DIR to $CMAKE_INSTALL_PREFIX/include/libfreenect2. However, kinect2_bridge.cpp expects freenect2_INCLUDE_DIR to be $CMAKE_INSTALL_PREFIX/include/ leading to compilation error.

I guess we should fix this in libfreenect2?

Package name conflict: camera_calibration

The name of camera_calibration is conflicting against camera_calibration of image_pipeline.

Could you rename the package?

++ catkin_make --only-pkg-with-deps iai_kinect2 -DCMAKE_BUILD_TYPE=RelWithDebInfo
Base path: /home/garaemon/ros/hydro
Source space: /home/garaemon/ros/hydro/src
Build space: /home/garaemon/ros/hydro/build
Devel space: /home/garaemon/ros/hydro/devel
Install space: /home/garaemon/ros/hydro/install
Multiple packages found with the same name "camera_calibration":
- iai_kinect2/camera_calibration
- image_pipeline/camera_calibration

Compile issue with OpenCL on Ubuntu 14.04

CMake is not able to find libOpenCL.so

I fixed this by updating depth_registration/CMakeLIsts.txt with

if(DEPTH_REG_OPENCL)
  add_definitions(-DREG_OPENCL_FILE="${PROJECT_SOURCE_DIR}/src/depth_registration.cl")
  set(MODULES ${MODULES} src/depth_registration_opencl.cpp)
  if(APPLE)
    set(MODULE_LIBS ${MODULE_LIBS} ${OPENCL_LIBRARIES})
  else()
   # set(MODULE_LIBS ${MODULE_LIBS} OpenCL)
    set(MODULE_LIBS ${MODULE_LIBS} ${OPENCL_LIBRARIES})
  endif()
endif()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.