In optical flow fusion (libraries\AP_NavEKF2\AP_NavEKF2_OptFlowFusion.cpp), Kalman gain is PH*/(HPH*+R). Since we already computed H, we can use it to calculate PH*. However, in the code below, it computes t22, t9, …again:
Kfusion = -t62*(t22+P*t9+P*t100-P*t101-P*t102-P*t103+P*t104);
Why do we need to repeat the same calculation?
I understand we use Matlab to optimize H and K separately, but it does not take too much effort to optimize it further. Maybe my understanding is wrong?