how to add 2 or more topics in one subscriber. c++
Please can you help me with this, I am new to ROS, I tried many methods. but every time I am getting errors please help me to build a subscriber with 2 or more topics.
You cant add more than one topic in a subscriber.
You can define a custom msg(or data structure ) with all your data embedded in that topic and retrieve the data from that msg.
Please be aware of message_filters, which may allow exactly what the OP is looking for.
Such "union messages" are not necessarily the best choice, as they immediately make it impossible to use standard tools (which will not work with such a message).
I tried like like below code, i was able to get all add 2 or more topics, please can you tell me is there any error. PS I received the pub signal from both