Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calculation of ps in new version #10

Open
stanleybak opened this issue Aug 20, 2020 · 3 comments
Open

calculation of ps in new version #10

stanleybak opened this issue Aug 20, 2020 · 3 comments

Comments

@stanleybak
Copy link
Collaborator

stanleybak commented Aug 20, 2020

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 from x_delta, which was the difference between the current state and the trim state.

The Ny_r computation has a similar issue. The old computation was Ny_r = ay/g + x_ctrl(6), the new computation is Ny_r = ay/g + x_f16_dot(9);

@stanleybak
Copy link
Collaborator Author

stanleybak commented Aug 20, 2020

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.

@wuuuiYan
Copy link

What you mean is I'd better use old LQR matrix, right?

@stanleybak
Copy link
Collaborator Author

I think there's a flag now to choose between the versions. See the code here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants