How to put ros subscribers in a for loop?
I have multiple edges from where I'm collecting data from. I currently have only 3 edges, but wish to expand their number in future. In order to adopt that flexibility, how can I make a for loop for multiple rostopics which are indexed e1/ .. e2/... e3/.. and so on
current running code is below that I want to put in a for loop and have a single callback function.
self.e1_sub = rospy.Subscriber('/e1/edge_data', Edgedata, self.callback_e1) self.e2_sub = rospy.Subscriber('/e2/edge_data', Edgedata, self.callback_e2) self.e3_sub = rospy.Subscriber('/e3/edge_data', Edgedata, self.callback_e3)