Reading GPS data in via Mavlink

OpenMV related project discussion.
User avatar
dcolemans
Posts: 31
Joined: Fri Aug 25, 2017 9:43 am

Reading GPS data in via Mavlink

Postby dcolemans » Wed Feb 06, 2019 12:18 pm

I've studied the two Mavlink examples which send control data to the drone via Mavlink protocol. But I'd like to read GPS information from the drone into my OpenMV python script. I've found the layout of the GPS message I think I should use https://github.com/mavlink/c_library_v1 ... _raw_int.h but how to bring all that in via UART, find the message number, unpack it into usable fields all rather escapes me. I expect I'll have to set parameters in the Pixhawk flight controller to get it to send the right message(s). Anybody have an example of Python code that pulls data via Mavlink?
Dave
User avatar
kwagyeman
Posts: 3044
Joined: Sun May 24, 2015 2:10 pm

Re: Reading GPS data in via Mavlink

Postby kwagyeman » Wed Feb 06, 2019 12:26 pm

Nyamekye,
User avatar
dcolemans
Posts: 31
Joined: Fri Aug 25, 2017 9:43 am

Re: Reading GPS data in via Mavlink

Postby dcolemans » Wed Feb 06, 2019 3:13 pm

Hi Kwabena,

Well, I've pondered the example referenced and feel like rather a dummy. Python is all a bit obscure to me, but I do see where he's reading a byte at a time, looking for what for him is a start sequence, building up a packet until some rather obscure code that deals with a checksum to end the packet. I guess I was hoping for something a bit more Mavlink specific, including an example of unpacking the data into fields.
Dave

Return to “Project Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest