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

Fix type instability in LinMPC and NonLinMPC (introduced in 1.1.0) #130

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

franckgaga
Copy link
Member

ControllerConstraint{NT} is no longer concrete
ControllerConstraint{NT, GCfunc} is

`ControllerConstraint{NT}` is no longer concrete
`ControllerConstraint{NT, GCfunc}` is
@franckgaga
Copy link
Member Author

franckgaga commented Nov 29, 2024

oh well it happens!

I will work on that a little bit tomorrow. But I have a party on Saturday. so not Saturday. And not Sunday while we're at it XD

🎉 🎉 🎉
🍰 🍰 🍰
🎁 🎁 🎁

@baggepinnen
Copy link
Member

baggepinnen commented Nov 29, 2024

It's a common pitfall. Ways to protect yourself against future such changes are

  • Test type stability using JET.jl in the tests, e.g., like is done for LowLevelParticleFilters.jl and DiscretePIDs.jl
  • Use a type parameter for the entire field, i.e., con::T instead of con::ControllerConstraint{NT, GCfunc}

@franckgaga
Copy link
Member Author

franckgaga commented Nov 29, 2024

Yeah I'll implement your second option instead.

I did not know that JET.jl was able to do that. Great idea!

@franckgaga franckgaga changed the title Fix type instability in LinMPC and NonLinMPC (introduced in 1.2.0) Fix type instability in LinMPC and NonLinMPC (introduced in 1.1.0) Nov 29, 2024
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

Successfully merging this pull request may close these issues.

2 participants