Refactor of MAVLink controllers to enhance protocol modularization #71
angel-ayala
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The controllers for MAVLink messages dispatch and process now seems outdated and requires to update its architecture aiming to unify all definitions related to messages in a self-contained unit, as possible.
Our last issue introducing such idea is #61, nevertheless different PR and issues were updating the MAVLink service logic, but focusing on isolated aspects not looking to improve it as a package. All the issues addressing changes in
controllerspackage identified so far are #7 , #8 , #26 , #43 , #45 and #61, and here I would like to summarize the things that can be improved.When the application development started and
controllerspackage architecture was defined there was under heavy development, and now with a more stable architecture in the interfacing logic, is being necessary to update this service logic, and the SDK logic in a future.First of all, we need to review the mentioned messages to implement those that are required and still missing, such as the case of
FLIGHT_INFORMATION.This is the current
mavlinkpackage content without any discussed changes:The overall idea was to
MAVLinkServicehandleMAVLinkClientinit/shutdown and passWenuLinkHandleras handler attribute toMAVLinkController(#45), which act as a central point for all other controllers such asNavigationControllerinsidecontrollers. And recently (#43) , was added themessagespackage to translateMAVLinkMessageparameters from commands and request mainly, into meaningful attributes names.Right now, there is no issue related, but it lacks of a suitable architecture since the message processing logic definition is split in
controllersandmessagesand must be updated to have a unit definition on what to do, similar to commands, but considering two main situations, incoming messages that needs to perform certain procedures and outgoing messages that can be instantly sent or scheduled to be sent iteratively. Additionally, to further fully comply with the routing mechanism, a pre- and post-processing of messages is also required to first check if something must be done or skip such message, and to set proper routing data before send, respectively.As suggestions, controllers can move to a registry-driven approach acting as entry point for specific microservice messages, being capable of auto-load its registry. In such way there should be a new dispatcher, scheduler, and registry classes to dynamically deals with actual unit definitions, keeping controllers simple, being used only as message registry point and hooks. Such changes will require to extend base abstract classes, that
IController's update, there should also be a newIMessageHandlerthat will define the structure for the units definition. Hoping that the controller class will be reduced enough, the kotlin file can have the microservice name, for exampleMissionMicroservice.ktand comprise the controller and units definitions.All reactions