Ubuntu 시작 프로그램2 - network 연결 후 프로그램 시작 (ROS로 로봇 자동 시작)

라우터에 연결 된 후 ROS 프로그램 시작을 위해...

2024-01-06

서론:


본론

sudo systemctl status systemd-networkd-wait-online.service 

● systemd-networkd-wait-online.service - Wait for Network to be Configured
     Loaded: loaded (/lib/systemd/system/systemd-networkd-wait-online.service; disabled; vendor pres>
     Active: inactive (dead)
       Docs: man:systemd-networkd-wait-online.service(8)

sudo systemctl enable systemd-networkd-wait-online.service

sudo gedit /etc/systemd/system/systemd-networkd-wait-online.service.d/override.conf
[Service]
ExecStart=/usr/lib/systemd/systemd-networkd-wait-online -i wlan0


sudo gedit /etc/systemd/system/ros.service
[Unit]
Description=Drone Service
Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
ExecStart=/home/mason/autostart.sh

[Install]
WantedBy=multi-user.target
sudo systemctl enable ros.service


#!/bin/bash

source /opt/ros/noetic/setup.bash
source /home/mason/catkin_ws/devel.setup.bash

export ROS_MASTER_URI="http://192.168.0.100:11311"
export ROS_HOSTNAME="192.168.0.100"

roscore & roslaunch --wait test_package test.launch

exit 0