-
Notifications
You must be signed in to change notification settings - Fork 131
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
Cleanup of the python
interface
#159
base: master
Are you sure you want to change the base?
Conversation
'n_row': __hpipm.d_ocp_qp_dim_get_nx, | ||
'n_col': __hpipm.d_ocp_qp_dim_get_nu, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was correct at it was before, K
is the state feedback matrix of size nu
times nx
.
It is probably a bit confusing, but n_row
is the number of rows, not the length of each row.
Consistently with that, the (column) vectors lr
, p
and k
have n_row
but not n_col
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you found numerically from the example that it was wrong as it was before, it may be that the issue is this: HPIPM writes back the result in column-major, but numpy matrices are row-major by default.
If this is the case, either the feedback matrix is saved in a temporary matrix and transposed into the actual one, or the zeros numpy matrix is set to column-major before getting the data from C, e.g. like in https://github.com/giaf/hpipm/blob/master/interfaces/python/hpipm_python/hpipm_python/wrapper/hpipm_ocp_qp.py#L75 (note that here we did for setters, but it may also make the job for the getters).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Column- vs. row-major was indeed the problem! thanks 👍
@sandmaennchen trying to compile the python interface, I get the error
I have python 3.8. It seems to be unhappy of the Union stuff, removing that the error is gone. Any hint? |
Hi @giaf, type hints should now be backward compatible with python 3.8! |
print_stats()
which prints a summary of the IP iterationsidx_end
is given