Automative launch - Kraft2k/icebox-rover GitHub Wiki
cd /etc/systemd/system
vim realsense.service
Paste this text in file realsense.service
[Unit]
Description=ROS 2 Run Realsense Camera Node
After=network.target
[Service]
Type=simple
Environment="SHELL=/bin/bash"
Environment="HOME=/home/orange-pi"
ExecStart=/usr/bin/bash -c 'source /opt/ros/humble/setup.bash; source /home/orange-pi/ros2_ws/install/setup.bash; ros2 run realsense2_camera realsense2_camera_node'
Restart=on-failure
User=orange-pi
WorkingDirectory=/home/orange-pi
[Install]
WantedBy=multi-user.target
Paste this text in file auto_control.service
[Unit]
Description=ROS 2 Run Auto Control
After=network.target
[Service]
Type=simple
Environment="SHELL=/bin/bash"
Environment="HOME=/home/ubuntu"
ExecStart=/usr/bin/bash -c 'source /opt/ros/humble/setup.bash; source /home/ubuntu/ros2_ws/install/setup.bash; ros2 run mobile_base_unit wandering'
Restart=on-failure
User=ubuntu
WorkingDirectory=/home/ubuntu
[Install]
WantedBy=multi-user.target
Paste this text in file manual_control.service
[Unit]
Description=ROS 2 Run Manual Control
After=network.target
[Service]
Type=simple
Environment="SHELL=/bin/bash"
Environment="HOME=/home/orange-pi"
ExecStart=/usr/bin/bash -c 'source /opt/ros/humble/setup.bash; source /home/orange-pi/ros2_ws/install/setup.bash; ros2 launch barra_description joystick.launch.py'
Restart=on-failure
User=orange-pi
WorkingDirectory=/home/orange-pi
[Install]
WantedBy=multi-user.target
Paste this text in file mobile_base.service
[Unit]
Description=ROS 2 Run mobile_base
After=network.target
[Service]
Type=simple
Environment="SHELL=/bin/bash"
Environment="HOME=/home/kraft"
Environment="PYTHONPATH=/home/kraft/PyVESC/src:$PYTHONPATH"
ExecStart=/usr/bin/bash -c 'source /opt/ros/humble/setup.bash && source /home/kraft/ros2_ws/install/setup.bash && exec ros2 run mobile_base_unit mobile_base >> /home/kraft/mobile_base.log 2>&1'
Restart=on-failure
User=kraft
WorkingDirectory=/home/kraft
[Install]
WantedBy=multi-user.target
Paste this text in file pigpiod.service
[Unit]
Description=Pigpio daemon
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/bin/pigpiod
User=root
Restart=on-failure
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start realsense.service
sudo systemctl status realsense.service
sudo systemctl stop realsense.service
Enable start by boot system
sudo systemctl enable realsense.service
Run VPN client
cd /etc/systemd/system
vim vpn_on.service
[Unit]
Description=On VPN service
After=network.target
[Service]
ExecStart=/usr/bin/bash -c 'wg-quick up /etc/wireguard/wg0.conf'
ExecStop=/usr/bin/bash -c 'wg-quick down /etc/wireguard/wg0.conf'
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
on robot Boris
[Unit]
Description=On VPN service
After=network.target
[Service]
ExecStart=/usr/bin/bash -c 'wg-quick up /etc/wireguard/wg0.conf'
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Change
sudo chmod 600 /etc/wireguard/wg0.conf
sudo chown root:root /etc/wireguard/wg0.conf
sudo systemctl daemon-reload
sudo systemctl start vpn_on.service
sudo systemctl status vpn_on.service
Enable start by boot system
sudo systemctl enable vpn_on.service
For disable
sudo systemctl disable vpn_on.service