finite-horizon-lqr

Compute time-varying feedback gains via backward Riccati recursion for finite-horizon LQR.

4|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/GeneralReasoning/env-skillsbench --skill finite-horizon-lqr-generalreasoning
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: finite-horizon-lqr
Source: https://github.com/GeneralReasoning/env-skillsbench/tree/main/r2r-mpc-control/environment/skills/finite-horizon-lqr
Command: npx skills add https://github.com/GeneralReasoning/env-skillsbench --skill finite-horizon-lqr-generalreasoning

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a practical method to compute time-varying LQR gains for model predictive control, enabling optimal sequence of control actions over a finite horizon.

Core Features & Use Cases

  • Backward Riccati recursion for gain synthesis.
  • Forward simulation with MPC loop for x and u.
  • Use cases include trajectory stabilization, MPC-based control, robotic path tracking, and process control.

Quick Start

Apply the finite-horizon LQR controller to compute the first control input from the current state x using the provided A, B, Q, R, and N.

Frequently Asked Questions about finite-horizon-lqr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compute time-varying feedback gains for finite-horizon LQR in MPC?

Compute time-varying feedback gains for finite-horizon LQR by using backward Riccati recursion on discrete-time linear system matrices A, B, and cost matrices Q, R to synthesize optimal control actions over a specified horizon N.

What inputs do I need to solve a finite-horizon LQR problem for a discrete-time linear system?

Solving a finite-horizon LQR problem requires discrete-time system matrices A and B, cost weighting matrices Q and R, the finite time horizon N, and the initial state x0 to output the initial optimal control input u0.

How does backward Riccati recursion work for MPC trajectory stabilization?

Backward Riccati recursion works for MPC trajectory stabilization by iterating backwards from the terminal horizon step to dynamically synthesize time-varying LQR feedback gains, applying the first computed control input to forward simulate the system state.

Can I use finite-horizon LQR for robotic path tracking and reference tracking?

Yes, you can use finite-horizon LQR for robotic path tracking and reference tracking by applying dynamic programming to compute optimal control sequences over the MPC horizon, enabling continuous trajectory stabilization and shaping.

What is the difference between infinite-horizon and finite-horizon LQR for control systems?

Finite-horizon LQR computes time-varying feedback gains via backward recursion for a specified horizon N, whereas infinite-horizon LQR converges to constant steady-state gains, making the finite approach necessary for MPC reference tracking.

Why does my MPC controller need to recalculate feedback gains at every timestep?

Your MPC controller recalculates feedback gains at every timestep because finite-horizon LQR uses dynamic programming to synthesize time-varying gains over a receding horizon, applying only the first control input before repeating the backward Riccati recursion.