0
$\begingroup$

I would like to record ros2 bag using node(python) and that should subscribe to several topics of different message types, may i know, how to to do that without using loops.

I would like to record like as below, but from multiple topics. Each subscription of all topics to be at same time stamp. https://docs.ros.org/en/humble/Tutorials/Advanced/Recording-A-Bag-From-Your-Own-Node-Py.html

$\endgroup$
3
  • $\begingroup$ Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. $\endgroup$
    – Community Bot
    Commented Dec 1, 2023 at 8:38
  • $\begingroup$ Welcome to Robotics Stack Exchange! "...without using loops" what does it mean? $\endgroup$
    – ravi
    Commented Dec 2, 2023 at 13:34
  • $\begingroup$ I was trying like this to accomodate multiple topics. ` def setup_subscriptions(self): topics_and_types = { '/topic1': 'your_message_type1', '/topic2': 'your_message_type2', '/topic3': 'your_message_type3', } for topic, msg_type in topics_and_types.items(): self.create_subscription( msg_type=msg_type, topic=topic, callback=self.message_callback, ) ` $\endgroup$ Commented Dec 3, 2023 at 16:38

1 Answer 1

1
$\begingroup$

After trying to do it myself, and inspecting the source code for the Writer classes in ros2bag_py library, it looks like it's just not possible. Did you manage to do it?

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.