How to use MAVLink between Java and C/C++ applications?

Hi,

I use MAVLink (v2.0) to communicate between two Raspberry Pis and I would like to integrate an Android app.
As far as I understood MAVLink, it should be independent of the programming language. I used the MAVLink Generator to build my own messages (in Java and C++11). The problem is that the messages are not correctly encoded between Java and C/C++.

In my C / C ++ app I use mavlink_msg_mymsg_encode (), mavlink_msg_mymsg_decode () and mavlink_parse_char() which works well.

In my Android app I use the following code:

msg_mymsg msg = new msg_mymsg();
MAVLinkPacket msg = mymsg.pack();
byte[] b = msg.encodePacket();

The byte array is correctly send (via UDP) but encoded incorrectly it seems, at least I can not get a correct output from mavlink_parse_char(). The comunication between the C/C++ applications is working so I guess the problem is with the encoding in the Android app.
So my question: How do you encode mavlink messages in a Java app and decode them in C/C ++?

Thanks in advance

Hi,
Have you seen DroneCore?

No I have not actually, but I’ll take a look. Thank you!

No problem, it is still under heavy development but I hope you find what you need there.