Skip to content

Commit

Permalink
core: autopilot-manager: Move Ardu to Auto diverse
Browse files Browse the repository at this point in the history
* Move diverse general (Not specific like settings) uses of ArduPilot to
  AutoPilot
  • Loading branch information
JoaoMario109 committed Oct 3, 2024
1 parent 62aeb3c commit dd083e0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions core/services/ardupilot_manager/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from api.v2.routers import index_router_v2

application = FastAPI(
title="ArduPilot Manager API",
description="ArduPilot Manager is responsible for managing ArduPilot devices connected to BlueOS.",
title="AutoPilot Manager API",
description="AutoPilot Manager is responsible for managing AutoPilot devices connected to BlueOS.",
default_response_class=PrettyJSONResponse,
debug=True, # TODO - Add debug after based on args
)
Expand All @@ -33,7 +33,7 @@ async def root() -> HTMLResponse:
html_content = """
<html>
<head>
<title>ArduPilot Manager</title>
<title>AutoPilot Manager</title>
</head>
</html>
"""
Expand Down
2 changes: 1 addition & 1 deletion core/services/ardupilot_manager/api/v2/routers/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async def root_v2() -> HTMLResponse:
html_content = """
<html>
<head>
<title>ArduPilot Manager</title>
<title>AutoPilot Manager</title>
</head>
</html>
"""
Expand Down
6 changes: 3 additions & 3 deletions core/services/ardupilot_manager/autopilot_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from loguru import logger

from exceptions import (
ArdupilotProcessKillFail,
AutoPilotProcessKillFail,
NoDefaultFirmwareAvailable,
NoPreferredBoardSet,
)
Expand Down Expand Up @@ -476,7 +476,7 @@ async def terminate_ardupilot_subprocess(self) -> None:
return
logger.debug("Waiting for process to die...")
await asyncio.sleep(0.5)
raise ArdupilotProcessKillFail("Could not terminate Ardupilot subprocess.")
raise AutoPilotProcessKillFail("Could not terminate Ardupilot subprocess.")
logger.warning("Ardupilot subprocess already not running.")

async def prune_ardupilot_processes(self) -> None:
Expand All @@ -497,7 +497,7 @@ async def prune_ardupilot_processes(self) -> None:
try:
subprocess.run(["pkill", "-9", process.pid], check=True)
except Exception as error:
raise ArdupilotProcessKillFail(f"Failed to kill {process.name()}::{process.pid}.") from error
raise AutoPilotProcessKillFail(f"Failed to kill {process.name()}::{process.pid}.") from error

async def kill_ardupilot(self) -> None:
self.should_be_running = False
Expand Down
14 changes: 7 additions & 7 deletions core/services/ardupilot_manager/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Ardupilot-manager exception classes.
AutoPilot-manager exception classes.
"""


Expand All @@ -12,11 +12,11 @@ class NoVersionAvailable(ValueError):


class InvalidManifest(ValueError):
"""Ardupilot manifest file cannot be validated."""
"""AutoPilot manifest file cannot be validated."""


class ManifestUnavailable(RuntimeError):
"""Ardupilot manifest file unavailable."""
"""AutoPilot manifest file unavailable."""


class NoCandidate(ValueError):
Expand Down Expand Up @@ -44,19 +44,19 @@ class InvalidFirmwareFile(ValueError):


class UndefinedPlatform(ValueError):
"""Ardupilot platform is not defined."""
"""AutoPilot platform is not defined."""


class UnsupportedPlatform(ValueError):
"""Ardupilot platform not supported."""
"""AutoPilot platform not supported."""


class FirmwareInstallFail(RuntimeError):
"""Firmware install operation failed."""


class ArdupilotProcessKillFail(RuntimeError):
"""Could not kill Ardupilot process."""
class AutoPilotProcessKillFail(RuntimeError):
"""Could not kill AutoPilot process."""


class NoDefaultFirmwareAvailable(RuntimeError):
Expand Down
4 changes: 2 additions & 2 deletions core/services/ardupilot_manager/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
logging.basicConfig(handlers=[InterceptHandler()], level=0)
init_logger(SERVICE_NAME)

logger.info("Starting ArduPilot Manager.")
logger.info("Starting AutoPilot Manager.")
autopilot = AutoPilotManager()

from api import application

if not is_running_as_root():
raise RuntimeError("ArduPilot manager needs to run with root privilege.")
raise RuntimeError("AutoPilot manager needs to run with root privilege.")

if __name__ == "__main__":
args = CommandLineArgs.from_args()
Expand Down
2 changes: 1 addition & 1 deletion core/services/ardupilot_manager/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
version="0.0.1",
author="Patrick José Pereira",
author_email="[email protected]",
description="ArduPilot service manager.",
description="AutoPilot service manager.",
long_description=long_description,
long_description_content_type="text/markdown",
packages=setuptools.find_packages(),
Expand Down

0 comments on commit dd083e0

Please sign in to comment.