Update GUI 2.5.0: Drone reboot
This commit is contained in:
@@ -14,6 +14,7 @@ from fc_interfaces.srv import MavCommandLong
|
||||
COMMAND_DO_SET_MODE = 176
|
||||
COMMAND_NAV_LAND = 21
|
||||
COMMAND_NAV_TAKEOFF = 22
|
||||
COMMAND_PREFLIGHT_REBOOT_SHUTDOWN = 246
|
||||
COMMAND_COMPONENT_ARM_DISARM = 400
|
||||
|
||||
DEFAULT_SERVICE_NAME = "/fc_network/vehicle/send_command_long"
|
||||
@@ -191,6 +192,28 @@ class CommandLongClient(Node):
|
||||
timeout_sec=timeout_sec,
|
||||
)
|
||||
|
||||
def reboot_autopilot(
|
||||
self,
|
||||
*,
|
||||
target_sysid: int,
|
||||
target_compid: int = 0,
|
||||
timeout_sec: float = DEFAULT_TIMEOUT_SEC,
|
||||
) -> CommandLongResult:
|
||||
return self._send_command_long(
|
||||
target_sysid=target_sysid,
|
||||
target_compid=target_compid,
|
||||
command=COMMAND_PREFLIGHT_REBOOT_SHUTDOWN,
|
||||
confirmation=0,
|
||||
param1=1.0,
|
||||
param2=0.0,
|
||||
param3=0.0,
|
||||
param4=0.0,
|
||||
param5=0.0,
|
||||
param6=0.0,
|
||||
param7=0.0,
|
||||
timeout_sec=timeout_sec,
|
||||
)
|
||||
|
||||
# ============================================================================
|
||||
# 【新增】非阻塞 async 包裝方法(用於 GUI 的非阻塞調用)
|
||||
# 這些方法在 ThreadPoolExecutor 中運行同步版本,以避免阻塞事件循環
|
||||
@@ -353,6 +376,29 @@ class CommandLongClient(Node):
|
||||
timeout_sec=timeout_sec,
|
||||
)
|
||||
|
||||
async def reboot_autopilot_async(
|
||||
self,
|
||||
*,
|
||||
target_sysid: int,
|
||||
target_compid: int = 0,
|
||||
timeout_sec: float = DEFAULT_TIMEOUT_SEC,
|
||||
) -> CommandLongResult:
|
||||
"""非阻塞 async 版本的 autopilot reboot."""
|
||||
return await self._send_command_long_async(
|
||||
target_sysid=target_sysid,
|
||||
target_compid=target_compid,
|
||||
command=COMMAND_PREFLIGHT_REBOOT_SHUTDOWN,
|
||||
confirmation=0,
|
||||
param1=1.0,
|
||||
param2=0.0,
|
||||
param3=0.0,
|
||||
param4=0.0,
|
||||
param5=0.0,
|
||||
param6=0.0,
|
||||
param7=0.0,
|
||||
timeout_sec=timeout_sec,
|
||||
)
|
||||
|
||||
async def land_async(
|
||||
self,
|
||||
*,
|
||||
|
||||
Reference in New Issue
Block a user