Does anybody know how to disable motors when the roll or pitch angle is large

For example, when the roll angle is more than 45 degress, I shoud disable motors? How can I relealize it? Thanks

A simple version of this has been implemented for VTOL ( There’s definitely interest in generalizing the idea.

Hi, I used the following order
px4_ioctl(fd, PWM_SERVO_DISARM, 0);
but the motor did not stop, thanks