|
|
|
@ -1218,6 +1218,8 @@ class Orchestrator:
|
|
|
|
|
|
|
|
|
|
|
|
def mainLoop(self):
|
|
|
|
def mainLoop(self):
|
|
|
|
logger.info("Main orchestrator started <-")
|
|
|
|
logger.info("Main orchestrator started <-")
|
|
|
|
|
|
|
|
self.ros2_retry_time = None
|
|
|
|
|
|
|
|
self.ros2_manual_stop = False
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
# while not self.stop_evt.is_set():
|
|
|
|
# while not self.stop_evt.is_set():
|
|
|
|
while self.panel_thread.is_alive():
|
|
|
|
while self.panel_thread.is_alive():
|
|
|
|
@ -1249,6 +1251,17 @@ class Orchestrator:
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self.panelState.ros2_manager_state = 'Stopped'
|
|
|
|
self.panelState.ros2_manager_state = 'Stopped'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 這邊做一個簡易的重啟 掛掉要等待一秒再重啟 避免過度頻繁 # 算是高技術債的方式構建 但是未來有需要在還吧 (煙
|
|
|
|
|
|
|
|
if not self.ros2_manual_stop:
|
|
|
|
|
|
|
|
# logger.info(f"mark A {self.ros2_retry_time}")
|
|
|
|
|
|
|
|
if self.ros2_retry_time:
|
|
|
|
|
|
|
|
if (time.time() - self.ros2_retry_time) > 1:
|
|
|
|
|
|
|
|
self.fc_ros_manager.start()
|
|
|
|
|
|
|
|
self.fc_ros_manager.schedule_restart_node("command_service")
|
|
|
|
|
|
|
|
self.ros2_retry_time = None
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.ros2_retry_time = time.time()
|
|
|
|
|
|
|
|
|
|
|
|
# B. 更新載具列表(從 vehicle_registry 獲取)
|
|
|
|
# B. 更新載具列表(從 vehicle_registry 獲取)
|
|
|
|
self._update_vehicles_list()
|
|
|
|
self._update_vehicles_list()
|
|
|
|
|
|
|
|
|
|
|
|
@ -1337,8 +1350,10 @@ class Orchestrator:
|
|
|
|
self.plumber.shutdown()
|
|
|
|
self.plumber.shutdown()
|
|
|
|
elif cmd == "STOP_ROS_MANAGER":
|
|
|
|
elif cmd == "STOP_ROS_MANAGER":
|
|
|
|
self.fc_ros_manager.stop()
|
|
|
|
self.fc_ros_manager.stop()
|
|
|
|
|
|
|
|
self.ros2_manual_stop = True
|
|
|
|
elif cmd == "START_ROS_MANAGER":
|
|
|
|
elif cmd == "START_ROS_MANAGER":
|
|
|
|
self.fc_ros_manager.start()
|
|
|
|
self.fc_ros_manager.start()
|
|
|
|
|
|
|
|
self.ros2_manual_stop = False
|
|
|
|
|
|
|
|
|
|
|
|
except queue.Empty:
|
|
|
|
except queue.Empty:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|