This solver uses osqp but saves the osqp object and corresponding data objects to prevent unnecessary work constructing and destructing.
It does this by adding a function InitializeSolver which creates the OSQPWorkspace object. Provided the structure of the mathematical program does not change, calling Solve will now only update the costs and constraints. This along with the now-enabled native warm starting of osqp, speeds up the solve time significantly.
Testing on my lab desktop with the simulator running at 2000Hz, (so max controller rate is 2000Hz):
Controller frequency of the walking controller: ~800Hz (drake osqp_solver), ~1200Hz (this PR)
Controller frequency of the standing controller: ~1450Hz (drake osqp_solver), ~1700Hz (this PR)
This solver uses osqp but saves the osqp object and corresponding data objects to prevent unnecessary work constructing and destructing.
It does this by adding a function
InitializeSolver
which creates theOSQPWorkspace
object. Provided the structure of the mathematical program does not change, callingSolve
will now only update the costs and constraints. This along with the now-enabled native warm starting ofosqp
, speeds up the solve time significantly.Testing on my lab desktop with the simulator running at 2000Hz, (so max controller rate is 2000Hz): Controller frequency of the walking controller: ~800Hz (drake osqp_solver), ~1200Hz (this PR) Controller frequency of the standing controller: ~1450Hz (drake osqp_solver), ~1700Hz (this PR)
This change is![Reviewable](https://reviewable.io/review_button.svg)