Why only use z component of mag correction in AP_AHRS_DCM.cpp?

Why not use 3 axis of yaw_error?
i.e.

	Vector3f error = Vector3f(0,0, yaw_error);

	// convert the error vector to body frame
	error = _dcm_matrix.mul_transpose(error);

	// ...

	// _omega_yaw_P.z = error.z * _P_gain(spin_rate) * _kp_yaw.get();
	_omega_yaw_P = error * _P_gain(spin_rate) * _kp_yaw.get();

?
This seems to lack a suitable reason to do so.

At here, I see that at begining, DCM code use 3 axis of yaw_error, but at this issue:


, it was fixed to only use z axis of error with no clear explanation.

Please post this as a GitHub - ArduPilot/ardupilot: ArduPlane, ArduCopter, ArduRover, ArduSub source issue.

Here is the paper referenced in that comment:

I had post an issue, but was told that post questions on the discuss forums:

. So I go here.

Many thanks!

I have read this paper after you told me, I guess the reason is magnetometer has latency, so should not use magnetometer to fix x and y axis in body fame? I am not sure…

BTW, this paper is hard to read, for example, I can not figure out this formula:
image
this formula above is some like the SO(3) matrix update formula in complementary filter:
image
image
But I can not derive it(equation 1).

He says equation 1 is derived from his DCM algorithm which is described in this paper:

It probably requires a fair amount of mathematical skill to duplicate his results…

I have read this paper several times, but it still hasn’t helped me in any way to understand equation (1)…

If only there were more mathematical derivation details…