Create publishers/subscribers dynamically
How can I create subscribers dynamically?
Please see comment on the answer to this question: programatically create subscribers
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
How can I create subscribers dynamically?
Please see comment on the answer to this question: programatically create subscribers
If you know the datatype(s) ahead of time you can make it happen without too much problem.
In Python if you do not know the datatypes you can attempt to import the modules at run time. There have also been demonstrations of dynamic code generation based on the message definition passed during the connection negotiation. The latter approach is more generic but you will have to dig deep inside the modules away from the supported API. The former has the limitation of only working if the messages are already generated on the receiving machine.
I would not recommend attempting this in c++
Thank you for your reply. I have been trying to think how a truly dynamic subscription/publication can happen. I am not going to try this in C++. I think it might end quite disastrously. I am using python and I am trying a simple workaround for now (I can describe this in detail if needed).
I was also looking at rosbridge_library, which is exactly what I need: Send the topic name, topic type as strings and establish a sub/pub. The main aim of what I am trying to do is create a highly easy to use, plug and play multi-master ROS using PEIS. I am sure it is an astronomical task
@McMurdo, did you manage to implement something resembling "dynamic subscription/publication"? Can you give some details? I'm trying to do something similar.
Asked: 2014-05-31 08:40:31 -0500
Seen: 1,812 times
Last updated: May 31 '14