πŸ—οΈHow to publish message to a topic from command line?

To publish a message to a topic, we can use the following command:

ros2 topic pub --once <topic> <message-type> "<data>"

To publish message to a topic at a fixed rate, use the following command:

ros2 topic pub -r <rate> <topic> <message-type> "<data>"

Last updated