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

Possible indexation problem #85

Open
KarasevPavel opened this issue Apr 26, 2023 · 2 comments
Open

Possible indexation problem #85

KarasevPavel opened this issue Apr 26, 2023 · 2 comments

Comments

@KarasevPavel
Copy link

for(int i=0;i<=N;i++)

I think, there is an indexation problem here in the fullsize branch, when we want to get initial_guess_[i+1] and i == N, because initial_guess_ array has only "N+1" elements in it

@alexliniger
Copy link
Owner

Thanks for pointing this out, I will have a look. The only place "N+2" element is used is to generate the dynamics of the N+1 step, which is not used in the MPC formulation. But if the code is really stepping over the index length this is still bad, and I will add a fix as soon as I have time.

alexliniger added a commit that referenced this issue Jun 29, 2023
@alexliniger
Copy link
Owner

There is a very simple solution to this problem, just use initial_guess_[std::min(i+1, N)] as done in the dev/docker-cppad brunch. I will add the fix as soon as possible to the other brunches.

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