0

有没有办法自动连续运行这些命令?

roscd stereo_camera
rosparam load marvin_cameras.yaml
rosrun stereo_camera stereo_camera __name:=bumblebeeLeft
rosrun stereo_camera stereo_camera __name:=bumblebeeCenter

roslaunch openni_launch_marvin kinect_left.launch
roslaunch openni_launch_marvin kinect_center.launch 
4

1 回答 1

0

您可以编写一个启动文件来运行所需的节点/启动文件,延迟如here所述,或者您可以只编写一个如下所示的 bash 脚本:

#!/bin/bash
roscd stereo_camera
rosparam load marvin_cameras.yaml
rosrun stereo_camera stereo_camera __name:=bumblebeeLeft &
rosrun stereo_camera stereo_camera __name:=bumblebeeCenter &
roslaunch openni_launch_marvin kinect_left.launch &
roslaunch openni_launch_marvin kinect_center.launch &
wait

假设您的脚本名为script.sh,您必须通过使其可执行chmod +x script.sh,然后通过 运行它./script.sh。标志将&命令发送到后台,而wait命令等待后台的所有程序完成。

于 2018-07-28T23:43:48.247 回答