we would like to implement a module to control the gimbal-camera payload, which has a UART Serial interface and utilize its own simple protocol. Specifically is the camera an older ViewPro model with RGB, thermal, and laser distance sensor in one head integrated with the gimbal. The new models are fully MavLink enabled, but this one is not and could not be upgraded.
The main idea is based on a very simple pipeline. We would like to utilize common MavLink commands (DO_GIMBAL and DO_CAMERA), process it using standard Mavlink module, transfer to uORB topics, and process those topics with the new driver.
As I did not find much about such development in the guide, I would like to discuss here the design and architecture of such a module to stay as much conform with system standards as possible. To be noted, currently, we have the same camera connected to the autopilot using a small RPi companion computer in the role of the Mavlink interface (using a small ROS environment) to provide a fully conform MavLink enabled camera interface. But we would like to eliminate the companion computer, as for now, it is its only role in the system. The video stream is transmitted over an on-board modem separately over UDP.
We are using our own MavLink GCS so we are not worried that the proposed system will not be functional with QGround GCS.
The main question is how to split the sub-system into separated threads or tasks in specific queues. I am pretty sure, that we need two separate tasks to receive and transmit data over UART. Most of the commands have no response from the camera, but for example reading of laser range finder will produce answer from the camera.
The second question is if there should be a separate module working on its own stack to process topics from the Mavlink and prepare data to buffer for transmitting using the UART driver. I am worrying about miss some Mavlink message when the ::write to UART is in progress.
Any comment, suggestions, or links to relevant sources (like other similar implementations) are appreciated.