Hi All,

I was recently fiddling around the code for a while and decided to create a tutorial out of it so that others may find it useful. If I would have known this knowledge long back, I am sure I would have saved a lot of time since then! I find lot of beginners getting swayed and lack of knowhow on MavLink with respect to APM/PX4. Information on internet is scattered and not much of use!! 

This will be "Step by Step" entertaining, PART - I of the series I plan to write.on:

What it Covers:

  1. MavLink, starting from scratch. What the hell is it and understand how it works with APM/ PX4
  2. Learn how developers think -> Arducopter communication with Mission Planner and vice-versa.
  3. Get a feel of 'How Stuffs works'.

Too much hype:) Well, this information has been collated from my experience and from internet. I know there is information on the new Wiki, it tells you what, I plan to tell you 'how'! :)

Please let me know if you found it interesting. If there is enough response, I will make another tutorial where I would add more 'Step by step' knowhow!!


- More on MavLink

- Learning Arducopter source code, Step by Step

- Making swarm (multiple) copters work with your 3DR Telemetry radio! I am working on it.

See attachment for [MAVLink Tutorial for Absolute Dummies (Part –I)]

Edit: Request you to post your queries over the forum directly, as it is not possible for me to address all queries I get by email!


Best regards,


Views: 47341


Replies to This Discussion

Nice, go on with the next tutorial, i'm already finished with this one. What am I going to absorb now?


Thanks for that information. I missed out thinking of the freq. hop thing. Then multiple telemetries should work. I use EU (433 MHz). What would you like in the next tutorial;) ?

Dear Shyam
Myself and 3 other friends are working on quad-copter project. Quad uses Arduipilot. Works fine. Problem is that its a software project. and we were hoping to have WPF C# app that would get data from quad (like Throttle, Pitch etc) something like mission planner but small scale. We appreciate your tutorial but if anything - it make us feel like TOTAL Absolute Dummies.
We kinda have a gist of how it works but still we dont know how to use it ourselves in our own app. We have one month to deadline and we feel hopeless. If there is anything you could do for us (advice, directions, code, anything) we would be very thankful.



Hi Marcin,

Thank you for the comments. 1 months seems less to develop something by yourself when you are just getting started. I have some questions and then suggestions for you:

- Its fine to have a WPF C# app, but I assume you want it to be a desktop application. Why not use/ reuse Mission planner. AFAIK, it is not written in WPF but pure C#. Would you want to make use of that? If you need some coding help in C# (Mission planner) / C++  (Ardupilot) you can PM me.

- You can remove some of the tabs (like DataFlash/ Mission WP planning/ Settings Config, etc) in the Mission Planner C# application. Use Visual Studio 2012, to compile the code first and simply remove the additional tab pages (under Tab Control) in the User Design GUI form. This way you can work out to get what you want (Throttle, Pitch, etc) values are sent to and fro via the MavLink protocol.

Hope this helps to get a direction.



Dear Shyam,

Currently I'm working on arduplane project and my task is to give command on my ardupilot to control a servo that can move for three pre-set different position. Can you help me please? I think I need to know:

1. How can I edit the tabs or buttons (like config, settings, WP planning etc), and put those three command (or button) for three different position of a servo. I'm planning to use any of those auxiliary servo pins A5-A11, any one of them.
2. How can I set those button to give three different pulses that I want. Where's the coding that I need to edit it.

I hope that you can help me cause I've got nowhere to go right now. I hope you can guide me what software should I use (visual studio 2012), and how can I edit the source code. I would be very thankful to you.



From what I understand, you wish to know how to edit the C# GUI to edit your commands. For this, it would be helpful if you/ your friends have worked in C#/ Visual Studio. You will need to add an extra dropdown for example, to choose your options from which gets sent to the board either in real time or during sending settings to the EEPROM on-board memory.
Sorry, my message wasn't complete, typing from my mobile.
You also would need to introduce some code into Ardupilot, mainly GCS_Mavlink.pde to have your custom commands work in real time. I have PM you my Skype ID. I can help you, if you may have specific questions.
- Shyam

Hi Shyam

Thanks for reply - You are sound guy. 
Yes - it meant to be desktop application. We've been trying to read Mission Planner code for hours and I guess the size of it is overwhelming for armatures like us. We didn't succeed to compile it either.
Library's or references missing that we couldn't find. 

Is there no crop version of MP without all extra stuff that we don't need (like DataFlash/ Mission WP planning/ Settings Config, etc) that would compile without trouble?



You have to use Visual Studio 2012 and build it with less trouble. You can use VS 2010, but you might face a whole chunk of assembly mismatch and will be time consuming. It is better to have original VS 2012, get a download from Microsoft website or if you want to get a cracked version of it you are free to do so (but I won't recommend that on a public forum :)

AFAIK, the answer to your question is No. There is no cropped version of MP (for a desktop application built in C#). You can use QGroundControl, etc. But, if you were to build MP yourself on your Windows PC, I would simply go and remove the DataLogger, Flight Planning page, Settings etc that you don't need by just removing the tab pages from the UserControl form GUI - and boom its done - no rocket science there. You don't add or remove code directly to make it light weight, just delete what you don't want.. This makes it comfortable light for your use.

Thanks Shyam
I'll give it a try.
We all have VS 2012 (or 13 some of us)

I'll get back to you tomorrow

Hello sir, thanks alot for the amazing guide.

Just quick question, I read that mavlink sends always the first byte of the packet as 0xfe, however i searched both (MP and APM) source codes for this byte to know how the packet is constructed, but didn't find it!!!

Any idea?

Hi Hassanayoub85,

Here is what I find from mavlink_types.h file.

#define MAVLINK_CORE_HEADER_LEN 5 ///< Length of core header (of the comm. layer): message length (1 byte) + message sequence (1 byte) + message system id (1 byte) + message component id (1 byte) + message type id (1 byte)
#define MAVLINK_NUM_HEADER_BYTES (MAVLINK_CORE_HEADER_LEN + 1) ///< Length of all header bytes, including core and checksum


You would find from the above that the "Length of all header bytes" amounts to 6 bytes. As per the tutorial I wrote, each MavLink packet has a size of 6 bytes for the header, which includes the start byte. I didn't get the time to search 0xFE in the code, I am sure it is hiding somewhere ;)


© 2018   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service