-
Notifications
You must be signed in to change notification settings - Fork 81
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
Why is it ineffective to impose constraints on state variables? #43
Comments
Hi, |
This is the code I wrote based on open source code According to the results of the cartpole example used in open source, my code should have no errors. |
I also found this problem, have you solved it? |
I also found this problem, have you solved it? |
Sorry, I haven't found a solution either. The following is my personal guess, there may be some errors.
In addition, in the admm.cpp code https://osqp.org/docs/examples/mpc.html But still, I cannot guarantee that my statement is correct because I am not good at mathematics either. |
Recently, I have also been looking at the formulas and derivations of the parts you marked, and I also have some doubts. In addition, did you use osqp-eigen to verify the inverted pendulum model? If so, can you post the code you wrote using osqp-eigen? |
Hi all, I think the real challenge you are having here is that you are trying to use TinyMPC for any general optimal control problem and expecting good convergence. Unfortunately, that is not going to be the case. TinyMPC is designed to be very computationally efficient (fast) and as such trades off accuracy for speed and needs to be highly tuned to ensure good convergence. In this case, my guess is that your issue is that we use a fixed rho parameter for the whole solve, while OSQP has a sophisticated mechanism to update rho to balance primal and dual convergence during solver iterations. This makes it much more accurate on general problems but would introduce significant computational complexity issues in our approach. We are currently working on some new mathematical approaches to try to find ways to efficiently update rho and hope to be able to support such features in the next few months but at this time you likely will need to highly tune such hyperparameters to get stable convergence. Hope that helps! |
Hello, thank you very much for your open source work, which has given me a lot of inspiration. Here are some questions I would like to ask.
This is the state equation and parameters of the inverted pendulum of the small car.
const double M = 0.5f;
const double m = 0.5f;
const double l = 0.3f;
const double g = 9.81f;
double A_data[NUM_STATES * NUM_STATES] = {0, 0, 1, 0,
0, 0, 0, 1,
0, m * g / M, 0, 0,
0, (m * g + M * g) / (M * l), 0, 0};
double B_data[NUM_STATES * NUM_INPUTS] = { 0,
0,
1 / M,
1 / (M * l)};
The constraints are as follows:
The output result of TinyMPC is as follows:
The output result of OSQP is as follows:
It is evident that the input variable u can be constrained, but the state variable qDot has exceeded the lower limit of the constraint. Why is this?
The text was updated successfully, but these errors were encountered: