FrancescoRuscelli / horizon

an intuitive optimization tool tailored to robotics, based on CasADi
7 stars 9 forks source link

Support for parameters #13

Closed alaurenzi closed 3 years ago

alaurenzi commented 3 years ago

By parameters I mean casadi symbolics that are fixed to a given value before the optimization is done. This is achieved by calling the nlpsol with an additional p: param_value entry in the problem dictionary.

This feature is needed in order e.g. to change a reference, or cost weight, or constraint parameter (think surface shape or normal direction) on the fly.

I'd consider the same structure that we already have for states and inputs (i.e., time-dependent parameters), as well as general-purpose parameters that don't relate to time in any way (similar to so-called "single variables").

Any further idea or comment @FrancescoRuscelli @EnricoMingo ?

FrancescoRuscelli commented 3 years ago

done in f1e5cb75c60a33117cd4807dca37ff225dffda4b. Can be cherry-picked

EnricoMingo commented 3 years ago

Do we have an example for this feature?

FrancescoRuscelli commented 3 years ago

Do we have an example for this feature?

Yes we do! Check it out in branch parameters: /examples/cart_pole_sin.py

FrancescoRuscelli commented 3 years ago

I added also time-variable parameters in branch "parameters"