Home        Store        Docs        Blog

Making Gui with Pymavlink

(Halil İbrahim Bengü) #1

Hi all,
I am new to mavlink and trying to learn it to make my own gui to communicate with pixhawk via a companion RPI to control it remotely. I am trying to use pymavlink, but i can’t figure out how to use it. I could only find this page for examples: https://www.ardusub.com/developers/pymavlink.html. I don’t understand how to use any of the commands listed here: http://mavlink.org/messages/common. For example how do i recieve imu data. As i can said i am new to that kind of topics and english isn’t my native language so forgive me for any mistakes or if this is a silly and easy question. Thank you for your time. I would appreciate any kind of help.

(Jacob) #2

There exists a fully-functioning ground control station (GCS) written with python and pymavlink: http://ardupilot.github.io/MAVProxy/html/index.html

You can look at the MAVProxy source code for examples on reading the imu data, there is also examples of reading data in the ardusub pymavlink examples that you linked, specifically the " Receive data and filter by message type". Use the mavlink message with the data that you are interested in. If you have a more specific question or some error, please let us know.

(Halil İbrahim Bengü) #3

Thank you for your reply Jacob. I will look at the source code of MavProxy but i have an another question. I only recieve “NAMED_VALUE_FLOAT” and “HEARTBEAT” message types from * master.recv_match() * command. I don’t understand how to specifically request imu values.

(Jacob) #4

Your code needs to send a heartbeat to the autopilot, then the autopilot will begin streaming data.

(Halil İbrahim Bengü) #5
from pymavlink import mavutil
import time

master = mavutil.mavlink_connection('COM8',baud=115200)

msg = None


while True:
    while msg is None:
        msg = master.recv_match()

What am i doing wrong ? i still only get “NAMED_VALUE_FLOAT” and “HEARTBEAT” types of messages.

(Halil İbrahim Bengü) #6

Ok, when i try to communicate with a companion RPI and use UDP connection now i am able to recieve the data i want. Thank you