Servos in sequence

Hello,
I am a newbie ardupilot user and I am hoping to receive some help. I am entering a competition, where a plane needs to drop 4 packages and it has to be able to do that both on command, and in sequence with some set time delay.
What I have a problem with is the sequence part. I have my RC11_OPTION set to 19 (gripper) and it works as intended - dropping the package when I toggle a switch. Now all I need is to set another servo channel (I am using channel 12) to perform the same action but after a delay of let’s say 1 second.

I am trying to do this via lua scripts, since I did not find any parameters that could set a delay between RC input and servo channel output. The code I wrote is listed below and so is the file with my current parameter settings. The end result is that both servos work at the exact same time. If anyone with more experience could help that would be amazing :slight_smile:
drop_delay.lua (912 Bytes)
servo_drops.param (19.1 KB)

You could do this with a mission plan, not with parameters.

https://ardupilot.org/plane/docs/common-mavlink-mission-command-messages-mav_cmd.html#mav-cmd-do-set-servo

Is this a plane or multirotor? You mentioned plane, but posted this in copter.

Edit: Here’s another mission option:

https://ardupilot.org/plane/docs/common-mavlink-mission-command-messages-mav_cmd.html#mav-cmd-do-repeat-servo

I am not sure is this helpful. From the example, you probably can design a state machine (local variable) and using update to callback to next state (action). Just my quick idea, never try that before. Probably you may need to design RC11 edge trigger detection to start the state machine instead of read RC11 value.

return update, RUN_INTERVAL_MS

Careful not to overload the flight controller unit until no processing time sufficient for the core operation (flying, position holding, etc).

It works for my case.