In ArduSub 3.4, this can be done by re-purposing the ‘video source toggle’ joystick button function.
- Configure a button with the camera_source_toggle function
- Plug your signal cable for the relay into Aux output 1 on the Pixhawk
- Set the RC9_FUNCTION parameter to RCIN11
In 3.5 (coming soon), you will be able to configure buttons to control generic pwm output functions and set output pins low/high for relays.