How to stop a topic from publishing in ros2 using python

hope you are doing good.
I have one question, how to stop topic in publishing in ros2 using python, or just publish one message ? Thank you

Hello @mbzuaimbzirc ,

one way to stop your publisher from publishing is by using a boolean flag. You can evaluate if your boolean variable is True or False and based on that you publish a message or not. This can be done for instance inside your timer_callback function before executing the publish() method.

You are also asking how to publish just one message but I think this is already answered in the previous question that you posted: How to publish a msg one time using ros2 in python - #2 by rzegers



1 Like

Thank you for your kind support. it really helped

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.