How to subscribe to uknown amount of topics with unknown type.
I am trying to make a lognode which reads the available topics and types, use this information in a GUI to select the topics you want to save. After the selection of topics I would like to subscribe to these topics and save the data in a .csv file.
I have been searching for a while how to subscribe to an unknown amount of topics with unknown types. Does anyone have ever made it or knows how to do this to get me in the right direction!
For example from the tutorials:
void chatterCallback(const std_msgs::String::ConstPtr& msg)
{
ROS_INFO("I heard: [%s]", msg->data.c_str());
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "listener");
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback);
ros::spin();
return 0;
}
Do I have to make an uknown amound of void newCallbacks? Or can I do this anotherway? If we can make an uknown amount of callbacks for an unkown topic and type, how can I do this?
I hope my question is clear! If not, please ask! Thanks in advance.