OpenNI Subscription [closed]

asked 2012-09-25 20:13:50 -0600

ocli gravatar image

updated 2012-09-26 19:18:16 -0600

This is a fairly simple problem which I'm pretty sure would have been answered somewhere but can't find the solution.

One of my nodes subscribes to the Kinect OpenNI driver node's (roslaunch openni_launch openni.launch) rgb and depth topics. More often than not, when I call SIGINT on the subscribing node and restart it, the OpenNI node fails to publish any more topics. Sometimes I am given a TF transform error (require a lookup into the past) and sometimes not. Is this due to not 'flusing' the subscribed topics or something not mentioned in the tutorials?

EDIT: I am using ros fuerte on a Ubuntu 12.04 system

EDIT: After waiting it out for a while after not publishing I get this error

terminate called after throwing an instance of 'openni_wrapper::OpenNIException'
  what():  virtual void openni_wrapper::OpenNIDevice::startImageStream() @ /tmp/buildd/ros-fuerte-openni-camera-1.8.0/debian/ros-fuerte-openni-camera/opt/ros/fuerte/stacks/openni_camera/src/openni_device.cpp @ 224 : starting image stream failed. Reason: Xiron OS got an event timeout!
[camera_nodelet_manager-2] process has died [pid 7029, exit code -6, cmd /opt/ros/fuerte/stacks/nodelet_core/nodelet/bin/nodelet manager __name:=camera_nodelet_manager __log:=/home/oliver/.ros/log/d2dbb3fa-0861-11e2-a3ba-002219ebc74e/camera_nodelet_manager-2.log].
log file: /home/oliver/.ros/log/d2dbb3fa-0861-11e2-a3ba-002219ebc74e/camera_nodelet_manager-2*.log

It's a blob tracker but I've omitted the blob tracking code (doesn't affect the subscription issue), so here is my callback

void ImageCb(const sensor_msgs::ImageConstPtr &msg)
    cv_bridge::CvImagePtr cv_ptr; 
        cv_ptr = cv_bridge::toCvCopy(msg, enc::BGR8);
    catch (cv_bridge::Exception& e)
        ROS_ERROR("cv_bridge exception: %s", e.what());
        IplImage *imageBGR,*imageHSV,temp;

        imageBGR = cvCreateImage( size , IPL_DEPTH_8U, 3);
    imageHSV = cvCreateImage( size , IPL_DEPTH_8U, 3);

        temp =  (cv_ptr->image.operator IplImage());
        imageBGR = cvCloneImage( &temp );
        cvCvtColor(imageBGR, imageHSV, CV_BGR2HSV); //takes up memory?

    cvSetMouseCallback( ORIGINAL, my_mouse_callback, (void*) imageHSV );

        if (drawing_box_){
          cvSetImageROI( imageBGR, box );
          cvXorS( imageBGR, cvScalarAll(255), imageBGR, 0 );
          cvResetImageROI( imageBGR );

        //call blob tracker for each blob
        for (unsigned ci = 0; ci < blob_tracker.size() ; ci++){
            imageBGR = ShowROI(blob_tracker[ci], imageBGR);

        cvShowImage(ORIGINAL, imageBGR);
        cvReleaseImage( &imageBGR );
        cvReleaseImage( &imageHSV );

and the main function

int main(int argc, char ** argv)
    //ros initialisations
        ros::init(argc, argv, "image_converter");
        ros::NodeHandle main_nh_;
    ros::Rate loop_rate(20);
        image_transport::ImageTransport main_it_(main_nh_);
    image_transport::Subscriber main_image_sub_ = main_it_.subscribe("/camera/rgb/image_color", 1, &ImageCb);

        cout << "Click the RGB image to track a colour blob" << endl << endl;

    while (ros::ok()){

        return 0;
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2015-06-30 19:00:54.043110


We could be more helpful if you tell us what versions of Operative System and ROS distribution you are using. OpenNI is being kind of unstable right now in ROS Fuerte.

Martin Peris gravatar image Martin Peris  ( 2012-09-26 00:11:22 -0600 )edit

updated that information

ocli gravatar image ocli  ( 2012-09-26 02:18:19 -0600 )edit

Are you using your own mechanism to catch the SIGINT or is that just a standard ROS node? Maybe you could provide a code so we could run it overhere.

dejanpan gravatar image dejanpan  ( 2012-09-26 07:31:38 -0600 )edit

standard ROS node to my understanding. Got an error message this time, and updated more information

ocli gravatar image ocli  ( 2012-09-26 19:18:54 -0600 )edit

On a related topic, what is this 'nodelet' thing? When I instantiate new blob tracker's the nodelet cpu usage skyrockets

ocli gravatar image ocli  ( 2012-09-27 06:30:08 -0600 )edit

what happens when you use the command line tool to subscribe to a topic of the openni_launch node more than one time? (e.g. $rostopic hz /camera/depth_registered/points )

dinamex gravatar image dinamex  ( 2012-09-30 09:56:47 -0600 )edit

can subscribe to more than one at a time, but when you un-subscribe, then re-subscribe, the error happens again.

ocli gravatar image ocli  ( 2012-09-30 17:15:26 -0600 )edit

I have kind of the same issue under electric & ubuntu 11.10 too. I have the feeling that it could be something with the EMI which disconnects trhe device from the USB-Hub after closing it once...

dinamex gravatar image dinamex  ( 2012-10-01 05:31:41 -0600 )edit