Roslaunch Using SystemD Services
I am currently having issues related to using systemd services to start launch files, roscore, etc... mainly with regard to restarting services, processes getting stuck, taking a long time to shutdown etc...
I currently have just single launch file on my robot that launches all the necessary nodes, loads URDF, etc...
To start this from boot, I am using 2 systemd services, one to start roscore and one to start the main launch file. The systemd service files for both of these services are listed below.
My main questions are:
Should I have 2 separate services, one for roscore and one for roslaunch since roslaunch will automatically start a roscore instance if one is not running?
What should I have the service file config parameters set to for Killmode, Restart, Reload, etc... ?
Any other advice for this or better ideas on how to initiate the roslaunch from startup is appreciated.
roscore.service ----------
[Unit]
Description= Ros Core Service
Wants=network-online.target
After=network.target network-online.target
[Service]
Type=simple
EnvironmentFile=
ExecStart=/usr/bin/roscore.sh
#ExecReload=/bin/kill -HUP $MAINPID
#KillMode=process
#TimeoutStopSec=3
#Restart=on-failure
#RestartSec=5
[Install]
Alias=roscore
#WantedBy=multi-user.target
automation.service----------
[Unit]
Description=Automation Service
Requires=roscore.service
[Service]
Type=idle
EnvironmentFile=
ExecStart=/usr/bin/automation.sh
#ExecReload=/bin/kill -HUP $MAINPID
#KillMode=control-group
#TimeoutStopSec=3
#Restart=on-failure
#RestartSec=5
[Install]
WantedBy=multi-user.target