First just make sure that your file extension is ending with “.lua” because under Windows, the texte editor has a tendency to add .txt at the end
Second , I experienced an issue with the lat lng alt format on the example, I kept getting
number has no integer representation
I placed my EKF ORIGIN manually and cut&paste the numbers from Mission Planner and it works OK
Here is the line I changed with my coordinate … Coliseum @ Québec City
location = Location() location:lat(4.682895e+08) location:lng(-7.125028e+08) location:alt(-78.0)
@ppoirier, are you sure you were using 4.1 firmware? I’m almost certain that the script will not work unless 4.2 is in use (as tested on actual Cube Orange hardware).
Given the frustration already expressed by the OP so far, it’s probably not wise for him to update his autopilot to the master branch right now. The script will not work on his autopilot running 4.1.2.
I read your last comments and very much appreciate the attention you paid to my requests and I also wanted to thank you for the work you do in the community.
I will take into account @ppoirier’s remarks
and those of Yuri. test and retest version 4.2 and earlier and see if it works and what benefit I can get from it. I will tell you all that in my next message. thank you again very much
sorry bad translation: 4.2 works but
with version 4.2 the scripts home point or origin don t start. Yes Extension is .lua no .txt
i reboot FC after modifs yet.
morever, in 4.2 if i set origin manually the location displayed but when i turn wheels the distances don’ t move, stay fixed. with version 4.1.2 if manually set origin (right clic map, set home home here…) all is OK.
it s seems same thing with script: NOK message and NOK origine SET
i m not sure understand : SERVOn_FUNCTION to -1
my encoder is in 55 (pin B) and 54 (pinnA) AUX 6 and 5
when i have a look for my servos, only SERVO1_FUNCTION is on 55 but anyone on 54.
i have to set -1 in serv01 only ? it is that ?
– 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
gcs:send_text(0,"STARTING SCRIPT EKF ORIGIN")
origin = assert(not ahrs:get_origin(),"Refused to set EKF origin - already set")
location = Location() location:lat(4.682895e+08) location:lng(-7.125028e+08) location:alt(-78.0)
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