Original ArduPilot controls 2 servos (throttle/yaw) by autopilot code or from RC receiver. Other 2 servos are controlled by FMA copilot (or again manually by RC). Although there're servo IN3/4 and servo OUT 3/4 connectors on ArduPilot board, they're at present unused (actually only pass-through control from IN3/4 to OUT3/4 is connected).Yet there's simple way to control all 4 servos from ArduPilot code, and use other two servos for interesting tasks, such as moving plane's camera tilt. Or even better - provide full stabilization in basic ArduPilot, which is at present only planned in ArduPilot Pro.While I don't know yet if stabilization code would fit into 16KB memory of AT168 (together with navigation code), I'll just post how to control all 4 servos from code. We'll see what comes out of this.On hardware side, there's simple wire soldered between digital 6 pin and MUX IN 3 pin. Also connector is added at servo OUT 3 at top right for connecting the servo:
This is for controlling servo 3, for adding control of servo 4, add another wire from D7 to MUX4 and another connector to Servo OUT 4.Now programming part... For controlling servo, we need to output PPM signals at pins 6/7. And do it at 50Hz frequency. Luckily we can set interrupt function that will be called 50 times/second, and generate PPM pulses there. This functionality will use up to 10% of CPU (for delays while generating PPM signals). All the code is here.In your code, call Servo_3_4_Init once, then Servo_3_set or Servo_4_set whenever you need to set angle for particular servo.That's it! We can control now 4 servos from inside code. And possibly add stabilization part to the code...? Let's hope so.