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:

3691077228?profile=original

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!!

Options:

- 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,

Shyam

MAVLINK_FOR_DUMMIESPart1_v.1.1.pdf

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

    • Hi Shyam,

      Yes we have tried it. As you can see here

      https://groups.google.com/forum/#!topic/qgroundcontrol/dk3-ekMhxPI

      MissionPlanner works ok, but it is in C# and debugable mainly under Windows. Our libraries are in C++ using Qt. And we all are developing mostly using Linux.

      Qgrountcontrol does not work. But as you can see in the discussion in mail list above, APM planner (Qgrouncontrol fork) works ok. So currently we are debugging APM planner source.

      What we are missing is something like sequence diagrams documentation for MAVLink communication (e.g. Automission example). I don't know if something like this exists at all. But I didn't find it yet in any documentation. Or the MAVLink interpretation rules are so weak that it depends on every MCB how it behaves according to MAVLink commands (especialy those LONG ones). 

      Regards

      Google Groups
      Google Groups allows you to create and participate in online forums and email-based groups with a rich experience for community conversations.
  • Thanks, I am trying to learn more! Blue Skies!

  • 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
      #define MAVLINK_NUM_CHECKSUM_BYTES 2
      #define MAVLINK_NUM_NON_PAYLOAD_BYTES (MAVLINK_NUM_HEADER_BYTES + MAVLINK_NUM_CHECKSUM_BYTES)

      #define MAVLINK_MAX_PACKET_LEN (MAVLINK_MAX_PAYLOAD_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES) ///< Maximum packet length

      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 ;)

    • Thanks for your answer.

      I searched the whole code for 0xfe, and found it once on "libraries\GCS_Console\GCS_Console.h":

      #define DATAMSG_TYPE_CONSOLE 0xFE.

      But this file is notincluded in ardurover, even if i delete it, the solution is compiled successfully.

      Any idea?

    • Hassan,
      If it incorporates byte memory for this byte then it ought to be getting generated somewhere. I am sorry currently, i am not having access to code as i am on a travel. Hopefully i can be of some help when i am back, if you still haven't figured out.

      Regards,
      Shyam
    • Shyam, Thank you for taking time out and putting this great information together

      As I have been hunting through forums for some time now. I noticed you also were interested in this subject of running Arduino MAVlink setup, given in this guide
      http://qgroundcontrol.org/dev/mavlink_arduino_integration_tutorial

      - Did you have success in able to compile this code. ?
      - Were you able to send mavlink packets ?

      The code here,Arduino-MAVLink integration guide doesn't seem to compile ( I upgraded to V1.0 mavlink)

      I plan to run mavlink on Arduino. Goal is to send attitude packets to APM/PX4 to do outside attitude control.

      If you can share some learning as to what you did (any specific post links you found or referred to )

      Thanks!

    • Hi Phoenix,

      Sorry for the late response. I do not know if you have already solved the issue by now.

      As far as I remember, I had some trouble compiling that piece of code on qgroundcontrol's website, but was eventually able to compile the code (had to make minor changes in header file locations).

      Also, make sure you have the MavLink header file accessible and that is where I remember I got one of the compile errors. Can you share what error you got?

      Regards,

      Shyam 

    • Hi Shyam, I din't try it as eventually realized the packet will go via qgroundcontrol and that will be too slow.

      For what I need is able to send packets(attitude) from on board secondary controller when UAV is in flight. I started manipulating Ardustation code base , removing the parts and keeping only MAVLink , currently still in middle on making it it work.

      If you have a better recommendation for external control of PX4/APM please suggest?

    • Hi Phonix,

      If you are just starting out with a secondary controller, it might be good to use a beaglebone or Raspberry Pi as there is a lot of support there for it. I have tried it on the Rpi and it would work well.

      However, I didn't get your point when you said 'too slow'. What do you find as slow?

      PS: I am sorry for the late reply, as I have been more on travel nowadays.

      Regards..

This reply was deleted.