Publish value into topic

I tried to search the meaning of “-1” in the command rostopic pub -1 /pi_robot/head_pan_joint_position_controller/command std_msgs/Float64 “data: 0.7” but I couldn’t find anything. Besides, should these two commands executed together or separately in two webshells?

Hi @youngyangcs

the ‘-1’ means publishing the message once, without it you keep publishing the message until you interrupt it. In linux you can do the following for pretty much any command:
rostopic pub -h
It will show you all the arguments you can use with the command. You can add ‘-h’ behind almost everything if you want to know how to use it.

Thanks for your reply. Should these two commands executed together or separately in two webshells? Because once I run the first command, I have to terminate it to execute the second command.

Just add the -1 to both and run them after one another

Thanks for your help!

1 Like