Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenNI2 with Kinect v1

Hi guys,

I know this might seem like a duplicate and the ros wiki says the kinect is not supported, but I used the OpenNI2-FreenectDriver and had success with NiViewer2 as well as sometimes with ROS.

The problem is that sometimes roslaunch openni2_launch openni2.launch works, while most of the time it gives me the following error:

┌┌(kota@kota-desktop)-(12:10pm-:-03/06)┌-¨-¨¨˙
└┌(data)┌¨˙roslaunch openni2_launch openni2.launch
... logging to /home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/roslaunch-kota-desktop-29242.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://kota-desktop:32950/

SUMMARY
========

PARAMETERS
* /camera/camera_nodelet_manager/num_worker_threads: 4
* /camera/depth_rectify_depth/interpolation: 0
* /camera/driver/auto_exposure: True
* /camera/driver/auto_white_balance: True
* /camera/driver/color_depth_synchronization: False
* /camera/driver/depth_camera_info_url:
* /camera/driver/depth_frame_id: camera_depth_opti...
* /camera/driver/depth_registration: False
* /camera/driver/device_id: #1
* /camera/driver/rgb_camera_info_url:
* /camera/driver/rgb_frame_id: camera_rgb_optica...
* /rosdistro: kinetic
* /rosversion: 1.12.6

NODES
/camera/
    camera_nodelet_manager (nodelet/nodelet)
    depth_metric (nodelet/nodelet)
    depth_metric_rect (nodelet/nodelet)
    depth_points (nodelet/nodelet)
    depth_rectify_depth (nodelet/nodelet)
    depth_registered_sw_metric_rect (nodelet/nodelet)
    driver (nodelet/nodelet)
    points_xyzrgb_sw_registered (nodelet/nodelet)
    register_depth_rgb (nodelet/nodelet)
    rgb_rectify_color (nodelet/nodelet)
/
    camera_base_link (tf2_ros/static_transform_publisher)
    camera_base_link1 (tf2_ros/static_transform_publisher)
    camera_base_link2 (tf2_ros/static_transform_publisher)
    camera_base_link3 (tf2_ros/static_transform_publisher)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[camera/camera_nodelet_manager-1]: started with pid [29260]
process[camera/driver-2]: started with pid [29261]
process[camera/rgb_rectify_color-3]: started with pid [29262]
process[camera/depth_rectify_depth-4]: started with pid [29263]
process[camera/depth_metric_rect-5]: started with pid [29272]
process[camera/depth_metric-6]: started with pid [29286]
process[camera/depth_points-7]: started with pid [29300]
[ INFO] [1488821141.153037053]: Initializing nodelet with 4 worker threads.
process[camera/register_depth_rgb-8]: started with pid [29323]
process[camera/points_xyzrgb_sw_registered-9]: started with pid [29342]
process[camera/depth_registered_sw_metric_rect-10]: started with pid [29346]
process[camera_base_link-11]: started with pid [29360]
process[camera_base_link1-12]: started with pid [29376]
process[camera_base_link2-13]: started with pid [29392]
process[camera_base_link3-14]: started with pid [29409]
OpenNI2-FreenectDriver: Using libfreenect v0.5.5
OpenNI2-FreenectDriver: Found device freenect://0
[ INFO] [1488821142.943549346]: Device "freenect://0" found.
OpenNI2-FreenectDriver: Opening device freenect://0
[ERROR] [1488821143.690497721]: Unsupported IR video mode - Resolution: 640x480@30Hz Format: Gray16
[Stream 80] Negotiated packet size 1920
write_register: 0x000c <= 0x00
write_register: 0x000d <= 0x01
write_register: 0x000e <= 0x1e
write_register: 0x0005 <= 0x01
write_register: 0x0047 <= 0x00
[Stream 70] Negotiated packet size 1920
write_register: 0x0105 <= 0x00
write_register: 0x0006 <= 0x00
write_register: 0x0012 <= 0x03
write_register: 0x0013 <= 0x01
write_register: 0x0014 <= 0x1e
write_register: 0x0006 <= 0x02
write_register: 0x0017 <= 0x00
read_cmos_register: 0x0106 => 0x648e
write_cmos_register: 0x0106 <= 0x648e
[ERROR] [1488821145.740494035]: Could not set auto exposure. Reason: void openni2_wrapper::OpenNI2Device::setAutoExposure(bool) @ /tmp/binarydeb/ros-kinetic-openni2-camera-0.2.7/src/openni2_device.cpp @ 534 : Couldn't set auto exposure:
        Stream setProperty(101) failed



read_cmos_register: 0x0106 => 0x648e
write_cmos_register: 0x0106 <= 0x648e
[ERROR] [1488821145.748960801]: Could not set auto white balance. Reason: void openni2_wrapper::OpenNI2Device::setAutoWhiteBalance(bool) @ /tmp/binarydeb/ros-kinetic-openni2-camera-0.2.7/src/openni2_device.cpp @ 550 : Couldn't set auto white balance:
        Stream setProperty(100) failed



[FATAL] [1488821145.881735575]: Failed to load nodelet '/camera/depth_registered_sw_metric_rect` of type `depth_image_proc/convert_metric` to manager `camera_nodelet_manager'
[FATAL] [1488821145.881735671]: Failed to load nodelet '/camera/points_xyzrgb_sw_registered` of type `depth_image_proc/point_cloud_xyzrgb` to manager `camera_nodelet_manager'
[FATAL] [1488821145.881735666]: Failed to load nodelet '/camera/depth_rectify_depth` of type `image_proc/rectify` to manager `camera_nodelet_manager'
[FATAL] [1488821145.881782437]: Failed to load nodelet '/camera/depth_metric` of type `depth_image_proc/convert_metric` to manager `camera_nodelet_manager'
[FATAL] [1488821145.881807868]: Failed to load nodelet '/camera/depth_points` of type `depth_image_proc/point_cloud_xyz` to manager `camera_nodelet_manager'
[FATAL] [1488821145.881846439]: Failed to load nodelet '/camera/driver` of type `openni2_camera/OpenNI2DriverNodelet` to manager `camera_nodelet_manager'
[FATAL] [1488821145.881858899]: Failed to load nodelet '/camera/rgb_rectify_color` of type `image_proc/rectify` to manager `camera_nodelet_manager'
[FATAL] [1488821145.882021624]: Failed to load nodelet '/camera/register_depth_rgb` of type `depth_image_proc/register` to manager `camera_nodelet_manager'
[camera/camera_nodelet_manager-1] process has died [pid 29260, exit code -11, cmd /opt/ros/kinetic/lib/nodelet/nodelet manager __name:=camera_nodelet_manager __log:=/home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-camera_nodelet_manager-1.log].
log file: /home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-camera_nodelet_manager-1*.log
[camera/depth_rectify_depth-4] process has died [pid 29263, exit code 255, cmd /opt/ros/kinetic/lib/nodelet/nodelet load image_proc/rectify camera_nodelet_manager --no-bond image_mono:=depth/image_raw image_rect:=depth/image_rect_raw __name:=depth_rectify_depth __log:=/home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-depth_rectify_depth-4.log].
log file: /home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-depth_rectify_depth-4*.log
[camera/driver-2] process has died [pid 29261, exit code 255, cmd /opt/ros/kinetic/lib/nodelet/nodelet load openni2_camera/OpenNI2DriverNodelet camera_nodelet_manager ir:=ir rgb:=rgb depth:=depth depth_registered:=depth_registered rgb/image:=rgb/image_raw depth/image:=depth_registered/image_raw __name:=driver __log:=/home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-driver-2.log].
log file: /home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-driver-2*.log
[camera/rgb_rectify_color-3] process has died [pid 29262, exit code 255, cmd /opt/ros/kinetic/lib/nodelet/nodelet load image_proc/rectify camera_nodelet_manager --no-bond image_mono:=rgb/image_raw image_rect:=rgb/image_rect_color __name:=rgb_rectify_color __log:=/home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-rgb_rectify_color-3.log].
log file: /home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-rgb_rectify_color-3*.log
[camera/depth_metric-6] process has died [pid 29286, exit code 255, cmd /opt/ros/kinetic/lib/nodelet/nodelet load depth_image_proc/convert_metric camera_nodelet_manager --no-bond image_raw:=depth/image_raw image:=depth/image __name:=depth_metric __log:=/home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-depth_metric-6.log].
log file: /home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-depth_metric-6*.log
[camera/depth_points-7] process has died [pid 29300, exit code 255, cmd /opt/ros/kinetic/lib/nodelet/nodelet load depth_image_proc/point_cloud_xyz camera_nodelet_manager --no-bond image_rect:=depth/image_rect_raw points:=depth/points __name:=depth_points __log:=/home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-depth_points-7.log].
log file: /home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-depth_points-7*.log
[camera/register_depth_rgb-8] process has died [pid 29323, exit code 255, cmd /opt/ros/kinetic/lib/nodelet/nodelet load depth_image_proc/register camera_nodelet_manager --no-bond rgb/camera_info:=rgb/camera_info depth/camera_info:=depth/camera_info depth/image_rect:=depth/image_rect_raw depth_registered/image_rect:=depth_registered/sw_registered/image_rect_raw __name:=register_depth_rgb __log:=/home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-register_depth_rgb-8.log].
log file: /home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-register_depth_rgb-8*.log
[camera/points_xyzrgb_sw_registered-9] process has died [pid 29342, exit code 255, cmd /opt/ros/kinetic/lib/nodelet/nodelet load depth_image_proc/point_cloud_xyzrgb camera_nodelet_manager --no-bond rgb/image_rect_color:=rgb/image_rect_color rgb/camera_info:=rgb/camera_info depth_registered/image_rect:=depth_registered/sw_registered/image_rect_raw depth_registered/points:=depth_registered/points __name:=points_xyzrgb_sw_registered __log:=/home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-points_xyzrgb_sw_registered-9.log].
log file: /home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-points_xyzrgb_sw_registered-9*.log
[camera/depth_registered_sw_metric_rect-10] process has died [pid 29346, exit code 255, cmd /opt/ros/kinetic/lib/nodelet/nodelet load depth_image_proc/convert_metric camera_nodelet_manager --no-bond image_raw:=depth_registered/sw_registered/image_rect_raw image:=depth_registered/sw_registered/image_rect __name:=depth_registered_sw_metric_rect __log:=/home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-depth_registered_sw_metric_rect-10.log].
log file: /home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/camera-depth_registered_sw_metric_rect-10*.log

