Live data from Hacker News

Introduction to Model Predictive Control

arnavdhamija.com

11–16 of 16 posts

Re: Introduction to Model Predictive Control

#11

Early in the article it introduces the A state transition matrix and B the input matrix. What is the intuition of those matrices and where do you get them from? It seems to assume a background in Optimal Control. The article would be better if it explained those matrixes A and B more in detail with a few simple examples. (maybe it did, but I stopped reading after that, since it builds on top of those undefined concep…

It comes from representing your system dynamics as a set of linear equations in your state variables (which might be position, velocity, etc). The A matrix is the linear map from the previous state at time t to the next state at time t+1. The B matrix is similar, except it determines the impact of your control input u on the next state of the system.

Re: Introduction to Model Predictive Control

#12

Early in the article it introduces the A state transition matrix and B the input matrix. What is the intuition of those matrices and where do you get them from? It seems to assume a background in Optimal Control. The article would be better if it explained those matrixes A and B more in detail with a few simple examples. (maybe it did, but I stopped reading after that, since it builds on top of those undefined concep…

https://en.wikipedia.org/wiki/State-space_representation

Re: Introduction to Model Predictive Control

#13
post #11

Early in the article it introduces the A state transition matrix and B the input matrix. What is the intuition of those matrices and where do you get them from? It seems to assume a background in Optimal Control. The article would be better if it explained those matrixes A and B more in detail with a few simple examples. (maybe it did, but I stopped reading after that, since it builds on top of those undefined concep…

It comes from representing your system dynamics as a set of linear equations in your state variables (which might be position, velocity, etc). The A matrix is the linear map from the previous state at time t to the next state at time t+1. The B matrix is similar, except it determines the impact of your control input u on the next state of the system.

Thanks. For an endeffector in a robot arm, the articulated motion, with friction, backlash, gearing, coriolis terms, contact etc. can be very complicated. Would/could you use a physics engine to compute the state in t and t+1 , and then compute the A matrix from that? (state as in world space position and orientation of the end effector)

Re: Introduction to Model Predictive Control

#14
post #12

Early in the article it introduces the A state transition matrix and B the input matrix. What is the intuition of those matrices and where do you get them from? It seems to assume a background in Optimal Control. The article would be better if it explained those matrixes A and B more in detail with a few simple examples. (maybe it did, but I stopped reading after that, since it builds on top of those undefined concep…

https://en.wikipedia.org/wiki/State-space_representation

Thanks, the article could benefit from a bit more background like this, with a few simple examples, for example going from the (double) pendulum or cartpole equation of motions to the A matrix, same for B.

Re: Introduction to Model Predictive Control

#15
post #11

Earlier quoted context omitted.

It comes from representing your system dynamics as a set of linear equations in your state variables (which might be position, velocity, etc). The A matrix is the linear map from the previous state at time t to the next state at time t+1. The B matrix is similar, except it determines the impact of your control input u on the next state of the system.

Thanks. For an endeffector in a robot arm, the articulated motion, with friction, backlash, gearing, coriolis terms, contact etc. can be very complicated. Would/could you use a physics engine to compute the state in t and t+1 , and then compute the A matrix from that? (state as in world space position and orientation of the end effector)

Generally this process would be called linearization.

You can create a complex, nonlinear, numerical model of the full system in as much detail as you want (eg implemented in a block sim like Simulink, or MBD software like ADAMS, or just A and B matrices derived manually but incorporating nonlinearities like sin, etc).

From that you can evaluate a whole bunch of finite differences around an arbitrary state (linearization point), which are the components of the A and B matrices. This is an approximate, linear model which is "close enough" in behaviour to your real model for states that are "close" to your linearization point.

In practice if you're moving far away from your linearization point (eg a 6 DOF robot arm with large displacement of all joints), you'll need to re-compute the linearization each timestep, around the current state, and re-compute the LQR or MPC solution from this "new" approximate model.

Here's some linearization code I wrote for a library that's used to teach controls and robotics in undergrad. It takes as a input a "model" that's an arbitrary function that generates the next state from a given state, and computes the jacobian matrices by finite differences: https://github.com/SherbyRobotics/pyro/blob/43dcb112427978ff...

Re: Introduction to Model Predictive Control

#16
post #3

Can anyone more familiar with control theory recommend some simple projects / applications / simulations that might help learn more about this field? I've been interested in control theory for a while and I have a rough understanding of the math involved, but I feel like I need to tinker with something to really understand it!

I really like the Control System Bootcamp videos by Prof. Steve Brunton on youtube: https://www.youtube.com/watch?v=Pi7l8mMjYVE&list=PLMrJAkhIeN...

Good book's to accompany the videos are: - linear systems theory by Joao Hespanha (has some MATLAB code) - Linear state-space control systems by Willams and Lawrence (has some MATLAB code) - Control system design by Bernard Friedland (20 usd dover paperback available) - Data-Driven Science & Engineering by Steve Brunton (video guy above) and Kutz

Some other interesting books: - Control system engineering: design and implementation using ARM Cortex-M Micro-controllers (some MATLAB and C code) - Linear Feedback Control: analysis and design with MATLAB by Xue, Chen and Atherton (MATLAB, obviously)

...a lot basic MATLAB control system functions are also available in Octave, Scilab, Python, and Julia packages

Post reply on HN