Copter-GCS now supports MAVLink

At long last, I finally beat MAVLink into Java submission. I wasn't able to find any MAVLink bindings for Java (needed by android), so I ended up using JNI and wrote a MAVLink wrapper. It works nicely and makes using MAVLink very easy. Its available for download here. I've included both the "common" and the "pixhawk" messages.


As you see above, I've added a HUD mode.


I've uploaded the new copy of the GCS for easy download or through the Android Market (search copter-gcs). Of course the source is available through SVN

I am focused on Copters, as that is what I fly, but with MAVLink support, the copter-gcs is now also useful for ArduPilotMega. I loaded the APM code on my quad (minus the props :-) ), and was able to see / tune track just fine with it. The only thing missing is that the PID tuning widgets I have are currently only setup for the copter. The next version I expect will have the APM pids added in. For now you can just use the Parameters view to set anything you like:


When you make a change, just hit the button next to is to save it.

That's about the news for now. I will be working on Mission Planning and some clean-up next.


If anyone has any problems, let me know. Same thing if there is a feature missing (no promises though).

So far USB host mode for tablets (connect XBee directly) and Wifi links have been requested, although i'm not sure when/if they will make it in.

Views: 5521

Comment by Peter on January 7, 2012 at 2:30am

Hi Bart,

It seems that I have some problems with Thread-Safe function.

Are you interested on my code? Then I will send it to you, Maybe you have a idear.

Thanks Peter

Comment by Dries on June 20, 2012 at 3:23pm

I'm trying to compile and use JMAVLink on Linux x86, but I'm stuck... 

I use the following command to compile jmavlink.cpp:

g++ -fPIC -I./mavlink -I/usr/lib/jvm/jdk1.6.0_31/include -I/usr/lib/jvm/jdk1.6.0_31/include/linux -g -c jmavlink.cpp

Then I create a shared library using:

g++ -shared -o jmavlink.o -lc

When using this library in combination with the JMAVLink java sources (, I keep on getting the following runtime error:

Exception in thread "Thread-3" java.lang.NoClassDefFoundError: com.MAVLink.Messages.IMAVLinkMessage
at com.MAVLink.MAVLink.init(Native Method)
at com.MAVLink.MAVLink.<clinit>(

Peter, Bart, do you have any suggestion? Could this have anything to do with a dependency on libstdc++?



Comment by Bart on June 20, 2012 at 4:10pm

To be honest, I have only ever used the library on android, building it using "ndk-build" in the android NDK. I haven't touched it in awhile though. I've not had this build error come up before.


Comment by Peter on June 20, 2012 at 4:34pm

Hi Dries,

Yes, I know this problem. But I didn't found a solution.

I think something goes wrong in decode function.

But for this is no source avalible, so I moved to qt + qgroundcontrol.


Comment by Jani on June 21, 2012 at 10:49am


What is correct Protocol with latest copter-gcs-9-packed.apk and arducopter 2.6? I can only use MAVLink -protocol and with that i have huge lag in HUD screen. Arducopter1 -protocol crashes copter-gcs soon after searching Heartbeat, is this normal?

My setup works well with MissionPlanner1.0 so i think it's ok.

Regards Jani

Comment by Bart on June 22, 2012 at 4:21pm


The correct protocol is MAVLink using version 9 on arducopter 2.6.

Someone has tested the app for me using MAVLink 1.0, but I cannot do so myself yet, as I am still flying a 1280 board. Work is crazy for the past and next few months, so although at some point I will test it all (and have time to fly again), it might be a while.



Comment by Dries on June 25, 2012 at 5:08am

As a follow-up to my previous post, the solution to the problem I was facing was to change the arguments of the jni FindClass functions in jmavlink.cpp and classLoader.h to match the description of the function argument: name: a fully-qualified class name (that is, a package name, delimited by “/”, followed by the class name). As such, the code must change from:

interface_class = env->FindClass( "com.MAVLink.Messages.IMAVLinkMessage");

heartbeat_class= env->FindClass( "com.MAVLink.Messages.common.msg_heartbeat");



interface_class = env->FindClass( "com/MAVLink/Messages/IMAVLinkMessage");

heartbeat_class= env->FindClass( "com/MAVLink/Messages/common/msg_heartbeat");

I don't know why the code in the repository works, but it has probably to do with the way android packages it's programs.

Comment by Miguel Martín Mateo on October 15, 2012 at 5:44am

Hi Bart,
First of all congratulations for your very good job.

Last days i have been testing Android x86 (Ice Cream Sanwitch) in my Acer Aspire One D150, it seems to work very well, the work haven't finished yet beacuse the spansh keyboard isn't completly funcional but is not a problem because the screen keyboard has not problem.

After that preamble I would explain my idea.
I would like to use your aplication in the NetBook with ICS as GCS conecting to APM2 througt 3DR Radio connected by the USB port in the NetBook.

The version of your aplication that i have tested complain about the USB connection when I try to configure.

Reading the post I see that the USB suport is desabled.
Do you have a prevision for a working USB support?
Do you think is possible to use my proposed scenary?

Best regards,

Comment by NN on May 21, 2014 at 1:26am


I am new in this branch, so sorry for my mistakes

I try to use your app but it crashes when it try send data to copter

code looks good, mavlink is ok (I think so), android device is Nexus S ...

what confuse me, that AqGcs app works properly with my copter

What you think? issue connected with MavLink or did I do something wrong?

Best Regards,



You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service