ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
![]() | 1 | initial version |
It says right in the error what went wrong.
rostopic: error: Argument error: while scanning a plain scalar
in "<string>", line 1, column 16:
{layout:{dim:[{label:'', size:0, stride:0}], da ...
^
found unexpected ':'
in "<string>", line 1, column 21:
{layout:{dim:[{label:'', size:0, stride:0}], data_of ...
This is saying that you need surround each one of your keys in single quotes '
. What you should be typing is this:
rostopic pub motor/speed std_msgs/Int16MultiArray "{'layout':{'dim':[{'label':'', 'size':0, 'stride':0}], 'data_offset':0}, 'data':[64, 64]}"
![]() | 2 | No.2 Revision |
It says right in the error what went wrong.
rostopic: error: Argument error: while scanning a plain scalar
in "<string>", line 1, column 16:
{layout:{dim:[{label:'', size:0, stride:0}], da ...
^
found unexpected ':'
in "<string>", line 1, column 21:
{layout:{dim:[{label:'', size:0, stride:0}], data_of ...
This is saying that you need surround each one of your keys in single quotes '
. What you should be typing is this:
rostopic pub motor/speed std_msgs/Int16MultiArray "{'layout':{'dim':[{'label':'', 'size':0, 'stride':0}], 'data_offset':0}, 'data':[64, 64]}"
A useful tip is that you should be using the tab autocomplete. If you use that, it will fill in the message with a nicely formatted YAML string like so:
$ rostopipub motor/speed std_msgs/Int16MultiArray "layout:
dim:
- label: ''
size: 0
stride: 0
data_offset: 0
data:
- 0"
Then you can go into the string itself and enter your data.
![]() | 3 | No.3 Revision |
It says right in the error what went wrong.
rostopic: error: Argument error: while scanning a plain scalar
in "<string>", line 1, column 16:
{layout:{dim:[{label:'', size:0, stride:0}], da ...
^
found unexpected ':'
in "<string>", line 1, column 21:
{layout:{dim:[{label:'', size:0, stride:0}], data_of ...
This is saying that you need surround each one of your keys in single quotes put a space between the colon '
. :
and the value. What you should be typing is this:
rostopic pub motor/speed std_msgs/Int16MultiArray "{'layout':{'dim':[{'label':'', 'size':0, 'stride':0}], 'data_offset':0}, 'data':[64, "{layout: {dim: [{label: '', size: 0, stride: 0}], data_offset: 0}, data: [64, 64]}"
A useful tip is that you should be using the tab autocomplete. If you use that, it will fill in the message with a nicely formatted YAML string like so:
$ rostopipub motor/speed std_msgs/Int16MultiArray "layout:
dim:
- label: ''
size: 0
stride: 0
data_offset: 0
data:
- 0"
Then you can go into the string itself and enter your data.
Edit: I originally stated that single quotes were needed around the keys, this is actually incorrect.