At JuliaCon 2024 I learned about the package OptimalControl.jl and related.

To install them, you need to add a custom registry:

```
pkg> registry add https://github.com/control-toolbox/ct-registry.git
pkg> add OptimalControl
```

What is the relationship to ControlSystems.jl ?

Do they solve different problems, or is there an overlap?

For example, both can be used to solve an LQR problem:

What are the advantages and disadvantages of these two packages?

1 Like

One is a tool for classical linear feedback control, whereas the other is a tool for numerical trajectory optimization. There is very little overlap and no relation.

1 Like

So LQR has a very different meaning in the context of linear feedback control and in the context of trajectory optimization?

No, but lqr in Controlsystems.jl solvers a very particular version of an lqr problem, in trajectory optimization you can specify the flavor of your cost and time horizon etc, but get a trajectory as result rather than a feedback gain.

3 Likes

Indeed, the LQ in LQR suggests that a **L**inear dynamical system, and **Q**uadratic cost function are considered (the **R** stands for regulation). In this regard, the label just specifies the class of a problem, not the way to solve it.

One way we can solve the LQR problem is to formulate and solve a related optimization problem (a quadratic program) in which the control trajectory is the outcome. This gives an open-loop control, which is not particularly useful in practice. There are, however, techniques how to introduce feedback into such scheme, for example the receding horizon control (aka model predictive control). Advantage of this approach is that constraints on the control and state variables can be easily added (true, strictly speaking in presence of constraints the system is no longer linear, but we like to call it linear anyway – constrained linear system).

In the special case when there are no constraints, there is an alternative – and a very elegant and efficient – way to solve the problem. An associated Riccati equation (differential one in the finite final time case, algebraic one in the infinite final time case) can be formulated and solved, which then gives the coefficients for a proportional state feedback controller. An extremely powerful and useful result. It can be that some in the control systems community automatically associate the LQR problem with the Riccati equation based way of solving it.

1 Like