overriding PublisherImpl for filtering outpout messages
Hi guys,
I am preparing some multi-robot experiments and I would like to simulate some communication loss between robots. I have one ROS node on each robot supervising the mission execution. These nodes publish some information about their own execution status to all other robots to maintain a correct execution.
The point is that I would like to filter the published messages to simulate that e.g., robot 1 can communicate with robot 2 but not with robot 3: the published message should then be sent to r2 but not to r3.
Looking at the Publisher implementation (python version), I think this is possible to implement by redefining the publish method at rospy.topics._PublisherImpl.publish and filtering correctly the set of 'connections' of the publisher to send only to the relevant subscribers.
That's where I need help: I don't see any easy way to say to the publisher that I would like to use my new ComSimulationPublisherImpl(_PublisherImpl) implementation instead of the original _PublisherImpl class... Is there an easy way to do so without having to reimplement all the rospy.topics package?
Thanks,
Charles
I thought that implementing at the publisher level would scale better than having a specific relay node and could be done much more generic as the relay node would not have to know about all the nodes I have on my system. If you think you have a well-suited design, could you give more details please