Custom Camera Trigger actions

I am attempting to automatically trigger my camera during an autopilot mission.

I have two pins. One triggers the focus, the other triggers the shutter. Unfortunately, because of my camera’s behavior, tying focus and shutter together results in a blurry image.

How do I set ardupilot up to activate the focus and then trigger the a camera at a set delay later?

Which autopilot are you using? If it’s scripting capable (Lua), that may provide a solution.

Otherwise, I don’t see any options for using the CameraFocus servo option (92) in a useful way for this particular case. I’d love to be proven wrong, but even a brief search through the source code didn’t turn anything up.

Mateksys H473 wing.

Can a lua script be activated with the do_cam_set_trigg_dist in mission planner?

That’s a great autopilot for scripting!

I think the best method would be to approach it using NAV_SCRIPT_TIME mission commands. That command was intended for scripted aerobatics, but it can easily be adapted for a number of other uses.

This example script shows how to poll for the command and execute a maneuver upon receipt.

ardupilot/copter-nav-script-time.lua at master · ArduPilot/ardupilot (

Instead of executing a maneuver, I think I’d implement it with a couple of scripted camera control functions. You could poll for the command at a fast update rate, and when received, trigger the focus pin, call another function to trigger the camera after giving some time to let the camera focus (100ms or so?), and then re-enter the polling routine.

It may also be possible to do a little magic to detect a camera trigger event, but the NAV_SCRIPT_TIME command is probably a better method.