For the complete documentation index, see llms.txt. This page is also available as Markdown.

QGC Home Position Sender

This setup adds a QGroundControl Fly View action that tells an ArduPilot Lua script to send the flight controller's home position to the VNS Pi.

Components

  • ../home_position_sender.lua runs on the flight controller. It accepts either COMMAND_LONG 31000 or a marker request (COMMAND_LONG 512 with param1=242, param2=31000), reads the FC home position, then sends MAV_CMD_DO_SET_HOME to the Pi at sysid 218, compid 190.

  • FlyViewCustomActions.json runs on the QGC computer. It adds the Send Home to Pi action in Fly View and sends command 31000 to the active vehicle.

Flight Controller Setup

1

Enable Lua scripting

Enable ArduPilot Lua scripting (SCR_ENABLE=1) and reboot the flight controller.

2

Copy the home position sender script

Copy home_position_sender.lua to the flight controller SD card:

/APM/scripts/home_position_sender.lua
3

Copy the MAVLink Lua modules to:

/APM/scripts/modules/MAVLink/

At minimum this script needs:

mavlink_msgs.lua
mavlink_utils.lua
mavlink_msg_COMMAND_LONG.lua
mavlink_msg_COMMAND_ACK.lua
mavlink_msg_HEARTBEAT.lua
4

Reboot or restart scripting

Reboot the flight controller or restart scripting.

Home and Estimator-Origin Requirements

The script has deterministic home selection logic:

  1. Use vehicle:home() first.

  2. Use ahrs:get_home() only if vehicle:home() did not return a home object.

What this means operationally:

  • The script sends only the selected home position (lat/lon) to the Pi.

    • The device will use the terrain data from onboard maps to determine altitude.

  • Estimator origin coordinates are never sent to the Pi by this script.

  • Estimator origin must be initialized at least once before the home position is considered valid.

  • Home position and estimator origin do not need exact coordinate equality, but they must be in the same operating area.

  • If estimator origin is not initialized, or home resolves to an invalid value (nil or 0,0), the script does not send MAV_CMD_DO_SET_HOME and QGC can show a timeout.

Expected startup message:

QGroundControl Setup

Copy FlyViewCustomActions.json to QGC's MAVLink actions directory.

Restart QGC after copying the file.

Testing the feature

  1. Click on the map and select "Set Estimator Origin"

  2. Click on the map and select "Set home here"

  3. In Fly View, open the Actions menu and click "Send Home to pi"

You should see the vps startup status text messages in the mav messages when the vps restarts.

References

Last updated