brocksam / pycollo

General-purpose optimal control, trajectory optimisation and parameter optimisation using direct collocation
https://brocksam.github.io/pycollo/
MIT License
8 stars 3 forks source link

Unhelpful error when adding endpoint constraints to a point-constrained variable. #48

Open NoNotCar opened 2 years ago

NoNotCar commented 2 years ago

Using a variable constrained to a point (e.g. phase initial time constrained to 0) in an endpoint constraint results in the following error: ValueError: Endpoint constraint (((_V_tF_P0*_tF_P0)+_r_tF_P0)-((_V_t0_P0*_t0_P0)+_r_t0_P0)) is invalid as it contains symbols that aren't OCP point variables or constants which isn't terribly helpful - ideally the offending variable would be subsituted with its constrained value in the endpoint constraint?

brocksam commented 2 years ago

Thanks. If one of the time variables is fixed (e.g. t0) then this constraint does not make sense as an endpoint constraint on the OCP as it can instead be thought of as a bound on the other time variable (e.g. tF). However, I agree that the error messaging could be improved to make this clear to the user.