Return type of eigenvalues from lqr and lqe not consistent
See original GitHub issueThis came up while pytestifying statefbk_test.py (#438)
lqr() will always return E as (nstates, ) array
https://github.com/python-control/python-control/blob/d3142ff24c7af5e2c0843fd16d0e1be82b322bb9/control/statefbk.py#L444-L446
lqe() returns _ssmatrix(E) which is a (nstates, ) array or (1, nstates) matrix depending on config.defaults.use_numpy_matrix()
https://github.com/python-control/python-control/blob/d3142ff24c7af5e2c0843fd16d0e1be82b322bb9/control/statefbk.py#L290
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Inverted Pendulum: State-Space Methods for Controller Design
Another option is to use the lqr command which returns the optimal controller gain assuming a linear plant, quadratic cost function, and reference...
Read more >Lecture 4 Continuous time linear quadratic regulator
Pss can be found by (numerically) integrating the Riccati differential equation, or by direct methods. • for t not close to horizon T,...
Read more >Suboptimal LQR-based spacecraft full motion control
This work introduces a real time suboptimal control algorithm for six-degree-of-freedom spacecraft maneuvering based on a ...
Read more >LINEAR QUADRATIC GAUSSIAN - Dr. Gregory L. Plett
1. Rewrite cost and system in terms of the estimator states and dynamics ➠ Can access these. 2. Design a stochastic LQR.
Read more >Linear-Quadratic Regulator (LQR) design - MATLAB lqr
Find the gain matrix K using lqr . Since N is not specified, lqr sets N to 0. [K,S,P] = ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’d like to clean this up before 0.8.4 release, but there are a few issues that could break users’ code:
lqrreturns_ssmatrix(K), _ssmatrix(S), E, for which the first return value is the gain matrix (2D array or matrix, depending on config settings), the second return value is the solution to the Riccati equation (2D array or matrix), and the third value is a 1D array (list of closed loop eigenvalues).lqereturns_ssmatrix(K), _ssmatrix(S), _ssmatrix(E), which forces the third argument to be a 2D array.careanddarereturn_ssmatrix(X), w[:n], _ssmatrix(G), for which the first return value is the solution to the Riccati equation (2D array or matrix), the second return value is a list of eigenvalues (1D array), and the third argument is the gain matrix (2D array or matrix).I think we should make the following change in 0.8.4:
lqeto matchlqrThis will require an updated unit test (as noted above) and could break some users’ code. But the fix to user code is simple (convert to 2D array) and so I think it is OK for 0.8.4.
I think we might want to consider whether to make changes to
careanddarein 0.9.0:We can leave things the same with the argument that
careanddareare returning solutions to the Riccati equation as their primary usage => that solution should be first. Thelqrandlqefunctions callcareordare, but are returning controllers as their primary usage => OK for the order to be different.We can change the order of the return values for
careanddareto matchlqrandlqe.My current feeling is that we leave
careanddarealone. Thoughts?Fixed in #477.