diff --git a/core/services/ardupilot_manager/README.md b/core/services/ardupilot_manager/README.md index bdae8005de..0bdb120445 100644 --- a/core/services/ardupilot_manager/README.md +++ b/core/services/ardupilot_manager/README.md @@ -1 +1 @@ -# ArduPilot service manager \ No newline at end of file +# AutoPilot service manager diff --git a/core/services/ardupilot_manager/api/app.py b/core/services/ardupilot_manager/api/app.py index 2c4e461c61..3983def965 100644 --- a/core/services/ardupilot_manager/api/app.py +++ b/core/services/ardupilot_manager/api/app.py @@ -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 ) @@ -33,7 +33,7 @@ async def root() -> HTMLResponse: html_content = """ - ArduPilot Manager + AutoPilot Manager """ diff --git a/core/services/ardupilot_manager/api/v1/routers/endpoints.py b/core/services/ardupilot_manager/api/v1/routers/endpoints.py index cea26588b9..7b5d6f6635 100644 --- a/core/services/ardupilot_manager/api/v1/routers/endpoints.py +++ b/core/services/ardupilot_manager/api/v1/routers/endpoints.py @@ -3,7 +3,7 @@ from fastapi import APIRouter, Body, status from fastapi_versioning import versioned_api_route -from ArduPilotManager import ArduPilotManager +from autopilot_manager import AutoPilotManager from mavlink_proxy.Endpoint import Endpoint endpoints_router_v1 = APIRouter( @@ -13,7 +13,7 @@ responses={status.HTTP_404_NOT_FOUND: {"description": "Not found"}}, ) -autopilot = ArduPilotManager() +autopilot = AutoPilotManager() @endpoints_router_v1.get("/", response_model=List[Dict[str, Any]]) diff --git a/core/services/ardupilot_manager/api/v1/routers/index.py b/core/services/ardupilot_manager/api/v1/routers/index.py index 2b05c7c897..23bbf55a99 100644 --- a/core/services/ardupilot_manager/api/v1/routers/index.py +++ b/core/services/ardupilot_manager/api/v1/routers/index.py @@ -16,7 +16,7 @@ from fastapi_versioning import versioned_api_route from loguru import logger -from ArduPilotManager import ArduPilotManager +from autopilot_manager import AutoPilotManager from exceptions import InvalidFirmwareFile from typedefs import Firmware, FlightController, Parameters, Serial, SITLFrame, Vehicle @@ -26,7 +26,7 @@ responses={status.HTTP_404_NOT_FOUND: {"description": "Not found"}}, ) -autopilot = ArduPilotManager() +autopilot = AutoPilotManager() # By default, all REST resources should have its own router, but as some of them does not implement diff --git a/core/services/ardupilot_manager/api/v2/routers/index.py b/core/services/ardupilot_manager/api/v2/routers/index.py index 2d06df023f..a8a1a06f24 100644 --- a/core/services/ardupilot_manager/api/v2/routers/index.py +++ b/core/services/ardupilot_manager/api/v2/routers/index.py @@ -14,7 +14,7 @@ async def root_v2() -> HTMLResponse: html_content = """ - ArduPilot Manager + AutoPilot Manager """ diff --git a/core/services/ardupilot_manager/ArduPilotManager.py b/core/services/ardupilot_manager/autopilot_manager.py similarity index 99% rename from core/services/ardupilot_manager/ArduPilotManager.py rename to core/services/ardupilot_manager/autopilot_manager.py index 519a2cae22..3bfeb691d4 100644 --- a/core/services/ardupilot_manager/ArduPilotManager.py +++ b/core/services/ardupilot_manager/autopilot_manager.py @@ -13,7 +13,7 @@ from loguru import logger from exceptions import ( - ArdupilotProcessKillFail, + AutoPilotProcessKillFail, NoDefaultFirmwareAvailable, NoPreferredBoardSet, ) @@ -37,7 +37,7 @@ ) -class ArduPilotManager(metaclass=Singleton): +class AutoPilotManager(metaclass=Singleton): # pylint: disable=too-many-instance-attributes def __init__(self) -> None: self.settings = Settings() @@ -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: @@ -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 diff --git a/core/services/ardupilot_manager/exceptions.py b/core/services/ardupilot_manager/exceptions.py index 3dfdbb8267..957976ef62 100644 --- a/core/services/ardupilot_manager/exceptions.py +++ b/core/services/ardupilot_manager/exceptions.py @@ -1,5 +1,5 @@ """ -Ardupilot-manager exception classes. +AutoPilot-manager exception classes. """ @@ -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): @@ -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): diff --git a/core/services/ardupilot_manager/main.py b/core/services/ardupilot_manager/main.py index b203148ded..92b693d1a0 100755 --- a/core/services/ardupilot_manager/main.py +++ b/core/services/ardupilot_manager/main.py @@ -7,21 +7,21 @@ from loguru import logger from uvicorn import Config, Server -from ArduPilotManager import ArduPilotManager from args import CommandLineArgs +from autopilot_manager import AutoPilotManager from flight_controller_detector.Detector import Detector as BoardDetector from settings import SERVICE_NAME logging.basicConfig(handlers=[InterceptHandler()], level=0) init_logger(SERVICE_NAME) -logger.info("Starting ArduPilot Manager.") -autopilot = ArduPilotManager() +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() diff --git a/core/services/ardupilot_manager/setup.py b/core/services/ardupilot_manager/setup.py index d4ebcb7b08..b32e42579d 100644 --- a/core/services/ardupilot_manager/setup.py +++ b/core/services/ardupilot_manager/setup.py @@ -55,7 +55,7 @@ version="0.0.1", author="Patrick José Pereira", author_email="patrick@bluerobotics.com", - description="ArduPilot service manager.", + description="AutoPilot service manager.", long_description=long_description, long_description_content_type="text/markdown", packages=setuptools.find_packages(),