Well it took me some time but I finally feel confortable with lua and ardupilot sitl environment !
Now I wrote the script you advised me to :
“gcs:send_text(6,” !!! STARTING LUA SCRIPT !!!")
duree = 0
val = 5
function update ()
– on commence par lire le mode en cours :
if vehicle:get_mode() == 23 or vehicle:get_mode() == 4 or vehicle:get_mode() == 9 then
rc4 = rc:get_pwm(4)
gcs:send_text(6, "Mode guidé ou follow avec rc4 = " … rc4)
if rc4 > 1600 then
val = val + 1
if val > 100 then val = 100 end
param:set_and_save(“FOLL_OFS_Z”, val)
gcs:send_text(6, "PARAM FOLL_OFS_Z Set to " … val )
elseif rc4 < 1400 then
val = val - 1
if val < - 100 then val = 100 end
param:set_and_save(“FOLL_OFS_Z”, val)
gcs:send_text(6, "PARAM FOLL_OFS_Z Set to " … val )
end
end
return update, 1000
end
return update, 1000
"
However It is not working. I then realized that it was the foll_ofs_z that is not taken by arducopter… I opened an issue yesterday about this “Foll_ofs_z in follow not working with copter” so if you have an idea it would be nice.
Also I found your github about pymavlink and it helped me a lot so I wanted to thank you personally for this ! I can’t wait for you to share the lua codes for all you plan to share.
Thank you again for your help