Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The ROS wiki gives this as an answer example.

$ rostopic pub -r 10 /cmd_vel geometry_msgs/Twist  '{linear:  {x: 0.1, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 0.0}}'

Depending on your message type you can simply follow the pattern given above; in which case you won't need -- in your command. Instead wrap the message data in single quotation marks and use the YAML map syntax. For example:

$ rostopic pub /topic package/msg_type '{x: 1, y: 2, c: a, type: string}'