Mavlink Basics

So, I'm developing a ground station for iOS devices (iPhone/iPad) and after making a lot of progress, I came upon a major stumbling block. I can not wrap my head around how the mavlink protocol works. The iOS side of the project is easy but i'm stuck on how the messages are generated/formatted. 

Btw, I already worked out how to send serial communications to and from the iPhone (Jailbroken) and I'm finishing up an xbee docking prototype that attaches to the back. I just don't have an ardupilot mega yet and won't have one for a couple months. I really want to start working on the program so I need any help that anyone can offer.

Thanks,

Andrew

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

Join diydrones

Email me when people reply –

Replies

  • the dock connector requires root access and apple charges tens of thousands of dollars to have a iPhone bluetooth device but wifi is allowed

    I don't understand... why would you deal with a company that would try to rip you off like that?  $10k to use the bluetooth device you already paid for?

  • hi there, I have interested in your project, and i have study Mavlink protocol by myself and also have some experiences of developing Obj-C, can i help you in your project?

  • Have you tried to connect to a APM yet? To see how the arduino handles the code.

  • This is me testing the iPhone serial port using two xbees and the arduino serial lcd example. It works like a champ! and now its time to keep working on the main app!

  • If you do an iOS app I'll be the first to buy it :-) But please include a Bluetooth-Serial option - I use Bluetooth-APC220 convertor (no need for a XBee dock) - the same can be done with XBee and it's much more universal (you can connect anything that has bluetooth - which is, well, everything :-))

    Making a convertor costs $8, dock is clumsy and connector specific...

  • Thank you so so much!!!! its like a lightbulb just went off in my head! 

    But basically, I would interpret the heartbeat message using the parameters defined in all the xmls? 

     <message name="HEARTBEAT" id="0">
         The heartbeat message just shows that a system is present.
         <field name="type" type="uint8_t">Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)</field>
         <field name="autopilot" type="uint8_t">Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM</field>
       </message>

    And I would write code for each type of message I receive? Like if i got a heartbeat message I would make make sure the GCS is setup for that type of aircraft and the type of autopilot? and set a timer so that if I don't get a heartbeat ever "x about of time" passed, I alert the user to take manual control immediately?

    P.S.- I am planning on making the Xcode project open source on my website but do you think it would be asking too much to charge $0.99 or $1.99 for the prepackaged version on Cydia?

  • It may not help much, but I wrote a mavLink wrapper for android phones. Looking at that stripped down code might give you the insight you need to do the same on iphones

    http://code.google.com/p/copter-gcs/source/browse/# copter-gcs/jni/

    parseFunctions.h is a good start

    The basic idea is that you receive a byte, and push it into mavlink, until it says good decode (gets you a mavlink_message_t& message), at which point you would (example is for a heartbeat packet):

    message.msgid gives you a constant, i.e., MAVLINK_MSG_ID_HEARTBEAT so you know what type to decode

    //Decode

    mavlink_heartbeat_t inp;

    mavlink_msg_heartbeat_decode(&message, &inp)

    and read the appropriate fields from inp struct.

    on the way out (to send), simply pass the fields as (again for a heartbeat):

    mavlink_message_t& msg

    uint8_t system_id = 255;

    uint8_t component_id = 0;

    type=MAVLINK_MSG_ID_HEARTBEAT

    mavlink_msg_heartbeat_pack(system_id, component_id, &msg,type, autopilot);" where 

     

    and any remaining parameters are what is being sent out, as per the headers. After that you can just bang out the bytes over the xbee.

    Anyway, might be worth a look, as it does exactly what you want, except it does it on android.

    Looking forward to seeing a GCS for iOS:)

    Cheers,

    Bart.

This reply was deleted.

Activity

DIY Robocars via Twitter
RT @gclue_akira: 柏の葉で走行させてるjetracerの中身 #instantNeRF #jetracer https://t.co/giVvuE4hP7
Jul 4
DIY Robocars via Twitter
Cool web-based self-driving simulator. Click save when the AI does the right thing https://github.com/pncsoares/self-driving-car
Jul 4
DIY Robocars via Twitter
RT @donkey_car: Human-scale Donkey Car! Hope this makes it to a @diyrobocars race https://www.youtube.com/watch?v=ZMaf031U8jg
Jun 25
DIY Robocars via Twitter
Jun 25
DIY Robocars via Twitter
Jun 16
DIY Robocars via Twitter
RT @GrantEMoe: I won my first @diyrobocars @donkey_car virtual race! Many thanks to @chr1sa @EllerbachMaxime @tawnkramer and everyone who m…
Jun 13
DIY Robocars via Twitter
RT @gclue_akira: JetRacerで自動走行したコースを、InstantNeRFで再構築。データセットは別々に収集 #jetracer #instantNeRT https://t.co/T8zjg3MFyO
Jun 13
DIY Robocars via Twitter
RT @SmallpixelCar: SPC 3.0 Now the motor also works. This car is doable. I just need to design a deck to mount my compute and sensors. http…
Jun 13
DIY Robocars via Twitter
RT @SmallpixelCar: My new car SPC 3.0. https://t.co/CKtkZOxeNQ
Jun 7
DIY Robocars via Twitter
RT @SmallpixelCar: High speed at @diyrobocars thanks @EdwardM26321707 for sharing the video https://t.co/o4317Y2U1S
Jun 7
DIY Robocars via Twitter
RT @SmallpixelCar: Today at @RAMS_RC_Club for @diyrobocars. Used @emlid RTK GPS and @adafruit @BoschGlobal IMU. Lap time 28s https://t.co/R…
May 28
DIY Robocars via Twitter
May 15
DIY Robocars via Twitter
May 14
DIY Robocars via Twitter
May 13
DIY Robocars via Twitter
RT @f1tenth: Say hi to our newest #F1TENTH creation for @ieee_ras_icra next week in Philly. It’s going to be huge! 😎 🔥 @AutowareFdn @PennEn…
May 13
DIY Robocars via Twitter
May 11
More…