Motion Capture, Pixhawk Mini and Companion Computer


I am a developper of the Otus tracker, an affordable motion capture tool for UAVs. I have been spending a lot of time reading about how to integrate motion capture with the PX4. I have read this page and all the related pages in the wiki. I would very much appreciate feedback on my proposed implementation. Since we want to publish a tutorial on this, I want to make sure I am using the correct method in the PX4 environment.

Let’s say I have the Raspberry Pi 3 companion computer and I am using dronekit from a ground computer. This is for indoors testing only. The problem I see is that I have to send UDP messages formated in the Mavlink format from two sources on the computer: my motion tracking client and Dronekit. Those messages have then to be combined on the companion computer and sent through the Serial port of the RPi to the telem port. Is this possible? Do I have to write the bridge on the RPi or can I use this code?

Another possibility is to have the motion capture client on the RPI. Then however, I would have two software trying to access the same serial port to send mavlink message: the motion capture client and the user code.

Thank you for your help,