How to pass inputs from bash script to a rosrun program?

asked 2021-04-28 09:03:41 -0500

Hey all,

I am trying to write a bash script to simulate user input into a rosrun package.

I'm trying to do something like this:

rosrun ros_package ros_executable

echo "input1" | ros_executable

sleep 10

echo "input2" | ros_executable

edit retag flag offensive close merge delete

Comments

it depends a bit on what you are trying to accomplish, so maybe you could elaborate on your question... In the meantime, I'll point you towards rosparam which has a commandline interface that you can use to set parameters. Else, if your ros_executable has a subscriber or service server you can use the ros cli to ping those (e.g. ros topic pub ... or ros service call .... Finally, you could write a launch file that applies the delays itself (see: #233353).

shonigmann gravatar image shonigmann  ( 2021-04-28 11:26:42 -0500 )edit