ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Is it possible to remap topics at runtime?

asked 2012-04-12 08:02:56 -0600

updated 2012-04-12 08:51:38 -0600

I'm wondering if mappings are dynamic or handled centrally enough that it would be possible to remap a nodes topics at runtime without requiring specific support within the node.

I've seen a post on the old mailing list that suggested it was not supported, but I'm wondering more specifically if it's even feasible if one's inclined to dig below supplied tools.

Implicit question: how does remapping work under the hood?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2012-04-12 22:30:54 -0600

tfoote gravatar image

The current implementation is not capable of dynamically remapping. I don't think that there's anything technically blocking this capability, though it will take a bunch of effort to do the book keeping and subscribe and unsubscribe and everything in a thread safe manner. Also there's not really an API designed for it, but it definitely sounds like it might be a good enhancement to consider for future releases.

edit flag offensive delete link more

answered 2012-04-12 08:44:29 -0600

Using mux from the topic tools package you should be able to do what you describe. It has one output topic (which would go into your node) and multiple input topics. You can then choose which one of those gets forwarded as output.

edit flag offensive delete link more


Those would certainly work, but would add an unnecessary and potentially expensive layer. Hopefully they'll eventually be made into nodelets. But I'm more asking in a conceptual/architectural sense.

Asomerville gravatar image Asomerville  ( 2012-04-12 08:50:35 -0600 )edit

answered 2012-04-15 21:17:01 -0600

Adolfo Rodriguez T gravatar image

The closest approximation I can think of to accomplish what you want would be to create a new NodeHandle at runtime and explicitly pass remapping arguments to one of the relevant constructors. When creating/destroying NodelHandles be careful not to leave the node with a single NodeHandle whose reference count drops to zero, or your node will be shutdown.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2012-04-12 08:02:56 -0600

Seen: 3,121 times

Last updated: Apr 15 '12