Telemetry Forwarding with Mavproxy

The data went through!

I can see most of it under Comp 158 → text.

Now in order to receive the values in a separate script I just have to add another UDP endpoint on the pi side (lets say 14552) and listen on that port using pymavlink.mavutil.mavlink_connection() right? Using the examples from mavlink.io, I set up a listen.py script to test it. what functions should I use to access the incoming data? I saw that recv_math allows us to capture the message. Do I need to decode the message in order to print?

This screenshot shows my listen.py script running on my desktop along with QGroundControl receiving data in the text; the pi is sending using mavlink router where I added an extra endpoint 14552.

I used mavgen to create the plugin for Wireshark to detect the messages, but I’m not seeing them despite the live data coming through on QGC. I used common for the messages and mavlink 2.

I do see a bunch of MDNS protocol data coming in when QGC is running, but nothing else. How is QGC able to get the data, but nothing else? My listen script or wireshark? Does it have to do with the way it is sent in mavlink router?

1 Like

Yes, that’s correct.

A script like this would work:

#!/usr/bin/env python3
#This is a generic script for accessing MAVLink data over UDP port 14552

from pymavlink import mavutil

# Setup MAVLink to connect on udp 127.0.0.1:14552
conn = mavutil.mavlink_connection("udp:127.0.0.1:14552", autoreconnect=True, source_system=1, force_connected=False, source_component=mavutil.mavlink.MAV_COMP_ID_LOG)

# wait for the heartbeat msg to find the system ID
while True:
    if conn.wait_heartbeat(timeout=0.5) != None:
        # Got a heartbeat from remote MAVLink device, good to continue
        break

print("Got Heartbeat from ArduPilot (system {0} component {1})".format(conn.target_system,
                                                                 conn.target_system))

while True:
    msg = conn.recv_match(blocking=True, timeout=0.5)
    if msg:
        if msg.get_type() == 'STATUSTEXT':
            #print STATUSTEXT packet text
            print(msg.text)

I believe it gets stuck on the wait_heartbeat() when I run that script you shared with me. I’ve been playing around with other ways and have been stuck with this state:

In this image you can see it receiving continuously on the STATUSTEXT, but not on the listen script on the bottom left. Does it have to do with the connection type? I have the receiving sik telemetry radio in ttyUSB0 on the desktop.

This is how it is sending on the pi via ssh from a laptop.
image

I’ve taken a few steps and got some different results:

  1. Re-flashed a firmware Ardupilot 4.0.7
  2. Application Settings → General → Autoconnect to the following devices: Disabled all autoconnect except sik radio.
  3. Application Settings → Comm Links → Autconnect, Type: UDP, Port:14552.
  4. Application Settings → MAVLink → Ground Station: Enabled Emit Heartbeat, Enabled MAVLink Forwarding: to localhost:14552


I am now seeing some standard data for the firmware type and etc but I can’t see my sensors data going. I am also not seeing COMPONENT 158 anymore.

I haven’t touched my pi side script.

I’ve verified my serial data is still being sent to the flight controller using a TTL USB adapter, but I just can’t seem to see the data on component 158 now. Any ideas on why this is occurring???

Good morning Sir, I am doing a thesis on real-time characterisation of atmosphere using a drone swarm.
For that I look for receiving sensor data via mavlink messages. How can I proceed? Thank you.