Open stanleybak opened 4 years ago
note: using the earlier method to compute ps
and Ny_r
using x_ctrl
makes the optimized
gains work very poorly, where the aileron especially oscillates quickly between its limits. You can guess this would happen as the gains in some of the rows of the optimized
LQR matrix are a few orders of magnitude larger than the gains in the old
LQR matrix.
What you mean is I'd better use old
LQR matrix, right?
I think there's a flag now to choose between the versions. See the code here.
I'm trying to reproduce the v2 controller in python and ran into an issue where I think
ps
is being computed incorrectly in Matlab.This is done in
subf16_morelli.m
. The comments say:% ps= p*cos(alpha) + r*sin(alpha)
and the computation is done as:
ps = x_f16_dot(7)*cos(x_f16_dot(2)) + x_f16_dot(9)*sin(x_f16_dot(2));
I don't see why it's valid to use the
x_f16_dot
states here? These are derivatives not state variables. Previously we had code that extracted the state variables fromx_delta
, which was the difference between the current state and the trim state.The
Ny_r
computation has a similar issue. The old computation wasNy_r = ay/g + x_ctrl(6)
, the new computation isNy_r = ay/g + x_f16_dot(9);