ulqr
0.1.0
|
Solver that uses Riccati recursion to solve an LQR problem. More...
#include <riccati_solver.h>
Data Fields | |
int | nhorizon |
length of the time horizon | |
int | nstates |
size of state vector (n) | |
int | ninputs |
number of control inputs (m) | |
int | nvars |
total number of decision variables, including the dual variables | |
KnotPoint * | Z |
state and control trajectory | |
LQRData * | lqrdata |
LQR Problem data. | |
double * | data |
pointer to the beginning of the single block of memory allocated by the solver | |
Matrix | x0 |
Initial state. | |
double | t_solve_ms |
Total solve time in milliseconds. | |
double | t_backward_pass_ms |
Time spent in the backward pass in milliseconds. | |
double | t_forward_pass_ms |
Time spent in the forward pass in milliseconds. | |
Solver that uses Riccati recursion to solve an LQR problem.
Solves the generic LQR problem with affine terms using Riccati recursion and a forward simulation of the linear dynamics. Assumes problems are of the following form:
\begin{align*} \underset{x_{1:N}, u_{1:N-1}}{\text{minimize}} &&& \frac{1}{2} x_N^T Q_N + x_N + q_N^T x_N + \sum_{k-1}^{N-1} \frac{1}{2} x_k^T Q_k + x_k + q_k^T x_k + u_k^T R_k + u_k + r_k^T u_k \\ \text{subject to} &&& x_{k+1} = A_k x_k + B_k u_k + f_k \\ &&& x_1 = x_\text{init} \end{align*}
All the memory required by the solver is initialized upon the creation of the solver to avoid any dynamic memory allocations during the solve.
Use ulqr_NewRiccatiSolver() to initialize a new solver, which much be paired with a single call to ulqr_FreeRiccatiSolver() to free all of solver's memory.
Standard usage will typically look like the following: