Publish unknown number of topics?
Hello,
I'm trying to adapt the Euclidean Cluster Extraction tutorial from PCL to work with ROS.
I can get the tutorial working as it should, my question is with handling the detected clusters.
My idea was to publish each cluster in a different topic so I can look at them separately in rviz. My question is how can I do that?
Currently I'm creating one publisher as a global variable, and using nodehandle.advertise<sensor_msgs::PointCloud2>()
in main()
to create a topic and publish on it. This means that I can only publish only one pointcloud through this.
Is it possible to create a number of publishers, unknown at compile time, since I don't know how many objects will be detected, that each publish on a different topic?
How else would you recommend I use/view the vector of PointClouds that get created by the cluster extraction? The tutorial extracts them to files, but I would rather view them in rviz somehow.