Prof. this might be a strange question, but does the controller move to the left a little before moving to 10. and if so, how does the controller know to do that?
The same thing popped to me. Yes, I think it has to move a little bit back first to tilt the pendulum forwards (the yellow curve on the scope dips a bit). But I am not sure how it knows that.
@@tushermyth The -K matrix given to us by the LQR encodes how to get the system to go to a state of [0,0,0,0] - that includes information about how to move while keeping the pendulum upright, which includes putting it slightly off balance to move the cart by going backwards first.
Dear Prof, does the system work well with Vd=0.001*eye(4) and Vn=0.001? For me it is not giving good result (although stable). As i checked your code (from the provided link), I find that the values of Vd and Vn are set to 0.0000001 and the system shows excellent result. Which one should we use?
Is it not possible to simulate the nonlinear (actual) model of the system without S-function? Are the noise and disturbance taken care of within the S-function?
Good question. You can actually download the code at databookuw.com under the CODE.zip link. Then you can play with the simulink model more. There are a couple of things that could be going on here: 1) I might have subtracted pi in the simulink code, or 2) I might be linearizing about the up position, in which case this would become the "origin". But I would check out the code to make sure.
If you got a positive gain in the LQR you just need to reverse the signs of the block with the step and the position estimation as input? Another question, does the proportional regulator gives some oscillation problem around the reference point, do we need a pole in zero?
Good observation. Even, thinking logically and practically, we conclude that it's impossible to stabilize pendulum in upright position, estimate thetha, just based on the knowledge of x, position. We can stabilize only if we know the angle theta, may be, for that C matrix must have nonzero value at 3rd index, then the system might be observable, but one thing should be noted, that minimum condition for observer is detectibility of system, means in that case we can build reduced order observer. A system might be unobservable, but still detectable. Detectable system means, that unobservable modes goes to zero and non zero can be observed.
Dear Prof, thank you for the Control Bootcamp, I keep revisiting it year after year! This time I come with a question regarding our C = [1 0 0 0]; Matrix. Usually encoders for inverted pendulums are set to read the Theta angle. So our C should be C= [0 0 1 0] . I have tried using the Kalman filter to estimate the state of the system but got an error when trying to estimate the states. (Error using lqe (C,A) is undetectable). What does it mean? Does it mean that we cannot estimate the estate of the system with a sensor on the pendulum ? Kind regards,
george, he actually taught about that in a previous class. if you want to estimate full state you have to measure x (then the system is observable). If you measure any other quantity, you'll se that your system will be rank 3 and it's not observable. Of course that you have a shade on observability and not just OBSERVABLE/NOT OBSERVABLE.
One think confuse me: how can the kalman filter estimate the angle just from the cart position? I know, from a known initial state, the cart position is enough to propagate it in time. And I understand why kalman filter can work with a normal stable pendulum. But if the pendulum is not stable, an initial bias in state can aggregate in time.
the kalman filter also knows the input, so it knows where the cart ought to end up. When it sees the kart move backwards relative to how it should with the input (notice how without any input when the pendulum falls the cart rolls backwards and forwards due to momentum) it can infer the pendulum's angular velocity. And when it has an idea of the angular velocity, it can tell whether the pendulum is up (angular acceleration is relatively small) or falling (angular acceleration is high) of course once the pendulum falls far enough it won't be able to figure out the position with much accuracy any more, but that part is outside of our linearization
What is the x vector that is multiplied with the sysKF.A matrix? I'm doing this in Python, and therefore I don't have Simulink. Since we only know the x-position, what should go in to the other 3 entries in the x-vector? Is it the previous state from the Kalman filter?
I think the inital x_hat vector is the same as the x_vector [0;0;pi;0] and then the sysKF dynamics takes it from there? Would also like a clarification on this. Inputs to the sysKF are u and y, how is x_hat being taken as an input as well?
Sir, if we suppose x and theta don't have any relation with x_dot and theta_dot in system equetions, how can I linearize it at fixedpoints. İn that, I cannot place equlibrium x and theta after differentiate equetions because there aren't.(is it logical). I have a system like that. But ı have to linearize it. I hope I can explain my problem.
This is a great series. I'm actually learning a lot from it. I have a question, though, how come you don't get an error when you use the unstable matrix A (pendulum up) to build the gain matrix Kf as you did in one of the previous videos? In that video you built the estimator for the pendulum down system because of this error. Why is this not an issue in this case?
he said that if the pendulum is in the up position, it will rapidly goes down so the linearized model will not vaild for it leaves the fixed linearized region , but if it combines with LQR full state feedback , the system will be stable, and the the linearized model will be vaild! maybe this will help you !
Thinking logically and practically, we conclude that it's impossible to stabilize pendulum in upright position, just based on the knowledge of position,x. We can stabilize only if we know the angle theta. Because we can see that the measurement y is just position of cart. Then how it's possible to stabilize pendulum in upright position just based on position value?. Moreover C=[1 0 0 0], makes the system unobservable, I believe C matrix must have non zero value at 3rd index instead of first index, so would have angle measurement, which should be sufficient for stabilization and also rest of states estimation.
Sir you didn't add white noise to measurement and process. But there are disturbance and noise covariance.
Prof. this might be a strange question, but does the controller move to the left a little before moving to 10. and if so, how does the controller know to do that?
The same thing popped to me. Yes, I think it has to move a little bit back first to tilt the pendulum forwards (the yellow curve on the scope dips a bit). But I am not sure how it knows that.
@@tushermyth The -K matrix given to us by the LQR encodes how to get the system to go to a state of [0,0,0,0] - that includes information about how to move while keeping the pendulum upright, which includes putting it slightly off balance to move the cart by going backwards first.
Dear Prof, great lectures really well presented.
Dear Prof, does the system work well with Vd=0.001*eye(4) and Vn=0.001? For me it is not giving good result (although stable). As i checked your code (from the provided link), I find that the values of Vd and Vn are set to 0.0000001 and the system shows excellent result. Which one should we use?
Is it not possible to simulate the nonlinear (actual) model of the system without S-function? Are the noise and disturbance taken care of within the S-function?
Sir why did you not subtract PI from "theta" at 7:27 minute mark in the video?
Good question. You can actually download the code at databookuw.com under the CODE.zip link. Then you can play with the simulink model more. There are a couple of things that could be going on here: 1) I might have subtracted pi in the simulink code, or 2) I might be linearizing about the up position, in which case this would become the "origin". But I would check out the code to make sure.
If you got a positive gain in the LQR you just need to reverse the signs of the block with the step and the position estimation as input?
Another question, does the proportional regulator gives some oscillation problem around the reference point, do we need a pole in zero?
But is the system not observable with C=[1 0 0 0]? How can you still estimate the other states?
Good observation. Even, thinking logically and practically, we conclude that it's impossible to stabilize pendulum in upright position, estimate thetha, just based on the knowledge of x, position. We can stabilize only if we know the angle theta, may be, for that C matrix must have nonzero value at 3rd index, then the system might be observable, but one thing should be noted, that minimum condition for observer is detectibility of system, means in that case we can build reduced order observer. A system might be unobservable, but still detectable.
Detectable system means, that unobservable modes goes to zero and non zero can be observed.
Dear Prof, thank you for the Control Bootcamp, I keep revisiting it year after year! This time I come with a question regarding our C = [1 0 0 0]; Matrix. Usually encoders for inverted pendulums are set to read the Theta angle. So our C should be C= [0 0 1 0] . I have tried using the Kalman filter to estimate the state of the system but got an error when trying to estimate the states. (Error using lqe (C,A) is undetectable). What does it mean? Does it mean that we cannot estimate the estate of the system with a sensor on the pendulum ? Kind regards,
george, he actually taught about that in a previous class.
if you want to estimate full state you have to measure x (then the system is observable).
If you measure any other quantity, you'll se that your system will be rank 3 and it's not observable. Of course that you have a shade on observability and not just OBSERVABLE/NOT OBSERVABLE.
One think confuse me: how can the kalman filter estimate the angle just from the cart position? I know, from a known initial state, the cart position is enough to propagate it in time. And I understand why kalman filter can work with a normal stable pendulum. But if the pendulum is not stable, an initial bias in state can aggregate in time.
the kalman filter also knows the input, so it knows where the cart ought to end up. When it sees the kart move backwards relative to how it should with the input (notice how without any input when the pendulum falls the cart rolls backwards and forwards due to momentum) it can infer the pendulum's angular velocity. And when it has an idea of the angular velocity, it can tell whether the pendulum is up (angular acceleration is relatively small) or falling (angular acceleration is high)
of course once the pendulum falls far enough it won't be able to figure out the position with much accuracy any more, but that part is outside of our linearization
What if I make C = [1 1 0 0], assume it is still observable, what will happen, is it going to affect x_hat?
What is the x vector that is multiplied with the sysKF.A matrix? I'm doing this in Python, and therefore I don't have Simulink. Since we only know the x-position, what should go in to the other 3 entries in the x-vector? Is it the previous state from the Kalman filter?
I think the inital x_hat vector is the same as the x_vector [0;0;pi;0] and then the sysKF dynamics takes it from there? Would also like a clarification on this. Inputs to the sysKF are u and y, how is x_hat being taken as an input as well?
Sir, if we suppose x and theta don't have any relation with x_dot and theta_dot in system equetions, how can I linearize it at fixedpoints.
İn that, I cannot place equlibrium x and theta after differentiate equetions because there aren't.(is it logical).
I have a system like that. But ı have to linearize it.
I hope I can explain my problem.
Sir, Nonlinear dynamics S-Function Buldier, Can it be used as SS Steady state block
This is a great series. I'm actually learning a lot from it.
I have a question, though, how come you don't get an error when you use the unstable matrix A (pendulum up) to build the gain matrix Kf as you did in one of the previous videos? In that video you built the estimator for the pendulum down system because of this error. Why is this not an issue in this case?
he said that if the pendulum is in the up position, it will rapidly goes down so the linearized model will not vaild for it leaves the fixed linearized region , but if it combines with LQR full state feedback , the system will be stable, and the the linearized model will be vaild! maybe this will help you !
@@davidpeter5639 I think I understand what you mean. Thanks a lot!
Thinking logically and practically, we conclude that it's impossible to stabilize pendulum in upright position, just based on the knowledge of position,x. We can stabilize only if we know the angle theta. Because we can see that the measurement y is just position of cart. Then how it's possible to stabilize pendulum in upright position just based on position value?. Moreover C=[1 0 0 0], makes the system unobservable, I believe C matrix must have non zero value at 3rd index instead of first index, so would have angle measurement, which should be sufficient for stabilization and also rest of states estimation.
Can anyone help me how to simulate the file please? That will be a great help for me. Thanks.
sure, where is your problem
@@Dave-bz4nr I am unable to simulate the file that I get from the course site. Can you give me the .slx file??