Skip to content

Commit e61b602

Browse files
ArdupilotManager: add navigator64 support
1 parent 08f7e38 commit e61b602

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

core/services/ardupilot_manager/ArduPilotManager.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ async def start_linux_board(self, board: LinuxFlightController) -> None:
187187
pathlib.Path("/root/blueos-files/ardupilot-manager/default/ardupilot_navigator"),
188188
board,
189189
)
190+
elif board.platform == Platform.Navigator64:
191+
self.firmware_manager.install_firmware_from_file(
192+
pathlib.Path("/root/blueos-files/ardupilot-manager/default/ardupilot_navigator64"),
193+
board,
194+
)
190195
else:
191196
raise NoDefaultFirmwareAvailable(
192197
f"No firmware installed for '{board.platform}' and no default firmware available. Please install the firmware manually."

core/services/ardupilot_manager/firmware/FirmwareInstall.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from ardupilot_fw_decoder import BoardSubType, BoardType, Decoder
1010
from elftools.elf.elffile import ELFFile
11+
from loguru import logger
1112

1213
from exceptions import FirmwareInstallFail, InvalidFirmwareFile, UnsupportedPlatform
1314
from firmware.FirmwareDownload import FirmwareDownloader
@@ -43,6 +44,7 @@ def get_correspondent_decoder_platform(current_platform: Platform) -> Union[Boar
4344
Platform.SITL: BoardType.SITL,
4445
Platform.Navigator: BoardSubType.LINUX_NAVIGATOR,
4546
Platform.Argonot: BoardSubType.LINUX_NAVIGATOR,
47+
Platform.Navigator64: BoardSubType.LINUX_NAVIGATOR,
4648
}
4749
return correspondent_decoder_platform.get(current_platform, BoardType.EMPTY)
4850

@@ -97,6 +99,9 @@ def _validate_elf(firmware_path: pathlib.Path, platform: Platform) -> None:
9799
firm_board = BoardType(firm_decoder.fwversion.board_type)
98100
firm_sub_board = BoardSubType(firm_decoder.fwversion.board_subtype)
99101
current_decoder_platform = get_correspondent_decoder_platform(platform)
102+
logger.debug(
103+
f"firm_board: {firm_board}, firm_sub_board: {firm_sub_board}, current_decoder_platform: {current_decoder_platform}"
104+
)
100105
if current_decoder_platform not in [firm_board, firm_sub_board]:
101106
raise InvalidFirmwareFile(
102107
(

core/services/ardupilot_manager/flight_controller_detector/linux/navigator.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import List
1+
import platform
2+
from typing import Any, List
23

34
from commonwealth.utils.commands import load_file
45

@@ -7,9 +8,15 @@
78

89

910
class Navigator(LinuxFlightController):
10-
name = "Navigator"
1111
manufacturer = "Blue Robotics"
12-
platform = Platform.Navigator
12+
13+
def __init__(self, **data: Any) -> None:
14+
name = "Navigator"
15+
plat = Platform.Navigator
16+
if platform.machine() == "aarch64":
17+
name = "Navigator64"
18+
plat = Platform.Navigator64
19+
super().__init__(**data, name=name, platform=plat)
1320

1421
def is_pi5(self) -> bool:
1522
with open("/proc/cpuinfo", "r", encoding="utf-8") as f:

core/services/ardupilot_manager/setup.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
"ardupilot_navigator",
2727
"https://firmware.ardupilot.org/Sub/stable-4.1.2/navigator/ardusub",
2828
),
29+
StaticFile(
30+
defaults_folder,
31+
"ardupilot_navigator",
32+
"https://firmware.ardupilot.org/Sub/latest/navigator64/ardusub",
33+
),
2934
StaticFile(defaults_folder, "ardupilot_pixhawk1", "https://firmware.ardupilot.org/Sub/latest/Pixhawk1/ardusub.apj"),
3035
StaticFile(defaults_folder, "ardupilot_pixhawk4", "https://firmware.ardupilot.org/Sub/latest/Pixhawk4/ardusub.apj"),
3136
]

core/services/ardupilot_manager/typedefs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class Platform(str, Enum):
110110
CubeOrange = "CubeOrange"
111111
GenericSerial = "GenericSerial"
112112
Navigator = "navigator"
113+
Navigator64 = "navigator64"
113114
Argonot = "argonot"
114115
SITL = get_sitl_platform_name(machine())
115116

@@ -123,6 +124,7 @@ def type(self) -> PlatformType:
123124
Platform.CubeOrange: PlatformType.Serial,
124125
Platform.GenericSerial: PlatformType.Serial,
125126
Platform.Navigator: PlatformType.Linux,
127+
Platform.Navigator64: PlatformType.Linux,
126128
Platform.Argonot: PlatformType.Linux,
127129
Platform.SITL: PlatformType.SITL,
128130
}

0 commit comments

Comments
 (0)