Lua script to execute "on demand"


I am trying to set up a Lua script to execute “on demand,” so that I can activate it from a mission, for example, when executing a trigger. Step by step, I have managed to configure the mount to move and take pictures with the script; what I need now is to be able to invoke it when needed from the mission.

I have seen examples where they invoke it from an RC, but that wouldn’t be the case here.

An interesting idea would also be for it to execute upon detecting that the drone stops for a time, say 3 seconds, and then it executes at that moment.

For practical purposes, using a “do set servo” to activate it would be ideal.

I have searched, read, and experimented without success.

Any idea on how to achieve this?

Seems you want to do this while in auto mode. NAV_SCRIPT_TIME is probably the answer:

Thank you very much for the reference, Yuri.

I will review the code in detail.