AP_Scripting: add set_origin and initialised bindings
added bindings and example scripts
This commit is contained in:
parent
0217d1c3dc
commit
c34322f6ce
23
libraries/AP_Scripting/examples/ahrs-set-origin.lua
Normal file
23
libraries/AP_Scripting/examples/ahrs-set-origin.lua
Normal file
@ -0,0 +1,23 @@
|
||||
-- example script for using "set_origin()"" and "initialised()"
|
||||
-- sets the ekf origin if not already set
|
||||
|
||||
|
||||
function update ()
|
||||
|
||||
if not ahrs:initialised() then
|
||||
return update, 5000
|
||||
end
|
||||
|
||||
origin = assert(not ahrs:get_origin(),"Refused to set EKF origin - already set")
|
||||
location = Location() location:lat(-353632640) location:lng(1491652352) location:alt(58409)
|
||||
|
||||
if ahrs:set_origin(location) then
|
||||
gcs:send_text(0, string.format("Origin Set - Lat:%.7f Long:%.7f Alt:%.1f", location:lat()/10000000, location:lng()/10000000, location:alt()/100))
|
||||
else
|
||||
gcs:send_text(0, "Refused to set EKF origin")
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
return update()
|
@ -46,6 +46,8 @@ singleton AP_AHRS method set_posvelyaw_source_set void uint8_t 0 2
|
||||
singleton AP_AHRS method get_vel_innovations_and_variances_for_source boolean uint8_t 3 6 Vector3f'Null Vector3f'Null
|
||||
singleton AP_AHRS method set_home boolean Location
|
||||
singleton AP_AHRS method get_origin boolean Location'Null
|
||||
singleton AP_AHRS method set_origin boolean Location
|
||||
singleton AP_AHRS method initialised boolean
|
||||
|
||||
include AP_Arming/AP_Arming.h
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user