Set GPIO pin via RC command

Hello,

I need to trigger an external device (killswitch of a “companion” computer) via a switch on the remote controller. For this i figured using the camera trigger functionality might work, however I can’t fully figure out how to do this and the only related issue I could find remains unsolved (Camera trigger by RC Channel). I am using the newest 1.14.3 version of PX4-Autopilot on a Cubepilot Cube Orange and set the following parameters:

RC_MAP_AUX5 = Channel 7
PWM_AUX_FUNC5 = Camera Trigger
TRIG_MODE = Time based, on command
TRIG_INTERFACE = GPIO
TRIG_ACT_TIME = 1000.0 ms
TRIG_POLARITY = Active low

I assumed that this would create the functionality, that the channel 7 on the RC can now start the camera trigger, but this does not work. Using the built-in NuttX function camera_trigger test the trigger is done correctly and the signal is output on AUX5.

Is there any issue with my parameters or is this functionality not even intended? Are there any alternatives to set a GPIO pin using the RC?

Thanks for your help,
Andreas

Hi @greinet, what I remember - Camera Trigger can be triggered by command only.
How about using RC AUX n? It would be PWM output, but in companion computer you can read PWM input and trigger with bigger than set value.

Seems that you’re right - camera triggering can be executed via commands only, see camera_trigger.cpp, looks like _one_shot = true is the variable that would trigger a single shot, and it is modified to true only in a Mavlink command handler.

I would’ve thought PX4 has some GPIO control output interface, it can be useful. Or at least an option to trigger the camera via remote.

@greinet You might want to play a bit with the code to allow manual picture, but reading a PWM signal from PX4 will be very easy to set in PX4 (but then you need your code to handle that).
By the way, I’m pretty sure Ardupilot supports that.