Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Improvements over acados MPC formulation #183
base: main
Are you sure you want to change the base?
Improvements over acados MPC formulation #183
Changes from 8 commits
205dcc4
044d812
bb47497
a70f8e6
0eb0b29
08e293d
6702a4d
264afd5
cfe0159
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I don't see
setup_optimizer
being called in mpc_acados. It calls setup_acados_optimizer, but this function is for casadi. I am a bit confused about this whole section lol.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.
With my comment I wanted to highlight that when you call
compute_initial_guess()
from mpc_acados.py you end up callingcompute_initial_guess()
from mpc.py and also you run line 229 which creates an instance of a casadi nlpsolver that is not needed in mpcacados.py.Line 229 is important only in case you are using mpc.py, in order to overwrite the solver at line 188.
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.
Hmmm I see your point, we're setting up casadi for no reason. We should fix this, will talk to the group
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.
This was added by me. This idea of this is allowing solver swiching for mpc. For example, do an initial guess (
self.init_solver
) with ipopt then switch to a faster sqp solver (self.solver
). I have tested with cartpole previously and this can improve the overall runtime and accuracy. But indeed acados will not use this. I think we can keep this if there is no clear interference with other code.One problem I notice is that this will add several milliseconds to the runtime. So the init step runtime needs a special treatment (maybe simply remove the first step).
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.
I would move it to line 209, you are interested to have a robust solver for the warmstart only.
So you switch to
ipopt
solver whenipopt
is the chosen warmstart type.Otherwise you go on using the NLP solver you started with.
For instance, if you choose
sqpmethod
with casadi, andlqr
as warmstart type you don't have to create/change solver for the initialization.