When it works, it retains the [ERROR] tags but not the [FATAL]:

┌┌(kota@kota-desktop)-(12:40pm-:-03/06)┌-¨-¨¨˙
└┌(data)┌¨˙roslaunch openni2_launch openni2.launch
... logging to /home/kota/.ros/log/e2541e38-0291-11e7-bd4e-64006a58bea8/roslaunch-kota-desktop-31397.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://kota-desktop:43550/

SUMMARY
========

PARAMETERS
* /camera/camera_nodelet_manager/num_worker_threads: 4
* /camera/depth_rectify_depth/interpolation: 0
* /camera/driver/auto_exposure: True
* /camera/driver/auto_white_balance: True
* /camera/driver/color_depth_synchronization: False
* /camera/driver/depth_camera_info_url:
* /camera/driver/depth_frame_id: camera_depth_opti...
* /camera/driver/depth_registration: False
* /camera/driver/device_id: #1
* /camera/driver/rgb_camera_info_url:
* /camera/driver/rgb_frame_id: camera_rgb_optica...
* /rosdistro: kinetic
* /rosversion: 1.12.6

NODES
/camera/
    camera_nodelet_manager (nodelet/nodelet)
    depth_metric (nodelet/nodelet)
    depth_metric_rect (nodelet/nodelet)
    depth_points (nodelet/nodelet)
    depth_rectify_depth (nodelet/nodelet)
    depth_registered_sw_metric_rect (nodelet/nodelet)
    driver (nodelet/nodelet)
    points_xyzrgb_sw_registered (nodelet/nodelet)
    register_depth_rgb (nodelet/nodelet)
    rgb_rectify_color (nodelet/nodelet)
