Sending Data from Raspberry Pi to Topside Computer

Hi, so per this thread, and the scripts on the pymavlink page on the ardusub documentation, I’ve managed to send some udp messages from a python script running on the Pi to QGroundControl, where I can see it on the widget inspector.

However, what I would like is to be able to read those same messages by a separate python script, where QGroundControl isn’t running. The way I have it now is on the sending script on the Pi, I establish the connection as follows: master = mavutil.mavlink_connection('udpout:192.168.2.1:14550',source_system=2, source_component=2). With the reading script, I am establishing the connection with master = mavutil.mavlink_connection('udpin:192.168.2.1:14550').

The only way I’ve been able to see data with the script is if I start sending the custom data with QGroundControl open, and then close QGC and start reading with my script. If I try just the script, I can read all the other telemetry coming from the mavproxy, just not the message that I’m sending with the python script on the Pi.

Edit: So it turns out I can see the custom messages with my script only. This custom message is a NAMED_VALUE_FLOAT message being sent on port 14550, so I only very occasionally get it (I had to sit and wait for about 30 seconds before I saw the first occurrence.). All the other float message, like camtilt, etc are drowning it out. Should I try changing ports or message type?

Hi Ehan,

First, I would recommend you to take a look in our pymavlink documentation: Pymavlink · GitBook
You should not use the same port that QGC is using, follow our documentation to learn more how to integrate pymavlink scripts with BlueROV2 setup. Doing that will probably fix your problem.

Hi Patrick,

Thanks for the reply. The example code on the pymavlink has been of limited help mainly because it seems to be showing how to replicate the functionality of QGC with pymavlink or the companion software (if run on the Pi) and therefore uses ports 14550 or 9000.

I’ve tried simply using different ports (14500, 14549, and maybe 14540 but I’ve read that the last one is the default listening port for offline APIs) and I get nothing on the connection. I’ve also tried sending a NAMED_VALUE_INT message on port 14550 and don’t see the message there, either, unless it’s through the QGC mavlink inspector widget.

Really stumped on why a different port doesn’t work, unless there’s some undocumented port configuration steps that I have to go through.