New: the AI firewall watches the whole platform and explains each incident in plain words. See how it works

Showing an inspection drone’s position and flight path live on a board

Showing an inspection drone’s position and flight path live on a board

Solved 6 4

We inspect solar fields with a small quadcopter and the client asked to “watch the flight” from their office, plus see afterwards which rows were covered. The drone runs a common open-source autopilot (MAVLink 2), and has a Raspberry Pi Zero 2 W as companion computer with a 4G stick for the video link already.

I’d like position, altitude and battery on a Hermetry board with a map, live, and a replay of the path after the flight. How do you even get data out of a flight controller? I’ve never touched MAVLink, I usually do inverters and meters.

♥ 0

Which autopilot firmware and which port is free on it? Most have a second telemetry port meant for a companion computer.

If it isn't logged, it didn't happen.
♥ 0

Side question, are you even allowed to send telemetry over 4G from a drone where you are? Some places have rules about that.

♥ 0

TELEM2 is free, the Pi is already on it at 921600 for the video tool. And yes, we have the permissions for the sites we fly.

♥ 1

Did this for a roof inspection drone, so here’s what I ended up with.

On the Pi, pymavlink reads the MAVLink stream from TELEM2. You only need two messages: GLOBAL_POSITION_INT (lat/lon in 1e7 degrees, relative altitude in mm) and SYS_STATUS (battery voltage in mV). Once a second, publish a flat object over MQTT with TLS:

from pymavlink import mavutil
m = mavutil.mavlink_connection("/dev/serial0", baud=921600)
state = {}
while True:
    msg = m.recv_match(type=["GLOBAL_POSITION_INT", "SYS_STATUS"], blocking=True)
    if msg.get_type() == "GLOBAL_POSITION_INT":
        state.update(lat=msg.lat / 1e7, lng=msg.lon / 1e7, alt_m=msg.relative_alt / 1000)
    else:
        state["batt_v"] = msg.voltage_battery / 1000
    if time.time() - last >= 1:
        client.publish("v1/telemetry", json.dumps(state), qos=1); last = time.time()

Name the keys lat and lng, that’s what the Map card looks for by default.

On the board, a Map card. Bind Points to the drone’s latest values (lat, lng), and that’s your live marker. Bind Routes to Device readings over time with the keys lat,lng, and turn on Replay controls. The client can play the flight back at 1x to 10x and scrub. Add a value card for battery and altitude next to it. Satellite map style helps them see the panel rows.

1 message a second is far inside the default per-device limits. And keep it read-only: no commands from the board to the drone, the pilot flies it.

Ground loops are my cardio.
Accepted solution♥ 9

Worked on the first test flight. Live marker moves, and the replay after landing showed exactly which rows we covered, the client loved the scrubbing. Had lat/lon as the key at first and the map said “No rows with valid coordinates”, renamed to lng and it appeared.

♥ 2

The replay part is really nice, I didn’t know the map could do that.

♥ 2
Viewing 7 posts – 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Join the conversation

Sign in to ask and answer, like helpful posts and mark the reply that solved your problem. Every contribution earns points and levels.

Share