From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Interfacing Ardupilotmega with Labview with Mavlink Protocol

Thanks for replying

Now I can see data like this FE  09  4E  01  01  00  00  00  00  00  02  03  51  04  03  1C  7F

Still trying to understand how this becomes flight data but I found this website which talks about it.

 

http://eastbay-rc.blogspot.com/2013/04/mavlink-protocol-notes-packet-decoding.html

 

 

 

0 Kudos
Message 11 of 75
(3,549 Views)
0 Kudos
Message 12 of 75
(3,534 Views)

Hey guys, I was able to get this far. I'm not sure how to binary operations like logic shifts in Labview so I used a boolean array to represent the checksum.

 

However, it is not displaying what the MAVlink calculated as a checksum. I might be understanding the protocol wrong.....

 

 

0 Kudos
Message 13 of 75
(3,512 Views)

Hey I dont know if this helps but founds this vi for calulating checksum.

 

http://diydrones.com/forum/topics/mavlink-1-0-checksum-protocol

0 Kudos
Message 14 of 75
(3,507 Views)

Yea, I looked at that, for some reason, it doesn't compute the correct checksum.. 

I'm re-writing mine today, so we'll see if I succeed.

0 Kudos
Message 15 of 75
(3,494 Views)

It works!!!. I found my main program to be catching the wrong checksum values. I need to see what the heck is going on there.

But this simple VI works. I need to make an array table for the CRC_EXTRA byte to add at the end of payload data.

Capture.PNG

0 Kudos
Message 16 of 75
(3,478 Views)

Heres what I got so far which seems to work at least reading heartbeat. Now I need to find out how to convert the payload data to useful values via labview

any Ideas?

 

Thanks

Download All
0 Kudos
Message 17 of 75
(3,462 Views)

It looks like all you have left to do is pull out those 9 data bytes from each message and convert the hex to a decimal, then apply whatever scale factor applies.

0 Kudos
Message 18 of 75
(3,430 Views)

Thanks Karl

 It pobbley would of took me two weeks to figure that out.

 

Quick question and I think maxmus083 stated talking about this. How would you be able to produce the right CRC values  to check the checksum?

I know that the common.h contains which extra checksum value to use for exmaple Heartbeat (MAVLINK_MESSAGE_LENGTHS) 9 = 50  (MAVLINK_MESSAGE_CRCS) . How would I appached which value to use if some Mavlink Messages have the same lengths(blue)?

 

#define MAVLINK_MESSAGE_LENGTHS {9,31,12,0,14,28,3,32,0,0,0,6,0,0,0,0,0,0,0,0,20,2,25,23,30,101,22,26,16,14,28,32,28,28,22,22,21,6,6,37,4,4,2,2,.....}

 

#define MAVLINK_MESSAGE_CRCS

{50,124,137,0,237,217,104,119,0,0,0,89,0,0,0,0,0,0,0,0,214,159,220,168,24,23,170,144,67,115,39,246,185,104,237,244,222,212,9,254,230,28,28,132,221,......}

 

 

0 Kudos
Message 19 of 75
(3,402 Views)

the CRC extra is added by message ID alone. so each array field number corresponds with the message ID.

so for heart beat, which is 00, corresponds with number 50 for crc extra, which in hex is 32.

 

there are total of 255 possible message ID's, and you will find that the array below is also 255 fields long.

 

so message id and crc looks like.

0, 1, 2, 3, 4, 5,... etc. with..

 

50,124,137,0,237,217,104,119,0,0,0,89,0,0,0,0,0,0,0,0,214,159,220,168,24,23,170,144,67,115,39,246,185,104,237,244,222,212,9,254,230,28,28,132,221,...... each one. get it?

 

hope that helps. 

0 Kudos
Message 20 of 75
(3,392 Views)