ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Actually this works, also not sure I the right way to do it.

ros::Subscriber spool [20];
    string strings[20] =             //string storage
    {
    [0] = "topic_0",
    [1] = "topic_1",
    [2] = "topic_2",
    [3] = "topic_3",
    ...
    }
    ros::NodeHandle nh_;

    for(int i = 0; i<20; i++){
        spool[i] = nh_.subscribe(strings[i], 300, callback);
    }
   //dedicated spinner thread, could also simply be: while(ros::ok()) ros::spin();
   tpool[pool++] = boost::thread(spinner);