bash 使用shell脚本调用多个ROS启动文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24171574/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using a shell script to call multiple ROS launch files
提问by Palmer
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:
我刚刚发现明天我需要一个快速而肮脏的演示。我正在使用一个使用 ROS 的机器人,我们有一些软件包可以让它以简单的模式移动。我想用一个命令启动所有必要的节点。我需要运行的命令行——全部在单独的终端中——是:
roscore
罗斯科
rviz
维兹
roslaunch [blank move_base map]
roslaunch [空白move_base 地图]
roslaunch [package] [movement script]
roslaunch [包] [移动脚本]
rqt_graph
rqt_graph
All of these programs run indefinitely--e.g., roscoreis 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?
所有这些程序都无限期地运行——例如,roscore是一个协调其他节点的服务器。我不能只使用“&”将它们串成一行。它们每个都需要一个专用的终端窗口/进程。我怎样才能在 bash 或 Python 中做到这一点?
Note: I realize it would probably be better to use a custom ROS launch file, but I don't have time.
注意:我意识到使用自定义 ROS 启动文件可能会更好,但我没有时间。
采纳答案by konsolebox
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
你可以拥有
konsole -e command [args]
...
With gnome-terminal you do:
使用 gnome-terminal 您可以:
gnome-terminal -e command [args] &
With xterm:
使用 xterm:
xterm -e command [args] &
Probably refer as well to a similar thread: Run multiple .sh scripts from one .sh script? CentOS
也可能参考一个类似的线程:Run multiple .sh scripts from one .sh script? CentOS