This is easy camera roll stabilizer to ArduPilotMega (I used code version 2.012). Camera mount was easy to build. Camera angle can be adjusted during flight with RC controller. Stabilization needs only one line code to program! Of course also pitch can be stabilized in the same time, but I have not yet tested this.Camera stabilizer is normal mount with servo. Servo is connected to APM's sixth output port. (I have old 1.0 version of board, name is Out5, in new version 1.4 port name is probably Out6)
Then I added one line to APM code: In the main program there is fast_loop. To the end of this subroutine, just above }, I added this line:
APM_RC.OutputCh(CH_6, constrain(g.rc_6.radio_in - (dcm.roll_sensor * 0.1),900,2100));
Then I uploaded program to APM, and thats it.
Also pitch can be stabilized in the same way. Servo and receiver goes to next channels, and this code can be added after the code line above.
APM_RC.OutputCh(CH_7, constrain(g.rc_7.radio_in - (dcm.pitch_sensor * 0.1),900,2100));
Some explanations to codes: It is easiest to think, that servo middle position is 150 degrees, in the program this is indicated as 1500. This is default value if receiver is not connected, and we get this value from radio receiver if knob is in the middle position.
Servo maximum turn is 60 degrees to each position, so we have minimum value 1500 - 600 = 900, and maximum value 1500 + 600 = 2100. These numbers are in the code above. If we want to reduce movement, then we must change these values. For example if camera can turn only 20 degrees to each direction, the values are 1300 and 1700.
Stabilization works always, also on manual mode. Camera can turn even 60 degrees to all directions. Probably analog servos are better, digital servos jitters very often.
In the forum there are some drawings from some other camera mounts http://www.diydrones.com/forum/topics/apmimu-camera-stabilization