# LQR Robotic Arm

I have a robotic arm model in Simulink and I'd like to control the position of the end-effector such that it follows a given trajectory. This is done by inputting joint angles and comparing the output to see whether the desired angles have been reached.

From PID controller, I have moved on to an LQR controller which requires me to linearize the plant(Robot Arm) before being able to apply the controller.

My first questions is about linearization. If I were to do this, it would be around a fixed/ equilibrium point whereby the linearization would only be valid for that given region. How can I obtain a complete linearized model of my system which would be valid for all point as I would like to control the joint angles to manipulate the position of the end effector?

Second question is how would I derive a trajectory following Linear Quadratic Regulator control law. The laws I have seen only make sense for reaching a fixed point. I would like to continuously change that fixed point. Any ideas? https://i.sstatic.net/uIMlO.png

• What is your exact nonlinear model, because there is no general technique which allows you to linearize any nonlinear system. Commented Apr 29, 2018 at 12:25
• Hi Kwin! My model is in terms of the dynamics of the system. I've uploaded a picture here. ibb.co/bSYh3c Commented Apr 29, 2018 at 12:30
• @KwinvanderVeen I applied the technique used here, control.utoronto.ca/~broucke/ece311s/Handouts/linearization.pdf However, this would be valid for a small region only about the equilibrium/fixed point. I'd like to derive a model which is valid for all points so that I can control the robot using linear control methods. I'm not sure whether I'm approaching this problem the right way but to be able to control a system with linear control methods, the first step is definitely linearizing the system. How would you approach this? Commented Apr 29, 2018 at 12:40
• Do you mind if I contact you through email @KwinvanderVeen . Commented Apr 29, 2018 at 13:43

By the definition of LQR (linear quadratic regulator) so you can't apply it to nonlinear systems. Namely "linear" refers to linear system (and "quadratic" refers to the cost function). You could generalize it to nonlinear systems, which turns it into a optimization problem. For nonlinear systems this might not have an unique solution, since the problem could be non-convex.

A better alternative might be input-output linearization. From the information you have given I assume the dynamics are of the form

$$M\,\ddot{q} + C(q,\dot{q}) + K(q) = \tau.$$

This can also be written as

$$M\,\ddot{q} = \tau - C(q,\dot{q}) - G(q) = -K\,q - D\,\dot{q} + \tau - f(q,\dot{q})$$

where $K$ and $D$ capture all the linear terms in $q$ and $\dot{q}$ respectively and $f(q,\dot{q})$ capture all the remaining nonlinear dynamics. Now my defining a new input as

$$v = \tau - f(q,\dot{q})$$

then you can define the state space model as

$$\dot{x} = \begin{bmatrix} 0 & I \\ -M^{-1}\,K & -M^{-1}\,D \end{bmatrix} x + \begin{bmatrix} 0 \\ M^{-1} \end{bmatrix} v$$

where $x = \begin{bmatrix}q^\top & \dot{q}^\top\end{bmatrix}^\top$. This can be solved with LQR, such that $v$ can be expressed as state feedback. However the quadratic term in $v$ of the cost function ($v^\top R\,v$) might not be as meaningful as when you define the cost function using $u$ instead.

And as for your second question about following a changing reference you could look at LQI. It is also worth mentioning that feedforward can do wonders in reference tracking also.

• Thanks for being so patient with me @kwin. The assumptions you made about my model are accurate. One thing I'm still a little fuzzy on is the input, v. Why is it not as meaningful? What would the control law be then in this case? Commented Apr 30, 2018 at 7:30
• I'm glad that you mentioned LQI. Implementation seems straight forward however MATLAB keeps giving me errors. There's not much literature on LQI, I couldn't find any atleast. Could you refer me to some useful papers or notes on LQI? Commented Apr 30, 2018 at 7:32
• @vickysan007rv With normal LQR (or optimal control with quadratic cost function) you have $J_\tau=\int x^\top Q\,x + \tau^\top R\,\tau\,dt$, where $\tau^\top R\,\tau$ can be interpreted as the energy used by the controller. But with $v$ you have $J_v=\int x^\top Q\,x + v^\top R\,v\,dt$, where $\tau = v + f(x)$, so the difference is $\int f^\top(x)\,R\,f(x)-2\,\tau^\top R\,f(x)\,dt$ which does not have the same physical meaning. Commented Apr 30, 2018 at 14:54
• @vickysan007rv I think this gives some more insights into LQI. Commented Apr 30, 2018 at 14:55