1.重启脚本ros
当需要在ubuntu下,重启并启动脚本时,可以通过shell脚本来实现
新建text.sh文件
touch text.sh
在sh脚本里编写虚拟机重启之后的程序,这里是启动ros节点,
#!/bin/bash
sleep 5
killall terminator
sleep 10
terminator --title="text1" --command="bash -c 'source ~/.bashrc;source ~/catkin_ws/devel/setup.bash; roslaunch control car.launch; $SHELL'" &
sleep 10
terminator --title="text2" --command="bash -c 'source ~/.bashrc;source ~/catkin_ws/devel/setup.bash; roslaunch navigation navigation.launch; $SHELL'" &
下面也可以先用一个简单的例子来显示。在text.sh脚本添加内容。
#/bin/bash
echo "hello"
给文件添加权限:
chmod +x text.sh