Palmer
Palmer

Reputation: 45

Using a shell script to call multiple ROS launch files

I just found out that I need a quick-and-dirty demo for tomorrow. I'm working with a robot that uses ROS, and we have some packages that make it move in a simple pattern. I want to start all the necessary nodes with one command. The command lines I would need to run--all in separate terminals--are:

roscore

rviz

roslaunch [blank move_base map]

roslaunch [package] [movement script]

rqt_graph

All of these programs run indefinitely--e.g., roscore is a server that coordinates the other nodes. I can't just use "&" to string them together into one line. They each require a dedicated terminal window/process. How can I do that in bash or Python?

Note: I realize it would probably be better to use a custom ROS launch file, but I don't have time.

Upvotes: 4

Views: 10121

Answers (1)

konsolebox
konsolebox

Reputation: 75488

You can launch your softwares from the terminal binaries themselves to get a new terminal for each. It would depend on the terminal you use. With konsole you can have

konsole -e command [args]
...

With gnome-terminal you do:

gnome-terminal -e command [args] &

With xterm:

xterm -e command [args] &

Probably refer as well to a similar thread: Run multiple .sh scripts from one .sh script? CentOS

Upvotes: 4

Related Questions