Did you try passing a yaml dictionnary as the help message suggests?
`ros2 topic pub /test_topic std_msgs/String "data: Hello World"`
Copied from:
```$ ros2 topic pub --help
usage: ros2 topic pub [-h] topic_name message_type [values]
Publish a message to a topic
positional arguments:
topic_name Name of the ROS topic to publish to (e.g. '/chatter')
message_type Type of the ROS message (e.g. 'std_msgs/String')
values Values to fill the message with in YAML format (e.g. "data:
Hello World"), otherwise the message will be published with
default values
```
---
[Visit Topic](
https://discourse.ros.org/t/unable-to-publish-from-command-line/2640/7) or reply to this email to respond.
If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
ros-users@lists.ros.org
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <
http://lists.ros.org/mailman//options/ros-users>