Change pwm value of aux_channels in ardupilot code

Hi I want to trigger some aux switch of pixhawk for custom purpose inside ardupilot code in some conditions for making it automaticly.For example I want to cut gps vcc line if gps accuracy is bad.But I want make it in automaticly not with RC? Where can I change aux function pwm inside ardupilot code?

you would be best to use a lua script to change parameters to disable the gps rather than cutting power to it.

thanks for your response i will try it