roslaunch is not executed on startup because network adapter doesn't delay start
See original GitHub issueHi,
I created a launch file that runs my ROS nodes automatically, including the Master.
Firstly I added the service with robot_upstart, including my master-ip and the wlan0 interface Then I used daemon-reload and started the service. That was always working fine. However, on reboot it would never work.
service name-of-service status
helped me finding the issue: The error displayed was
root: bebop: No IP address on wlan0, cannot roslaunch.
After more debugging, there were two things I needed to do before it worked correctly:
Firstly, I needed to alter the automatically created service file in /lib/systemd/system/name-of-service.service
. I added following lines:
After=network.target
Wants=network.target
After=network-online.target
Wants=network-online.target
After adding these lines and reloading the daemon, the error persisted. As I found out, there was no service activated that delays my service. So I enabled both of these services with
sudo systemctl enable NetworkManager-wait-online.service
sudo systemctl enable systemd-networkd-wait-online.service
After reloading the deamon again, finally my service is delayed until I have a wifi connection and the lauch file is executed correctly.
Make sure every time you edit and reinstall the service, to edit the automatically created service file.
There’s not much that can be done about the disabled network waiting service, but please automatically add the four lines to the service file.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:5 (1 by maintainers)
Top GitHub Comments
Hi, adding those four lines worked at first but not after adding another user service. So eventually I changed the service file as below:
It will restart until wlan0 get data.
for me it looks like the launch file is executed before the ubuntu network stack is available at all. not specific for wifi. but could be a specific problem for me, because i source a bash file which checks the current IP, which is not available at launch.