有没有办法自动连续运行这些命令?
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
答案 0 :(得分: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
命令将等待直到后台的所有程序完成。