ros-melodic 开机启动工具 robot-upstart

ros-melodic 开机启动工具 robot-upstart

安装 robot-upstart

使用命令 sudo apt install ros-melodic-robot-upstart 安装 robot-upstart工具包

xx@robot:~$ sudo apt install ros-melodic-robot-upstart 
[sudo] password for xx: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libllvm7 linux-headers-5.0.0-32 linux-headers-5.0.0-32-generic linux-image-5.0.0-32-generic
  linux-modules-5.0.0-32-generic linux-modules-extra-5.0.0-32-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  daemontools
Suggested packages:
  daemontools-run | runit
The following NEW packages will be installed:
  daemontools ros-melodic-robot-upstart
0 upgraded, 2 newly installed, 0 to remove and 336 not upgraded.
Need to get 77.9 kB of archives.
After this operation, 427 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrors.huaweicloud.com/repository/ubuntu bionic/universe amd64 daemontools amd64 1:0.76-6.1 [57.7 kB]
Get:2 http://packages.ros.org/ros/ubuntu bionic/main amd64 ros-melodic-robot-upstart amd64 0.3.0-0bionic.20191008.213317 [20.2 kB]
Fetched 77.9 kB in 1s (76.8 kB/s)                                                        
Selecting previously unselected package daemontools.
(Reading database ... 334127 files and directories currently installed.)
Preparing to unpack .../daemontools_1%3a0.76-6.1_amd64.deb ...
Unpacking daemontools (1:0.76-6.1) ...
Selecting previously unselected package ros-melodic-robot-upstart.
Preparing to unpack .../ros-melodic-robot-upstart_0.3.0-0bionic.20191008.213317_amd64.deb ...
Unpacking ros-melodic-robot-upstart (0.3.0-0bionic.20191008.213317) ...
Setting up daemontools (1:0.76-6.1) ...
Setting up ros-melodic-robot-upstart (0.3.0-0bionic.20191008.213317) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

安装开机启动配置

使用命令 rosrun robot_upstart install 配置

xx@robot:~$ rosrun robot_upstart install --user root --setup /home/xx/ros_ws/install/setup.bash xx_msgs/launch/chassis_start.launch --logdir /home/xx/logs
/lib/systemd/systemd
Preparing to install files to the following paths:
  /etc/ros/melodic/xx.d/.installed_files
  /etc/ros/melodic/xx.d/chassis_start.launch
  /etc/systemd/system/multi-user.target.wants/xx.service
  /lib/systemd/system/xx.service
  /usr/sbin/xx-start
  /usr/sbin/xx-stop
Now calling: /usr/bin/sudo /opt/ros/melodic/lib/robot_upstart/mutate_files
Filesystem operation succeeded.
** To complete installation please run the following command:
 sudo systemctl daemon-reload && sudo systemctl start xx
xx@robot:~$  sudo systemctl daemon-reload
xx@robot:~$ sudo systemctl start xx^C
xx@robot:~$ sudo reboot

上面我取消了sudo systemctl start xx 这个命令是不重启,生效。 我选择了马上重启。
这样可以使用如下命令开启或停止服务:

停止服务 `sudo service xx stop`
启动服务 `sudo service xx start`

卸载开机启动配置

使用命令 rosrun robot_upstart uninstall 卸载

xx@robot:~$ rosrun robot_upstart uninstall xx
/lib/systemd/systemd
Preparing to remove the following paths:
  /etc/ros/melodic/xx.d
  /etc/ros/melodic/xx.d/.installed_files
  /etc/ros/melodic/xx.d/chassis_start.launch
  /etc/systemd/system/multi-user.target.wants/xx.service
  /lib/systemd/system/xx.service
  /usr/sbin/xx-start
  /usr/sbin/xx-stop
WARNING: Package name "ls01B" does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes.
WARNING: Package name "ls01B" does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits, underscores, and dashes.
Now calling: /usr/bin/sudo /opt/ros/melodic/lib/robot_upstart/mutate_files
[sudo] password for xx: 
Filesystem operation succeede

你可能感兴趣的:(ros-melodic 开机启动工具 robot-upstart)