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: Pymavlink · GitBook. 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.
There exists a fully-functioning ground control station (GCS) written with python and pymavlink: MAVProxy
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.
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.
Your code needs to send a heartbeat to the autopilot, then the autopilot will begin streaming data.
from pymavlink import mavutil
import time
master = mavutil.mavlink_connection('COM8',baud=115200)
msg = None
master.mav.heartbeat_send(
6,
8,
192,
0,
4,
3
)
while True:
while msg is None:
msg = master.recv_match()
print(msg.to_dict())
What am i doing wrong ? i still only get “NAMED_VALUE_FLOAT” and “HEARTBEAT” types of messages.
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