Help Understanding Magic Number Trying to Parse Mavlink Messages

252 views
Skip to first unread message

Daniel Martin

unread,
Apr 19, 2016, 12:55:17 PM4/19/16
to MAVLink
Hello,

I have ran the python -m mavgenerate tool to create my python mavlink bindings, I have intercepted entire communication between my drone and controller into a pcap file and now I am trying to take mavlink data packets from the pcap file and decode it using python code.

Ex.

fe1958019a160000000031000200474d425f5941575f4400000000000000095f5a        ***Parsed Pcap file to create file of mavlink messages


I am trying to run these encoded mavlink commands through the mavlink.py decode function

magic, mlen, seq, srcSystem, srcComponent, msgId = struct.unpack('cBBBBB', msgbuf[:6])


but I keep on getting the below error:


Unable to unpack MAVLink header: unpack requires a string argument of length 6


I am now trying to unpack the mavlink messages manually in a new python script but I do not understand what the magic value should be...I always thought it was just fe but it looks like it can only be one character and I am really confusing myself now?


I am new to mavlink and any help with this would be greatly appreciated.


R

Joe

Philipp Thomasberger

unread,
Jul 8, 2016, 10:35:45 AM7/8/16
to MAVLink
the magic value should be 1 byte in size, so a hexadecimal interpretation of the value will always have 2 digits. usually this should be FE.

are you maybe interpreting the byte as an ascii character?
Reply all
Reply to author
Forward
0 new messages