locuslab / mpc.pytorch

A fast and differentiable model predictive control (MPC) solver for PyTorch.
https://locuslab.github.io/mpc.pytorch/
MIT License
872 stars 146 forks source link

Non-quadratic slew rate line search #12

Open bamos opened 5 years ago

bamos commented 5 years ago

If I understand correctly, https://github.com/locuslab/mpc.pytorch/commit/206bd939ec1479424221a62ed45ad26830849fcc does the LQR step with the slew rate penalty in the quadratic cost approximation, but does the line search on the unmodified cost function without the slew rate penalty.

This is non-trivial to fix because we currently have a time-invariant non-quadratic cost function and no easy way to access the nominal control trajectory within it. If we did, the clean solution would be to write a new cost function with the slew rate penalty. Instead, perhaps the easiest way of fixing this would be to add the slew rate to the get_cost function.

ivandariojr commented 5 years ago

That is correct I forgot we were using the true cost for the line search.

bamos commented 5 years ago

I just added an error message for this case so nobody accidentally starts getting silent errors from this.