I’m currently trying to set my EKF origin and on mission planner map it cannot set it from there as it refuses the origin. My question is from the GitHub link posted will ahrs-set-origin.lua be the correct file to set the EKF by using coordinates and altitude?
Note: This is just for confirmation if this .lua file is the correct one for the function I’m looking for.
Also, would the altitude be set in m or feet? I’m currently assuming m.
These are some of the errors I got (I’m trying to fix requires position but now I also have PreArm: AHRS: EKF3 Yaw inconsistent, I’m not sure if it is because of the same reason):
The code I used was with my longitude and latitude as well as my altitude in m:
– 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(6, 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
Looks like it’s #2 (from his parameter file). This script works in the simulator after setting this to 0. Default script coordinates set it to the well known Canberra Model Aircraft club…
I’m not really familiar with Lua scripts as I’ve only really learnt about them yesterday. If the constraint was removed would that mean it should run without any problem? Would I just need to use the same code again once edited?
You’re right, it is set up for the optical flow and not for normal operation. Do you think I will have to put in the Lua code again without the constraint?
Does this mean I can now use the updated script which contains the change and it should work? Also, with the error SmartRTL: requires position or any position required can this not be bypassed if the gps is not being used?
Are position errors because of EKF origin was not set properly or is it related with GPS? In the case of EKF, shall I re-download the script to mission planner? Also initially when I put my drone down there is a lot of errors but eventually they go away is that fine or something I need to correct?
Is it possible to disable SmartRTL and the drone won’t need position since it is indoors.
The script has not changed. The PR is to change action in firmware. set EK3_SRC1_POSXY to 0 and move along. You will know if the script is doing it’s thing in Mission Planner when the home position Icon is where you set it to be in the script.