When I tried to use rostopic pub from roslaunch, I found that rostopic pub could not parse a nested message format with spaces and indents.
But, it depends on depth of nests in a message.
For example, this one is OK:
<node name="header_publisher" pkg="rostopic" type="rostopic" args="pub -s /header std_msgs/Header "{'seq': 0, 'stamp':{'secs': 0, 'nsecs': 0}, 'frame_id':'map'}"" />
However, this one does not work if I put any spaces:
When I tried to use rostopic pub from roslaunch, I found that rostopic pub could not parse a nested message format with spaces and indents.
But, it depends on depth of nests in a message.
For example, this one is OK:
<node name="header_publisher" pkg="rostopic" type="rostopic" args="pub -s /header std_msgs/Header "{'seq': 0, 'stamp':{'secs': 0, 'nsecs': 0}, 'frame_id':'map'}"" />
However, this one does not work if I put any spaces:
The codes above is the working ver. When I placed some spaces and indents to improve its readability, it caused the error below.
Any work around?
Thanks.
===== Error Log =====
process[initialpose_publisher-5]: started with pid [73296] Usage: rostopic pub /topic type [args...]
rostopic: error: Argument error: while parsing a flow node expected the node content, but found ''
in "", line 1, column 2:
{
^
[initialpose_publisher-5] process has died [pid 73296, exit code 2, cmd bash -c sleep 1.0; $0 $@ /opt/ros/noetic/lib/rostopic/rostopic pub -s /initialpose geometry_msgs/PoseWithCovarianceStamped { 'header': { 'seq': 0, 'stamp': { 'secs': 0, 'nsecs': 0 }, 'frame_id': 'map' }, 'pose': { 'pose': { 'position': { 'x': 0.0, 'y': 0.0, 'z': 0.0 }, 'orientation': { 'x': 0.0, 'y': 0.0, 'z': 0.0, 'w': 1.0 } }, 'covariance': [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] } } __name:=initialpose_publisher __log:=/home/y-tanaka/.ros/log/78b350fe-5ba2-11ee-b6d5-ef45c49d4694/initialpose_publisher-5.log].
log file: /home/y-tanaka/.ros/log/78b350fe-5ba2-11ee-b6d5-ef45c49d4694/initialpose_publisher-5*.log