Two mavsdk instances that share the same connection

I have a companion computer that act also as a gimbal device and is connected to the autopilot through a serial connection.
I have to send on the serial connection two different heartbeats with two different components ID one for the companion computer and one for the gimbal device.
If I understood correctly as today is not possible to do this because every instance of MAVSDK is associated with one source component ID ad it emits a single heartbeat with his component ID.

My idea is to patch the library in order to make the connections sharable between different MAVSDK instances, I checked and it doesn’t look too difficult. Do you think is the correct way or there is another method to share the same connection among different components within the same application?


Did you solve this problem?

Software development projects often go beyond the scope of the original requirements. The entire process may extend to issues of risk management, human resources, and budgeting Moreover, the team may also get sidetracked into less technical issues, such as intellectual property or crisis management. For these reasons, it’s important to hire a software developer who knows how to design and develop software. It’s crucial that they can communicate well with their clients.

Yes, i made a new branch at the following url:

In there you will find a new Mavsdk::add_mavsdk_connection that take the pointer of another mavsdk instance.

For now the second mavsdk instance share only the first connection of the first mavsdk instance.
In my cause this is enough because all mavsdk instances use the same serial link to talk to the AP.

I’m testing the patch with my application, in the next days i will try to submit a pull request to the main repository.