Skip to content

Instantly share code, notes, and snippets.

@ejalaa12
Created July 26, 2023 10:19
Show Gist options
  • Save ejalaa12/f17f7272d8e5bd9eee4e4a49884cbc8f to your computer and use it in GitHub Desktop.
Save ejalaa12/f17f7272d8e5bd9eee4e4a49884cbc8f to your computer and use it in GitHub Desktop.
publish ros2 msg from yaml file

Instead of typing the whole message content in command line, you can set the content in a yaml file

: msg.yaml :

x: 1.0
y: 2.0
z: 3.0

and then pass the file to the ros2 command line.

ros2 topic pub /point geometry_msgs/msg/Point "$(cat msg.yaml | yq eval -o=json)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment