(hot_fix)
1. 把測試用參數關閉 2. 修正錯誤回傳值 3. 臨時加入 node 失效後 自動重啟功能
This commit is contained in:
@@ -29,7 +29,7 @@ from .utils import acquireSerial, acquirePort
|
|||||||
from .utils.acquirePort import find_available_port
|
from .utils.acquirePort import find_available_port
|
||||||
|
|
||||||
logger = setup_logger(os.path.basename(__file__))
|
logger = setup_logger(os.path.basename(__file__))
|
||||||
PROJECT_VER = "v1.00"
|
PROJECT_VER = "v1.10"
|
||||||
|
|
||||||
class PanelState:
|
class PanelState:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -758,7 +758,7 @@ class MavlinkCommandService(Node):
|
|||||||
# 6) 處理回應封包
|
# 6) 處理回應封包
|
||||||
if not fail_skip:
|
if not fail_skip:
|
||||||
ack_msg = _pending.result_mav_msg
|
ack_msg = _pending.result_mav_msg
|
||||||
response.success = ServiceAckResult.FCSYS_MAVLINK_BREAK # dev 故意觸發錯誤用的
|
# response.success = ServiceAckResult.FCSYS_MAVLINK_BREAK # dev 故意觸發錯誤用的
|
||||||
response.success = (ack_msg.result == 0) # mavutil.mavlink.MAV_RESULT_ACCEPTED
|
response.success = (ack_msg.result == 0) # mavutil.mavlink.MAV_RESULT_ACCEPTED
|
||||||
response.message = "" # 沒有消息就是好消息
|
response.message = "" # 沒有消息就是好消息
|
||||||
response.ack_result = ack_msg.result
|
response.ack_result = ack_msg.result
|
||||||
@@ -838,7 +838,7 @@ class MavlinkCommandService(Node):
|
|||||||
ack_msg = _pending.result_mav_msg
|
ack_msg = _pending.result_mav_msg
|
||||||
|
|
||||||
response.message = ""
|
response.message = ""
|
||||||
response.ack_result = ServiceAckResult.FCSYS_GET_EXPECTED_FEEDBACK
|
response.ack_result = ServiceAckResult.MAV_RESULT_ACCEPTED
|
||||||
response.r_time_boot_ms = ack_msg.time_boot_ms
|
response.r_time_boot_ms = ack_msg.time_boot_ms
|
||||||
response.r_type_mask = ack_msg.type_mask
|
response.r_type_mask = ack_msg.type_mask
|
||||||
response.r_lat_int = ack_msg.lat_int
|
response.r_lat_int = ack_msg.lat_int
|
||||||
|
|||||||
Reference in New Issue
Block a user