Create Mavlink message to inject in Cockpit

Hi All,

I’m trying to display a custom value in Cockpit as a NAMED_VALUE_FLOAT message sent from my surface computer with a Python script, but Cockpit never shows it in the MAVLink Inspector.

Is there any guide or reference to do it?

Thanks in advance

There’s a chance the message is arriving but as there are many other NAMED_VALUE_FLOAT messages incoming, you never see yours.

An easier way to debug that is opening Menu>Tools>DataLake, searching for NAMED_VALUE_FLOAT and checking if your variable is there.

Please consider the python script is located on the topside PC . So i’m attempting to inject it directly into Cockpit. The Test script is the following but after i tried i’m unable to locate the paramenter inside the datalake:

#!/usr/bin/env python3
from pymavlink import mavutil
import time

# Try sending directly to BlueOS telemetry ports
TARGET_IPS = [
    ("udpout:192.168.2.2:14550", "Main Cockpit port"),
    ("udpout:192.168.2.2:14552", "Alternate telemetry"),
    ("udpout:192.168.2.2:14600", "Extra test port")
]

for conn, label in TARGET_IPS:
    print(f"\n[TRY] Sending to {conn} ({label})")
    try:
        m = mavutil.mavlink_connection(conn, source_system=245, source_component=191)
        for i in range(5):
            value = -0.812 + 0.001 * i
            m.mav.heartbeat_send(18, 8, 0, 0, 4)
            m.mav.named_value_float_send(int(time.time()), b"CP_VOLT\x00\x00\x00", value)
            print(f" → Sent CP_VOLT={value:.3f}")
            time.sleep(1)
        m.close()
    except Exception as e:
        print(f"[ERR] {e}")

Oh, ok, this changes things a little bit!

We didn’t merge yet the consumption from MAVLink sources other than the main vehicle. Coincidently I was working on that during last week and the PR is open for review. I would ask you to test it from those binaries, which also includes some modifications on Menu>Tools>DataLake to make it easier to find your data.

To enable it, go to Menu>Settings>General on Cockpit and click “Enable Pirate Mode”. After that go to Menu>Settings>MAVLink and click “Enable DataLake variables from other systems”. Than you can use Menu>Tools>DataLake to find your data. It should be under /mavlink/system=X/component=Y being X and Y the MAVLink SystemID and ComponentID of your script.

1 Like

Hi Rafael,

thanks for the quick reply.

I’ll have a look asap and come back on it.

I’ve downloaded and installed the Version 1.17.0-beta.7 . Can you confirm the “Enable DataLake variables from other systems” is something that need to be enabled somewhere? I’ve not found anything related on it.

It’s not on Beta7. It’s in the binaries from the PR (not merged yet) that I mentioned in my previous comment: Improve reading names on the DataLake tools menu · bluerobotics/cockpit@cbd71a8 · GitHub