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 Cyclops computer.
Components
../home_position_sender.luaruns on the flight controller. It accepts eitherCOMMAND_LONG 31000or a marker request (COMMAND_LONG 512withparam1=242,param2=31000), reads the FC home position, then sendsMAV_CMD_DO_SET_HOMEto the Pi at sysid218, compid190.FlyViewCustomActions.jsonruns on the QGC computer. It adds theSend Home to Piaction in Fly View and sends command31000to the active vehicle.
Flight controller setup
Home and estimator-origin
The script has deterministic home selection logic:
Use
vehicle:home()first.Use
ahrs:get_home()only ifvehicle: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 (
nilor0,0), the script does not sendMAV_CMD_DO_SET_HOMEand 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
References
ArduPilot Lua scripting: https://ardupilot.org/copter/docs/common-lua-scripts.html
ArduPilot MAVLink command Lua example: https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_Scripting/examples/MAVLink_Commands.lua
QGC custom MAVLink actions: https://docs.qgroundcontrol.com/Stable_V5.0/en/qgc-user-guide/custom_actions/custom_actions.html
Last updated



