Ask Your Question
0

Assertion Failed when trying to publish on a ROS topic

asked 2013-06-18 03:35:57 -0600

DwProd gravatar image

updated 2014-01-28 17:16:56 -0600

ngrennan gravatar image

Hello there,

I'm building a generic bridge from YARP to ROS and I'm facing a little issue when dealing with the ROS->YARP side of the bridge. I basically launch two std::thread, and each thread either writes or read data using a POSIX pipe. The issue is that I'm getting a pretty weird error when trying to initialize the ROS node inside the "writing" thread. My program goes something like this :

 bool FRBridge::run()
{
    std::thread tWrite(&FRBridge::writeData,this);
    std::thread tRead(&FRBridge::readRosData,this);
    tWrite.join();
    tRead.join();
    return true;
}

bool FRImageBridge::writeData()
{
    close(fd[P_READ]);
    if ( (fromRosPipe = fdopen(fd[P_WRITE],"w")) == NULL )
    {
        cerr << "Fdopen (Write)" << endl;
        return false;
    }
    int argc = 0;
    char **argv = NULL;
    ros::init(argc,argv,"rossender");
    ros::NodeHandle n; // Program gets stuck here

    ros::Subscriber sub = n.subscribe(topicName, 10, &FRImageBridge::imageCallback,this);
    ros::spin();
    return true;
}

I have just kept the important info, please disregard the fact that the function called by a thread is from a child class. At run-time, I get this :

[FATAL] [1371562311.637421310]: ASSERTION FAILED file = /tmp/buildd/ros-groovy-roscpp-1.9.44-0precise-20130325-1240/src/libros/xmlrpc_manager.cpp line = 133 cond = bound

followed by a SIGABRT... Can I not initialize a ROS node after the beginning of the program ? I get some debugging output before

ros::NodeHandle n;

but not after...

Thanks a lot for your help !

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-02-26 00:51:14 -0600

andreas gravatar image

updated 2014-02-26 00:59:53 -0600

I had the exact same problem when running this code here

http://ftp.isr.ist.utl.pt/pub/roswiki/doc/api/yarp_to_ros_image/html/yarp__to__ros__image_8cpp_source.html

(On Fuerte)

It worked for me when compiling yarp with the standard CMakelist settings. ( Before I used the instructions here http://wiki.icub.org/wiki/YARP_ROS_In... )

Cheers, Andreas

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2013-06-18 03:35:57 -0600

Seen: 785 times

Last updated: Feb 26 '14