Hey! I’m a total newbie and I want to receive a mission and follow it. In order to do this, I started writing the following code in Lua:
function update()
local item = mission:get_item(0)
if not item then
gcs:send_text(6, "No waypoint loaded.")
return update, 3000
end
gcs:send_text(6, string.format("Waypoint 0: lat=%.6f, lon=%.6f, alt=%.2f",
item.x, item.y, item.z))
local mode = vehicle:get_mode()
if mode ~= 10 then
gcs:send_text(6, "Switching to AUTO.MISSION...")
vehicle:set_mode(10)
else
gcs:send_text(6, "Already in AUTO.MISSION.")
end
return update, 5000
end
return update()
I can’t find the auto mode ID anywhere (ArduPlane). It seems like it’s trying to get to it’s own location, which isn’t my goal.
Any help is appreciated.