Setting Trigger to RAspicam

Has anyone setup a way to make it so when you hit an aux channel it triggers the raspicam to run a command such as timelapse and then when shut off it ends the script. I want to do some mapping with a raspicam and am stumped at getting that aspect to work. well one of the things i am stuck on

I would guess there are a couple of ways to attack this:

One is to use user code within ArduPilot (which would require recompiling)
Maxproxy with a python script could be another way.