1.概述
寫了這麼多ros的launch指令碼,怎麼才能開機就啟動呢,本文介紹1種方法,使用ros的 robot_upstart包,下面以pibot_bringuppackage的·bringup.launch`演示
2.robot_upstart包
2.1 安裝
使用pibot_install_ros.sh一鍵安裝工具即可安裝所有pibot所需要的ros包,如需單獨安裝sudo apt-get install ros--robot-upstart
ros_dist即為indigo或者kinetic
2.2 設定
rosrun robot_upstart install pibot_bringup/launch/bringup.launch
pibot@pibot-desktop:
~$ rosrun robot_upstart install pibot_bringup/launch/bringup.launch
/lib/systemd/systemd
preparing to install files to the following paths:
/etc/ros/kinetic/pibot.d/
.installed_files
/etc/ros/kinetic/pibot.d/bringup.launch
/etc/systemd/system/multi-user.target.wants/pibot.service
/lib/systemd/system/pibot.service
/usr/sbin/pibot-start
/usr/sbin/pibot-stop
now calling:
/usr/bin/sudo /opt/ros/kinetic/lib/robot_upstart/mutate_files
filesystem operation succeeded.**
to complete installation please run the following command:
sudo systemctl daemon-reload && sudo systemctl start pibot
照著提示操作
sudo systemctl daemon-reload && sudo systemctl start pibot
2.3 測試
ps -aux |
grep pibot_bringup
檢視程序
pibot@pibot-desktop:~/pibot_ros$ ps -aux |
grep pibot_bringup
pibot 15971 96.3 0.7 85620 7488 ? rsl 23:26 1:13 /home/pibot/pibot_ros/ros_ws/devel/lib/pibot_bringup/pibot_driver __name:=pibot_driver __log:=/tmp/0656ed38-5ba5-11e9-be9a-b827ebff3168/pibot_driver-2.log
已經可以查到該程序了
rosnode list
檢視node
pibot@pibot-desktop:~$ rosnode list
/pibot_driver
/rosout
也可以看到2個node
roslaunch pibot keyboard_teleop.launch
啟動鍵盤控制程式,也可以支援控制小車了
為了驗證程式是否開啟啟動了,重啟後再次重複2.3的測試步驟即可
2.4 停止以及取消開機啟動
啟動&停止
sudo
service pibot start
sudo
service pibot stop
取消
rosrun robot_upstart uninstall pibot
3 robot_upstart服務名稱可以看到上面的service名稱為pibot,通過檢視原始碼可以看到
job_name取了包名的下劃線前面的對pibot_bringup取了pibot
我們稍作修改
新增乙個引數指定服務名稱
對於上面我追加乙個引數pibot_bringup
rosrun robot_upstart install pibot_bringup/launch/bringup.launch pibot_bringup
pibot@pibot-desktop:~$ rosrun robot_upstart install pibot_bringup/launch/bringup.launch pibot_bringup
/lib/systemd/systemd
preparing to install files to the following paths:
/etc/ros/kinetic/pibot_bringup.d/.installed_files
/etc/ros/kinetic/pibot_bringup.d/bringup.launch
/etc/systemd/system/multi-user.target.wants/pibot_bringup.service
/lib/systemd/system/pibot_bringup.service
/usr/sbin/pibot_bringup-start
/usr/sbin/pibot_bringup-stop
now calling: /usr/bin/sudo /opt/ros/kinetic/lib/robot_upstart/mutate_files
filesystem operation succeeded.
** to complete installation please run the following command:
sudo systemctl daemon-reload &&
sudo systemctl start pibot_bringup
我們就可以使用sudo service pibot_bringup start啟動服 開機自啟動程式
昨天做了個brew開機自啟動的demo,在此記下該程式的要點。brew平台可以做到開機就自啟動brew 應用,這需要在mif中做如下設定 增加乙個notification aeeclsid shell 設定notififer aeeclsid shell 設定mask nmask shell ini...
delphi開機自啟動程式
1.首先引入registry,shellapi這2個單元 2.如下 是專案中的一段開機自啟動程式 procedure setautorun ok boolean varreg tregistry ob isuperobject begin reg tregistry.create tryob so ...
linux ubuntu 程式開機自啟動
編輯rc local.service檔案sudo vi lib systemd system rc local.service 在檔案的最後新增 install wantedby multi user.target alias rc local.service儲存並退出。轉到rc local.ser...