rsLQR
0.1
|
Data Structures | |
struct | RiccatiSolver |
Solver that uses Riccati recursion to solve an LQR problem. More... | |
Functions | |
int | ndlqr_SolveRiccati (RiccatiSolver *solver) |
Solve the LQR problem using Riccati recursion and a forward simulation of the linear dynamics. More... | |
int | ndlqr_BackwardPass (RiccatiSolver *solver) |
Run the Riccati solver backward pass. More... | |
int | ndlqr_ForwardPass (RiccatiSolver *solver) |
Run the Riccati forward pass to solve for the solution vector. More... | |
RiccatiSolver * | ndlqr_NewRiccatiSolver (LQRProblem *lqrprob) |
Initialize a new Riccati solver. More... | |
int | ndlqr_FreeRiccatiSolver (RiccatiSolver *solver) |
Free the memory for a Riccati solver. More... | |
int | ndlqr_PrintRiccatiSummary (RiccatiSolver *solver) |
Prints a summary of the solve. More... | |
Matrix | ndlqr_GetRiccatiSolution (RiccatiSolver *solver) |
Get the solution vector. More... | |
int | ndlqr_GetNumVarsRiccati (RiccatiSolver *solver) |
int | ndlqr_CopyRiccatiSolution (RiccatiSolver *solver, double *soln) |
Copies the solution to a user-supplied array. More... | |
int | ndlqr_GetRiccatiSolveTimes (RiccatiSolver *solver, double *t_solve, double *t_bp, double *t_fp) |
Get the Riccati solve times. More... | |
int ndlqr_BackwardPass | ( | RiccatiSolver * | solver | ) |
Run the Riccati solver backward pass.
Uses backward Riccati recursion to solve for the feedback and feedforward LQR gains along the trajectory. Also computes the quadratic cost-to-go and the expansions of the action-value function. All the data is stored in the solver.
solver | An initialized RiccatiSolver |
int ndlqr_CopyRiccatiSolution | ( | RiccatiSolver * | solver, |
double * | soln | ||
) |
Copies the solution to a user-supplied array.
See ndlqr_CopyRiccatiSolution() for variable ordering
solver | An initialized RiccatiSolver that has been solved but not freed |
soln | Destination for solution vector. Must have length at least equal to solver.nvars. |
int ndlqr_ForwardPass | ( | RiccatiSolver * | solver | ) |
Run the Riccati forward pass to solve for the solution vector.
Computes the solution vector by simulating the linear dynamics forward using the the feedback law \( u = -K x + d \).
solver | An initialized RiccatiSolver |
int ndlqr_FreeRiccatiSolver | ( | RiccatiSolver * | solver | ) |
Free the memory for a Riccati solver.
solver | Initialized Riccati solver. |
Matrix ndlqr_GetRiccatiSolution | ( | RiccatiSolver * | solver | ) |
Get the solution vector.
Returns the solution vector as a Matrix object, which is a simple wrapper around a raw pointer which points to the data actually stored by the solver. The user must not free the data, as it is owned by the solver. To get a solution vector owned by the caller, use ndlqr_CopySolution() instead.
The variabled are ordered as follows:
\[ \begin{bmatrix} \lambda_1^T & x_1^T & u_1^T & \lambda_2^T & \dots & x_{N-1}^T & u_{N-1}^T & \lambda_N^T & x_N^T \end{bmatrix}^T \]
solver |
int ndlqr_GetRiccatiSolveTimes | ( | RiccatiSolver * | solver, |
double * | t_solve, | ||
double * | t_bp, | ||
double * | t_fp | ||
) |
Get the Riccati solve times.
Writes the solve times to the given pointers.
solver | An initialized RiccatiSolver | |
[out] | t_solve | Total solve time, in milliseconds |
[out] | t_bp | Backward pass time, in milliseconds |
[out] | t_fp | Forward pass time, in milliseconds |
RiccatiSolver* ndlqr_NewRiccatiSolver | ( | LQRProblem * | lqrprob | ) |
Initialize a new Riccati solver.
Create a new Riccati solver, provided the problem data given by lqrprob.
lqrprob | Contains all the data to describe the LQR problem to be solved. |
int ndlqr_PrintRiccatiSummary | ( | RiccatiSolver * | solver | ) |
Prints a summary of the solve.
solver | An initialized solver |
int ndlqr_SolveRiccati | ( | RiccatiSolver * | solver | ) |
Solve the LQR problem using Riccati recursion and a forward simulation of the linear dynamics.
solver | An initialized RiccatiSolver |