mirror of
https://github.com/SHC-ASTRA/rover-ros2.git
synced 2026-02-11 09:20:40 +00:00
feat: nodes should die entirely if no MCU found
This should allow anchor to restart automatically if it's being run as a service
This commit is contained in:
@@ -7,6 +7,7 @@ import time
|
||||
import atexit
|
||||
|
||||
import serial
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
import glob
|
||||
@@ -74,8 +75,9 @@ class SerialRelay(Node):
|
||||
|
||||
if self.port is None:
|
||||
self.get_logger().info("Unable to find MCU...")
|
||||
time.sleep(1)
|
||||
sys.exit(1)
|
||||
#kill the node/process entirely
|
||||
os.kill(os.getpid(), signal.SIGKILL)
|
||||
sys.exit(0)
|
||||
|
||||
self.ser = serial.Serial(self.port, 115200)
|
||||
atexit.register(self.cleanup)
|
||||
|
||||
Reference in New Issue
Block a user