/
    camera_base_link (tf2_ros/static_transform_publisher)
    camera_base_link1 (tf2_ros/static_transform_publisher)
    camera_base_link2 (tf2_ros/static_transform_publisher)
    camera_base_link3 (tf2_ros/static_transform_publisher)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[camera/camera_nodelet_manager-1]: started with pid [31416]
process[camera/driver-2]: started with pid [31417]
process[camera/rgb_rectify_color-3]: started with pid [31418]
process[camera/depth_rectify_depth-4]: started with pid [31419]
process[camera/depth_metric_rect-5]: started with pid [31435]
process[camera/depth_metric-6]: started with pid [31445]
process[camera/depth_points-7]: started with pid [31453]
process[camera/register_depth_rgb-8]: started with pid [31461]
process[camera/points_xyzrgb_sw_registered-9]: started with pid [31472]
[ INFO] [1488822043.687098396]: Initializing nodelet with 4 worker threads.
process[camera/depth_registered_sw_metric_rect-10]: started with pid [31496]
process[camera_base_link-11]: started with pid [31505]
process[camera_base_link1-12]: started with pid [31515]
process[camera_base_link2-13]: started with pid [31538]
process[camera_base_link3-14]: started with pid [31550]
OpenNI2-FreenectDriver: Using libfreenect v0.5.5
OpenNI2-FreenectDriver: Found device freenect://0
[ INFO] [1488822045.169854398]: Device "freenect://0" found.
OpenNI2-FreenectDriver: Opening device freenect://0
[ERROR] [1488822045.942122221]: Unsupported IR video mode - Resolution: 640x480@30Hz Format: Gray16
[Stream 80] Negotiated packet size 1920
write_register: 0x000c <= 0x00
write_register: 0x000d <= 0x01
write_register: 0x000e <= 0x1e
write_register: 0x0005 <= 0x01
write_register: 0x0047 <= 0x00
[Stream 70] Negotiated packet size 1920
write_register: 0x0105 <= 0x00
write_register: 0x0006 <= 0x00
write_register: 0x0012 <= 0x03
write_register: 0x0013 <= 0x01
write_register: 0x0014 <= 0x1e
write_register: 0x0006 <= 0x02
write_register: 0x0017 <= 0x00
read_cmos_register: 0x0106 => 0x648e
write_cmos_register: 0x0106 <= 0x648e
[ERROR] [1488822048.721591875]: Could not set auto exposure. Reason: void openni2_wrapper::OpenNI2Device::setAutoExposure(bool) @ /tmp/binarydeb/ros-kinetic-openni2-camera-0.2.7/src/openni2_device.cpp @ 534 : Couldn't set auto exposure:
        Stream setProperty(101) failed



read_cmos_register: 0x0106 => 0x648e
write_cmos_register: 0x0106 <= 0x648e
[ERROR] [1488822048.733462551]: Could not set auto white balance. Reason: void openni2_wrapper::OpenNI2Device::setAutoWhiteBalance(bool) @ /tmp/binarydeb/ros-kinetic-openni2-camera-0.2.7/src/openni2_device.cpp @ 550 : Couldn't set auto white balance:
        Stream setProperty(100) failed



[ INFO] [1488822081.765964717]: Starting depth stream.
[ INFO] [1488822179.778566210]: Starting color stream.

It's literally that sometimes it works and sometimes it doesn't; seems to be mostly up to chance. NiViewer2 doesn't have any issues like this which makes me think it's something about the way the ros nodelets are being initialized rather than a problem with the openni2 driver.

I'm running Ubuntu 16.04 x86_64 and ROS Kinetic.

Any help or insight would be appreciated! Thanks! :)