ardupilot/libraries/AP_Scripting/examples/ahrs-print-home-and-origin.lua
CallanDaniel a617175881 AP_Scripting: add get_origin and set_home bindings
added bindings and example scripts for set_home and get_origin
2021-06-23 10:11:02 +09:00

21 lines
545 B
Lua

-- example script for using "get_origin()"
-- prints the home and ekf origin lat long and altitude to the console every 5 seconds
function update ()
home = ahrs:get_home()
origin = ahrs:get_origin()
if home then
gcs:send_text(0, string.format("Home - Lat:%.1f Long:%.1f Alt:%.1f", home:lat(), home:lng(), home:alt()))
end
if origin then
gcs:send_text(0, string.format("Origin - Lat:%.1f Long:%.1f Alt:%.1f", origin:lat(), origin:lng(), origin:alt()))
end
return update, 5000
end
return update()