Can someone guide me what are we doing in the
void AP_Mount::stabilize() .. function of APM exactly? It is part of the libraries that we use for camera stabilization (ArduPLane/ ArduCopter). i.e . libraries/ AP_Mount/ AP_Mount.cpp
There it is mentioned under stabilize() as a 'golden' comment:
// only do the full 3D frame transform if we are doing pan control
I see that when pitch becomes 90 degrees, Yaw of the board becomes the Roll. Does it compensate for this ??
Can someone throw some light on these statements ?
which part of the code is unclear? The comment at the top of the function says "Stabilizes mount relative to the Earth's frame", which seems pretty clear to me.
It gets the rotation of the DCM ( ie the roll/titlt/yaw angles of the airframe in the sky relative to GND), and mixes that information with the rotational matrix between the camera and the plane ( since the gimbal is attached to the airframe, and moves with it ) , and uses that to keep the camera targeting the correct place relative to the ground, irrespective of the plane's direction etc.
A simpler ( and faster) maths be used if the camera dies not support "pan", so it will only roll/tilt stabilise. ( ie the camera can't point in arbitrary places ) .