Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rostopic pub can not parse a nested message format with spaces and indets from roslaunch #2349

Open
robograffitti opened this issue Sep 25, 2023 · 0 comments

Comments

@robograffitti
Copy link

robograffitti commented Sep 25, 2023

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 &quot;{'seq': 0, 'stamp':{'secs': 0, 'nsecs': 0}, 'frame_id':'map'}&quot;" />

However, this one does not work if I put any spaces:

  <node name="initialpose_publisher" pkg="rostopic" type="rostopic" output="screen"
  	launch-prefix="bash -c 'sleep $(arg node_start_delay); $0 $@' "
        args="pub -s /initialpose geometry_msgs/PoseWithCovarianceStamped &quot;{'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]}}&quot;" />

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant