Thanks for a clear and descriptive video explanation. Could you also explain how the expressions would change if there is a drag force (-bx_dot) on the cart?
You would need to define the Rayleigh's Dissipation Function, R. In this case, R = 0.5 * b * x_dot^2 and then use the extended form of Lagrange's equations. I have explained it in this video: ruclips.net/video/NV7cd-7Rz-I/видео.html
I will put this on my list, however, solving this is almost identical to what I have shown in several other videos (particularly the animation series). Solving for x and θ uses the identical method to what I have shown before.
If we subs eq10 (without ext force) in eq11 we get l.t'' - c.(a.l.t''.c - a.l.t'.t'.s) - g.s = 0 -> (l - c.c.a.l)t'' + a.l.s.c.t'.t' - g.s = 0 -> (1 - c.c.a)t'' + a.s.c.t'.t' - g.s/l = 0 Where: t = theta c = cos theta s = sin theta a = m/(M+m) As a0. So, at first look, nothing prevents theta = pi/2, right? My question is: in the eq of motion are, somehow, implied what would happens when theta =pi/2?
I didnt mention that my consideration was made because x=constant and theta= pi/2 inst a equilibrium of the system. It's very strange, the stick of the pendulum just don't want to rest?
I combined this into one step because I wanted to fit it all on the same page. If you write out the last part on some paper an go through the derivatives one step at a time, it will make sense.
Hi I'm trying to get into Lagrangian mechanics, mainly so I can code my own inverted pendulum on a moving cart from scratch (and be able to control the cart), and this helped a lot. The one thing I did not understand was at 14:22, how/why you found out that the "external momentum" was 0 for theta, but F(t) for x. I kind of get it, but not in a very scientific way. If you could clarify that for me or give me a video I can watch to understand, I would greatly appreciate it! I've tried googling it, but Lagrange equations just seem too general. I later read something that said that the external force should be accounted for in the potential energy because F=dV/dx, but that should break for non-conservative forces, which I'm pretty sure f(t) is. Thanks in advance! Great video
According to the problem statement, there is an external load, F(t) being applied to the cart in the x-direction. There is no mention of an external moment being applied at the hinge. Lagrange's equations require us to apply the load to the right hand side of the equation corresponding to the coordinate that the load is applied to (this is derived from the fact that the external load/moment will do work as a result of that displacement changing). Consequently, the external force is applied to the right hand side of the "x" equation of motion and since there is no external moment, there will be a zero on the right hand side of the θ equation. Regarding conservative/non-conservative forces....you can ALWAYS add the external load/moment to the right-hand side of the equation regardless of whether is it conservative or non-conservative. However, IF the load is conservative then it can always be written in terms of the derivative of a potential function. As a result, for a conservative load (e.g. gravity), you can either add it to the right-hand side of Lagrange's equation as a load OR you can include it in the potential function and add it to the left-hand side of Lagrange's equation.
First take the partial derivative with respect to xdot (so xdot disappears, because d(a • xdot)/dxdot=a). Then take the derivative with respect to time, which requires the product rule giving the two terms
Hello there! What if we have the pendulum on the right side of the intermitent line? Should I use a negative thetha and sum up the X of the big mass? Greetings from Ecuador.
Hi, Thanks for this excellent video. However, I am finding it difficult to intuitively understand the third term of kinetic energy expression at 7:45. I understand it has something to do with the coupling effect of the motion of the cart and pendulum. Still, it does not make sense scientifically according to my understanding. Anyone can explain it intuitively? Thank you
When taking time derivatives to find velocities, these derivatives must be taken with respect to an INERTIAL REFERENCE FRAME. This cross-product term in the kinetic energy is, indeed a coupling effect, and arises from considering the pendulum's motion from the perspective of a non-inertial reference frame - the moving cart. As the cart accelerates, so does the hinge point of the pendulum, which means that if you just consider the first two terms of the kinetic energy, then you're observing the pendulum's motion from a platform that itself is moving. This non-inertial reference frame thus introduces complexities in how the pendulum's kinetic energy is calculated. Intuitively, the cross-product term accounts for the additional velocity and, therefore, kinetic energy that the pendulum mass has due to its rotation around the hinge point, which isn't stationary but moving with the cart. This is why it contains both x_dot and θ_dot. This is probably a good topic for a video!
hello sir, i am really impressed and i finally get a hang of the lagragian equation, i am trying to model a system using simulink to get the response of the dynamic equations, i learnt that to feed your dynamic equations into simulink you need to put the greater power on the left, but the equations we got from your video Xddot and theta ddot both appear on each equation with the same power. i would like to know if you have any suggestion on how to feed it into my simulink to see the response.
Are there any videos that describe this not on a cart but a rotating body? Say the pendulum was connected to a point on a circle spinning counter clockwise and the pendulum itself was falling counter clockwise itself. I'd like to know how to find the rate at which the body would have to be rotating to "catch" the pendulum and keep it in a semi vertical position, in relation to the axis it would create if it went all the way through it.
Not sure exactly what you are trying to achieve, but the spherical pendulum might be a good starting point. You could model something like this attached to a rotating base perhaps. ruclips.net/video/Qo0IW91tniw/видео.html
Whiteboard presentations are produced using the app "Paper" by WeTransfer. Running on an iPad Pro 13 inch. Video captured using Quicktime and edited using iMovie.
In a previous problem, (vertical cart attached to spring and one pendula), you considered the height h displaced by the bob. With that logic shouldn't V = mgh* = - 1 * mg (l - l*cos(theta)) ?
Both are right. This is fundamentally just a difference of the coordinate system. In this case, I have the origin at the hinge. In the other problem, I placed the origin at the equilibrium position of the mass. As a result, these expressions for potential energy differ by a constant, HOWEVER, the constant get differentiated out when the potential energy is substituted into Lagrange's equations - so, as one might expect, you can arbitrarily select the point of zero potential energy depending on where you place the origin of you coordinate system and it should make no difference to the final result.
You can linearize the equations of motion by making the small angle assumption. Under this assumption, sin θ = θ and cos θ = 1. Then to write them in suitable form for use in a controls problem, you must rewrite the equations in state-space form. I have several videos demonstrating how to do this. Here is one: ruclips.net/video/SFpJbmHIUB0/видео.html
As an example, a human being can be modeled as an inverted pendulum (since we're all top-heavy). Our ability to move our feet allows us to stay balanced and upright. This could be modeled as an inverted pendulum on a cart.
The are 2 degrees of freedom in this system ( corresponding to each of the generalized coordinates x and θ). That is to say that if we know x and θ, then we can completely describe the location of each of the masses in the system.
Great video. There's just something I don't quite get. At 14:10 , why is it that when the cos(theta) is differentiated, the negative sign infront of it does not become positive, because from what I understand, derivative of cos is - sin and this negative sign is supposed to cancel out the negative sign that's already infront of the original undifferentiated term.
There are actually 3 negatives here and they combine to produce a -ve sign. You are correct that the negative sign from the derivative of cos will cancel out the negative sign that already exists for this term in the Lagrangian. HOWEVER, if you look at eqn 7 (we are dealing with the 2nd term here) dL/dq_i must be SUBTRACTED. This is why we have negative signs before the last 2 terms of this equation.
This is a 2nd order differential equation in time, so it requires 2 initial conditions. Typically it is assumed that the initial angle and the initial angular velocity are known. This is be based on the setup.
Hi, I have some questions: 1. Why don't you add the potential energy of M in the equation (5)? 2. I think you missed the square of l in the second term in the equation (10). 3. What if m is in the right, not the left? I think they are different. Thank you.
1. The mass, M, has zero potential energy since it is located at y=0 and it's y location doesn't change. 2. This is correct as written. The 2nd term in eqn 10 comes from the THIRD term in eqn 9 - because the 2nd term in equation 9 does not contain an 'x' so it does not appear in eqn 10. 3. If m is to the right, then according to my current setup, θ would be negative. However, if you choose to make θ positive to the right instead, then you will need to adjust the kinematics and flip the sign of the 2nd term to positive in eqns 1 & 3.
This was a remake of a previous video which was popular, but had a couple of errors. Since RUclips no longer supports annotations to correct these errors, I decided to redo it.
Yes, provided the angle is, in fact, small (typically less than 10 degrees). Linearization can be used when examining the control problem of keeping the pendulum balanced and upright.
I have several videos on this channel that demonstrate how to solve problems using Lagrange's Equations. Also, there are undoubtedly numerous other RUclips channels which contain videos on using Lagrange's Equations to solve problems.
Absolutely love this kind of math! Especially when some one does such a good job of explaining! I could be wrong but I believe at around 13:00 you were differentiating with respect to theta, but you increased the order of the X term.
I modeled the spherical pendulum in this video: ruclips.net/video/Qo0IW91tniw/видео.html - you should be able to combine this with the model above to get the model you are describing.
We are considering only external forces in the case of generalized forces, so it's just F in this case (we can ignore forces from the rod) No, the force does not apply a moment to the small mass - it is purely applied to the cart and in the x-direction. If the force were applied directly to the small mass, m, then you would be correct that it would also produce an external moment. For the generalized force, we only consider those forces that are acting directly on the particular coordinate. In the case, the external force is assumed to act act through the location of the hinge (the cart is assumed to be infinitely thin) and so cannot produce a moment about this point.
First of all, thank you for explaining complicated topics with such incredible clarity. Secondly, I refered to this video to cross check my own derivation of potential and kinetic energy, and for derivation of total kinetic energy, I started by adding translational kinetic energy of the cart with the rotational energy of the pendulum (point mass), but I am missing the -2*L*dFi/dt*dX/dt*cos(Fi). What would be a physical interpretation of this element of the equation? why isn't rotation of the pendulum and translation of the cart encompasing the total kinetic energy of the system?
It's a little hard to tell without looking at your work, but my sense is that you have not squared your velocity properly. Make sure you: 1. locate the position of the mass(es) using the coordinates and geometry of the problem, 2. Differentiate with respect to time to get the velocity of the mass(es), 3. Use this value for the velocity for the kinetic energy expression AND SQUARE IT! When dealing with rotations, do try to do this intuitively as it is easy to miss a term (usually a cross-product type of term) the result is that there is a coupling in the motion of the two masses that you are missing.
@@Freeball99 thank you very much for your answer. Well, I basically just naively summed up all the kinetic energies that I thought are involved which come from both translation of both masses and the rotation of the pendulum, which equaled to T =1/2* (m+M)*v^2 + 1/2*m*L^2 *w^2 (assuming point mass). So if I would here simply substitute v for dx/dt and w for dFi/dt, I would got something similar, but with discussed term missing (-2*L*w*v*cos(fi)). I guess one can't just sum up what he assumes to be energies, but rather has to start bottom up and define radius vectors and calculate their derivative to obtain velocities and kinetic energies, but I am wondering if there is some interpretation of this missing term here. I thought it has to do something with coordinate definitions perhaps, but what you mention as "coupling in the motion of the two masses" sounds interesting. Especially since this term does resemble cross product of linear and angular velocity (depending on the cos(fi)). I am not 100% sure what are you refering to by this, could you perhaps point me somewhere where I could read more about it? Thank you once again for you clarifications, they have been most helpful.
No. This is a common mistake - DON'T DO IT!! The velocity of m is x_dot - L·θ_dot·cos θ and you need to square this. This gives you THREE components of velocity for the mass, m - the two that you have included plus a rotational effect that you are not including. If you look at Eqn. 6, you will find that you are missing the last term. When you are dealing with rotating systems, this is generally nonlinear stuff. Solve it using basic principles and math rather than using intuition which is often wrong when dealing with rotations.
@@Freeball99 Hey! We don't see a term that involves moments of inertia in these equations. So has the effect of inertia been neglected for simplicity, or is it embedded in the cross term?
@@reubenthomas1033 When modeling a simple pendulum, it is common to treat the mass as a point mass and ignore and rotational kinetic energy of the mass. Really what we are saying here is that if the diameter of the mass is much less than the length of the rod, L, then the contribution of the rotational kinetic energy is negligible. This also keeps the math a little more simple - which is helpful for teaching purposes. I probably should have mentioned this at the start of the problem (I think I mentioned it for some of the other simple pendulum examples). I have separately showing an example of a compound pendulum which does require one to include the rotational kinetic energy (ruclips.net/video/eBg8gof1RBg/видео.html)
Hi, i have some doubts with the potential energy of mass m, I thought that it´s delta height would be l+lcos(theta) because i´ve seen Lagrangian models in which the height is measured from the lowest point at which the pendulum can be. Please correct m if I am wrong.
If the pendulum was hanging down, you would use for its change in height l - lcos θ OR you can just define it's y-location as -lcos θ and call this the height depending on where you define you define y to be zero. These are the same thing just shifted by a constant, L. Both will produce identical results when differentiated in Lagrange's Eqns because the constant, L, disappears when you differentiate it. For the inverted pendulum, it would just be the negative of this.
Wouldn't the potential energy of the pendulum be at its lowest when the ball is pointing straight down (theta=180)? Your potential energy equation would imply that at this point we would have negative potential energy, not 0 (m*g*l*cos(180) = -m*g*l). I have seen other resources that indicate the same and I am thoroughly confused as to why. Any help would be greatly appreciated.
This is really just a question of where you are drawing your axes. Truth of the matter is that zero potential energy is only at the center of the earth, so if any problem we arbitrarily chose a zero potential point. In my case, the x-axis is on the cart and this is defined as zero potential. To be clear, all these different descriptions of the potential energy vary by a constant. When you substitute the potential energy into Lagrange's Equation, the constant gets integrated away. The result is that it make no difference what the absolute value of the potential energy is. Rather what is important, is the DERIVATIVE of the P.E. with respect to the particular coordinate. Also, this means that negative values of potential energy are fine. Hope this clears it up.
I differentiated wrt x in the previous term. Since both x_dot and Cos θ are functions of t (as you have pointed out) I need to apply the product rule when differentiating this. So first I differentiate the x_dot and multiply it by Cos θ and then I differentiate the Cos θ and multiply it by the x_dot. This is what I did in terms 2 and 3.
@@Freeball99 Hi, I think what he/she said is that , why d (-ml theta_dot multiply x_dot cos theta) not = -ml x_double_dot theta_dot cos_theta + ml multiply theta_dot_square x_dot sin_theta - ml theta_double_dot x_dot multiply cos_theta. I am stuck on there too. :(
We have not been given any external moment in the problem. It is assumed that F(t) is acting directly through center of the hinge so it produces no moment about it.
Typically, we treat a simple pendulum as a point mass (though I should have made this more clear at the start), in which case its rotational KE is zero. In general, you are correct that the rotational kinetic energy should be included. In reality, what you'll find is that in most cases, the rotational KE is negligible for a simple pendulum UNLESS the radius of the mass is very large. In the case of a compound pendulum (or in cases where the mass of the rod/string is not negligible) then the rotational kinetic energy must be included - I have another video showing this.
What if the pendulum rod is directly attached to the axis of a single non-slipping wheel, in which case the input would be a torque applied between the wheel and the rod, like in a typical inverted pendulum robot? It's a similar case but it would be nice to have the differences pointed out! Thanks c:
The model as described in the problem really just consists of two point masses connected by a rod. As a result of this: 1) the pendulum bob has no rotational inertia (so no rotatory kinetic energy) and 2) the cart, wheels and applied force (F) are all located at a single point located at the hinge of the pendulum - so, the wheels have no radius and the force F produces no moment about the hinge. If you wanted to model the control input to the wheels, you would need to expand the model to include assumptions about the wheels, eg what is the radius, the mass and the moment of inertia of the wheel? What is the offset between the hinged and the wheels? Etc.
Thanks for fixing your errors! So, dumb question, if I wanted to solve for theta numerically, do I just use Euler's method or maybe the Runge-Kutta method? Would I need to solve for theta double prime in equation (11) and then plug that into equation (10) to solve for theta prime? Would I then use theta double prime to change theta prime and use theta prime to change theta? It's been a couple years since I took a course in differential equations, so I just want to make sure that this is the way you'd solve for theta numerically. EDIT: Actually, I only need to worry about the second derivatives, right? I just calculate theta double prime and x double prime (and set F(t) to whatever I want). Then I change theta prime and x prime, which then changes x and theta. That makes sense to me. I made it all work. I hope this helps whoever is also trying to simulate a cart-pole environment.
Yes, you can use Euler (which is really just RK1) or RK4 to get numerical solutions. The method you have described is not correct... You first need to rewrite the equations of motion in state-space form. In doing so, you are converting the system of equations from two 2nd order differential equations to a system of four 1st order differential equations. I have several videos on how to do this. ruclips.net/video/e1q4vD2KjpE/видео.html ruclips.net/video/SFpJbmHIUB0/видео.html ruclips.net/video/yMeak8RWKtI/видео.html
Freeball Oh, I remember how to do that. It’s just a bunch of substitutions, which is similar to what I ended up doing anyway. Regardless, I saw what I’d call physically accurate behavior in my simulation with my implementation of solution approximation. Thanks!
This is due to the displacement of the cart. If the pendulum angle remained zero at all. times, then the mass, m, will still be displaced by the same amount as the cart, so we need to add X.
We place the generalized force/moment on the right-hand side of the equation. In the case of the x-coordinate, there is a force, F, in this direction, so this appears on the right side of the x-equation. In the case of the θ-coordinate, there is no external moment applied, so the right side of the θ equation is 0.
Drawing app is called "Paper" by WeTransfer. Running on an iPad Pro 13 inch and using an Apple Pencil. For screen recording I attach the iPad to a Mac and use Quicktime to record.
The problem shows that f(t) is the force applied to the system in the x-direction. Therefore, it appears as a generalized force on the right-side of the equation of motion for the x-coordinate.
you take derivative of lagrange equation in the video (10.45 s) but you said derivation will be taken according to x_dot but you did not do that. You use product rule but we do not need to use it becuase if you take derivative of m*L*Q_dot* x_dot*cos(Q) according to x_dot , the answer will be m * L * Q_dot * x_doubledot * cos(Q), wont it ?
No, this is not correct. If I take the derivative of m*L*Q_dot* x_dot*cos(Q) according to x_dot, then I get m*L*Q_dot*cos(Q) according to x_dot. I then need to take the derivative of this with respect to t. This is where the product rule come in because both Q_dot AND cos(Q) depend on time. This results in the TWO terms in the parentheses.
@@Freeball99 I get X-dot derivation, what about theta dot. cause the derivation of theta dot for mine is -mL*Xdot*cos theta (only derivation of theta dot), with respect to time, isnt the formula mLX_dott*sin(theta)?
The derivative, d/dθ (sin θ) = cos θ HOWEVER, we are taking the derivative with respect to t and NOT with respect to θ. Therefore the chain rule must be applied. d/dt (sin θ) = cos θ · d/dt (θ)
@@Freeball99 dear sir, thanks a lot for the reply, i have figured that out just a few minutes ago, and you have confirmed it. although initially i thought it has something to do with derivative of a complex function, like d sin(f(t))/dt which is equal to cos(f(t))f(t) + f(t)'sin(f(t))
@@Freeball99 thanks for getting back to me. I realize my confusion was that considering the whole system, pulling the cart would cause the arm to rotate, but we are not considering the whole system but rather just the virtual work done by F, which is zero in the theta coordinate.
You can linearize the equations by assuming small displacements and then eliminating all higher-order terms - i.e. fully expand out the equations and eliminate all terms that contain x^2, θ^2 or x.θ (or higher powers). Also you will make the approximation that sinθ=θ and cosθ=1.
This problem exists in many references, however, this came from my own notes. The diagram I re-drew comes from Wikipedia though it too exists in many places online and in many textbooks. The inverted pendulum is a fairly common problem in vibrations and controls classes.
@@D4kwah.1d You can try Mechanical Vibrations by S. S. Rao, 5th Edition. It does not contain the inverted pendulum problem, however, there are many other examples in there.
@@Freeball99 I was reading a survey paper the other day that said the inverted pendulum problem has been used as an educational tool in controls for 62 years !!! web.mit.edu/klund/www/keeling/Pendulum2009.pdf
Technically you are correct! However, for the case of the simple pendulum, it is typically assumed that we are dealing with point masses which is why we can ignore the rotational kinetic energy. I mentioned this in the video on the double pendulum, but should have been more clear here. The reality is, that when dealing with a simple pendulum, the rotational kinetic energy is typically negligible when compared to the translational kinetic energy (except for cases when the diameter of the mass is very large and the connecting rod is very short). Also in reality, the connecting rod is not massless and it will also contribute to the rotational kinetic energy (and is usually more significant than the rotational KE of the mass). I have shown this for the case of the so-called "compound pendulum" in this video: ruclips.net/video/eBg8gof1RBg/видео.html So, for the simple pendulum, you can ignore the rotational KE with little loss of accuracy.
@@Freeball99 Thanks for the informative video. But continuing with Enise's question, if we include rotational kinetic energy as well, what I (moment of inertia) should be taken. Is it about the centre of mass? or is it about the hinge?
@@ashishnegi9663 You need to find the rotational KE about the center of mass. The effects of the mass rotating about the hinge are already taken into account by considering its translational velocity relative to the hinge.
Yes, that is correct. But according to Lagrange's Equation, I need to subtract this term. This flips the sign again. So we have three negative signs: 1) the original sign of the term, 2) the sign we get from taking the derivative 3) the sign we get from the 2nd term of Lagrange''s Equation after substitution.
Hey Freeball, Keep up the good work. Can't explain how helpful your contents are! So I just felt like taking this cart and pendulum model to python and play around with the initial condition to see how the system reacted. As expected, the cart had movement even when the initial condition for x (cart's position) was zero for different values of theta (pendulum's position) implying that they are coupled. However, for the case where the pendulum was initially horizontal ( theta = pi/2) I found no movement in cart (x = zero for all t). This looks wrong intuitively... is it because the EOM don't have the x_dot terms in it?
I agree that something seems off here. The cart should move whenever the pendulum swings, regardless of its initial condition. This is not related to the EOM's having no x_dot terms (these would come from adding damping).
@@Freeball99 Hey there, I worked on it and figured out this was a non linear problem so the mass matrix( being part of 2n x 2n matrix A from your video on Direct time integration) and B matrix (comprising of damping and stiffness matrix) were also varying with time and I had considered them constant. This has solved the above problem of theta and x coupling for theta = pi/2. The reason I asked about x_dot was that the absence of x_dot in the EOMs made it feel like the system behaved independent of cart velocity. So assume I give an initial velocity to the cart, the pendulum hence theta should change but it's not.
@@NYKYADU This problem is a semi-definite problem because the system is not restrained and can move as a rigid body without oscillating. For example, if initially the cart had some velocity, x_dot and the pendulum was pointing perfectly straight up (theta = 0) then the cart would just continue to move along at its initial velocity with the pendulum pointing straight up. The initial velocity of the cart doesn’t affect the pendulum (unless there is damping applied to the cart), but rather it is the accelerations of the cart that impart a force/moment to the pendulum and hence the coupling. Pro Tip: Any time you are dealing with geometric nonlinear problems, you will have to update the stiffness matrix with each time step. You will also find that updating the mass matrix with each time step becomes very expensive because you need to invert M. Inverting a matrix requires in the order of n^2 iterations. As a result, as n grows, inverting the mass matrix becomes prohibitively expensive (time consuming). The good news is that in many instances you actually don’t need to update the mass matrix (unless mass is being lost by the system) and this results in very little loss of accuracy, but a huge improvement in speed. You should alway test whether not updating the mass matrix produces similar/accurate results.
@@Freeball99 That clears things up. Never crossed my mind that it was a semi definite system. Trying to understand balancing of inverted pendulum now. Thanks for the tip. You have been phenomenal. Thanks a lot.
@@NYKYADU the balancing of the pendulum, which is a controls problem, requires you to first linearize the EOM, by assuming that the displacements are small and then throwing away the higher-order terms and making appropriate substitutions i.e. Sin θ = θ and Cos θ = 1.
Thank you Professor Snape
_I can teach you to bewitch the mind and ensnare the body_
Thank you for your clear explanation Professor Snape.
Fantastic video for what it's meant to be. Thank you for clearly stating the intention at the beginning--exactly what I was looking for.
Thanks for a clear and descriptive video explanation. Could you also explain how the expressions would change if there is a drag force (-bx_dot) on the cart?
You would need to define the Rayleigh's Dissipation Function, R. In this case, R = 0.5 * b * x_dot^2 and then use the extended form of Lagrange's equations. I have explained it in this video:
ruclips.net/video/NV7cd-7Rz-I/видео.html
Thank you for your replies. Much appreciated.
Awesome job man, thanks a bunch. Make more with different scenarios just for fun and practice, I'll watch them all.
This reminds me of the basic reinforcement learning tutorial in open AI gym.
Thanks a lot. Very helpful
Awesome explanation. It would be great if you could solve the same problem with the coordinates x and theta.
I will put this on my list, however, solving this is almost identical to what I have shown in several other videos (particularly the animation series). Solving for x and θ uses the identical method to what I have shown before.
Thank you. Very good explanation.
If we subs eq10 (without ext force) in eq11 we get
l.t'' - c.(a.l.t''.c - a.l.t'.t'.s) - g.s = 0
->
(l - c.c.a.l)t'' + a.l.s.c.t'.t' - g.s = 0
->
(1 - c.c.a)t'' + a.s.c.t'.t' - g.s/l = 0
Where:
t = theta
c = cos theta
s = sin theta
a = m/(M+m)
As a0. So, at first look, nothing prevents theta = pi/2, right?
My question is: in the eq of motion are, somehow, implied what would happens when theta =pi/2?
I didnt mention that my consideration was made because x=constant and theta= pi/2 inst a equilibrium of the system. It's very strange, the stick of the pendulum just don't want to rest?
Thanx man. BTW I was super confused at the last step when you took double derivatives in one step. D/dtgeta and d/dt. Any ways, very helpfuk thanx
I combined this into one step because I wanted to fit it all on the same page. If you write out the last part on some paper an go through the derivatives one step at a time, it will make sense.
Great video! Thanks!
Merci beaucoup monsieur
Hi
I'm trying to get into Lagrangian mechanics, mainly so I can code my own inverted pendulum on a moving cart from scratch (and be able to control the cart), and this helped a lot.
The one thing I did not understand was at 14:22, how/why you found out that the "external momentum" was 0 for theta, but F(t) for x.
I kind of get it, but not in a very scientific way. If you could clarify that for me or give me a video I can watch to understand, I would greatly appreciate it! I've tried googling it, but Lagrange equations just seem too general. I later read something that said that the external force should be accounted for in the potential energy because F=dV/dx, but that should break for non-conservative forces, which I'm pretty sure f(t) is.
Thanks in advance! Great video
According to the problem statement, there is an external load, F(t) being applied to the cart in the x-direction. There is no mention of an external moment being applied at the hinge. Lagrange's equations require us to apply the load to the right hand side of the equation corresponding to the coordinate that the load is applied to (this is derived from the fact that the external load/moment will do work as a result of that displacement changing). Consequently, the external force is applied to the right hand side of the "x" equation of motion and since there is no external moment, there will be a zero on the right hand side of the θ equation.
Regarding conservative/non-conservative forces....you can ALWAYS add the external load/moment to the right-hand side of the equation regardless of whether is it conservative or non-conservative. However, IF the load is conservative then it can always be written in terms of the derivative of a potential function. As a result, for a conservative load (e.g. gravity), you can either add it to the right-hand side of Lagrange's equation as a load OR you can include it in the potential function and add it to the left-hand side of Lagrange's equation.
at 11:15 why did the xdot cancel to get (ml*theta(doubledot)costheta - mltheta^2*sintheta?
First take the partial derivative with respect to xdot (so xdot disappears, because d(a • xdot)/dxdot=a).
Then take the derivative with respect to time, which requires the product rule giving the two terms
Thank you
Hello there! What if we have the pendulum on the right side of the intermitent line? Should I use a negative thetha and sum up the X of the big mass?
Greetings from Ecuador.
Yes. If the pendulum is to the right, you can just use a negative θ.
Very helpful!!!
do you have a video on how to linearize these equations of motion?
In order to linearize the final equations, use the small angle approximation. So, sin θ --> θ and cos θ --> 1.
Could you derive the equations of motion for an inverted spherical pendulum? Such as Cubli?
Hi, Thanks for this excellent video. However, I am finding it difficult to intuitively understand the third term of kinetic energy expression at 7:45. I understand it has something to do with the coupling effect of the motion of the cart and pendulum. Still, it does not make sense scientifically according to my understanding. Anyone can explain it intuitively?
Thank you
When taking time derivatives to find velocities, these derivatives must be taken with respect to an INERTIAL REFERENCE FRAME.
This cross-product term in the kinetic energy is, indeed a coupling effect, and arises from considering the pendulum's motion from the perspective of a non-inertial reference frame - the moving cart. As the cart accelerates, so does the hinge point of the pendulum, which means that if you just consider the first two terms of the kinetic energy, then you're observing the pendulum's motion from a platform that itself is moving. This non-inertial reference frame thus introduces complexities in how the pendulum's kinetic energy is calculated.
Intuitively, the cross-product term accounts for the additional velocity and, therefore, kinetic energy that the pendulum mass has due to its rotation around the hinge point, which isn't stationary but moving with the cart. This is why it contains both x_dot and θ_dot. This is probably a good topic for a video!
I agree with the control guys that this is harder 😬
hello sir, i am really impressed and i finally get a hang of the lagragian equation, i am trying to model a system using simulink to get the response of the dynamic equations, i learnt that to feed your dynamic equations into simulink you need to put the greater power on the left, but the equations we got from your video Xddot and theta ddot both appear on each equation with the same power. i would like to know if you have any suggestion on how to feed it into my simulink to see the response.
I've never used Simulink so I'm not familiar with the process, but I'm guessing that you need to write the equations in vector/matrix form.
Are there any videos that describe this not on a cart but a rotating body? Say the pendulum was connected to a point on a circle spinning counter clockwise and the pendulum itself was falling counter clockwise itself. I'd like to know how to find the rate at which the body would have to be rotating to "catch" the pendulum and keep it in a semi vertical position, in relation to the axis it would create if it went all the way through it.
Not sure exactly what you are trying to achieve, but the spherical pendulum might be a good starting point. You could model something like this attached to a rotating base perhaps. ruclips.net/video/Qo0IW91tniw/видео.html
Hello sir. Ur videoes are very awesomely explained. Can u plz share as to which video editor you use after making ur videoes. Thanks
Whiteboard presentations are produced using the app "Paper" by WeTransfer. Running on an iPad Pro 13 inch. Video captured using Quicktime and edited using iMovie.
In a previous problem, (vertical cart attached to spring and one pendula), you considered the height h displaced by the bob. With that logic shouldn't V = mgh* = - 1 * mg (l - l*cos(theta)) ?
Both are right. This is fundamentally just a difference of the coordinate system. In this case, I have the origin at the hinge. In the other problem, I placed the origin at the equilibrium position of the mass. As a result, these expressions for potential energy differ by a constant, HOWEVER, the constant get differentiated out when the potential energy is substituted into Lagrange's equations - so, as one might expect, you can arbitrarily select the point of zero potential energy depending on where you place the origin of you coordinate system and it should make no difference to the final result.
How can we linearize such a system to have an LTI representation?
You can linearize the equations of motion by making the small angle assumption. Under this assumption, sin θ = θ and cos θ = 1. Then to write them in suitable form for use in a controls problem, you must rewrite the equations in state-space form. I have several videos demonstrating how to do this. Here is one: ruclips.net/video/SFpJbmHIUB0/видео.html
I's an interesting problem and well explained, as ever. But why would one have an inverted pendulum on a moving wagon?
As an example, a human being can be modeled as an inverted pendulum (since we're all top-heavy). Our ability to move our feet allows us to stay balanced and upright.
This could be modeled as an inverted pendulum on a cart.
How mant degrees of freedom in this system which ar generalized coordinates in this system??
Please reply me .
The are 2 degrees of freedom in this system ( corresponding to each of the generalized coordinates x and θ). That is to say that if we know x and θ, then we can completely describe the location of each of the masses in the system.
Great video. There's just something I don't quite get. At 14:10 , why is it that when the cos(theta) is differentiated, the negative sign infront of it does not become positive, because from what I understand, derivative of cos is - sin and this negative sign is supposed to cancel out the negative sign that's already infront of the original undifferentiated term.
There are actually 3 negatives here and they combine to produce a -ve sign. You are correct that the negative sign from the derivative of cos will cancel out the negative sign that already exists for this term in the Lagrangian. HOWEVER, if you look at eqn 7 (we are dealing with the 2nd term here) dL/dq_i must be SUBTRACTED. This is why we have negative signs before the last 2 terms of this equation.
@@Freeball99 Ouh I see sir,
Thank You Very Much 🙏.
@1:00 this setup appears to be missing one variable - the angular velocity of the pendulum at t=0. Needs to be specified, as it could be anything.
This is a 2nd order differential equation in time, so it requires 2 initial conditions. Typically it is assumed that the initial angle and the initial angular velocity are known. This is be based on the setup.
With using the product rule for eqn 10, isn't derivative of theta dot is 1? But instead it was theta dott,please explain for this. Thanks
In this case we are differentiating with respect to t and NOT with respect to θ_dot.
Hi, I have some questions:
1. Why don't you add the potential energy of M in the equation (5)?
2. I think you missed the square of l in the second term in the equation (10).
3. What if m is in the right, not the left? I think they are different.
Thank you.
1. The mass, M, has zero potential energy since it is located at y=0 and it's y location doesn't change.
2. This is correct as written. The 2nd term in eqn 10 comes from the THIRD term in eqn 9 - because the 2nd term in equation 9 does not contain an 'x' so it does not appear in eqn 10.
3. If m is to the right, then according to my current setup, θ would be negative. However, if you choose to make θ positive to the right instead, then you will need to adjust the kinematics and flip the sign of the 2nd term to positive in eqns 1 & 3.
How is this different from your other video? I enjoy all of these synamics videos!
F(t)
This was a remake of a previous video which was popular, but had a couple of errors. Since RUclips no longer supports annotations to correct these errors, I decided to redo it.
Can small angle approximations (sinθ ≈ θ, cosθ ≈ 1) be applied in the equations?
Yes, provided the angle is, in fact, small (typically less than 10 degrees). Linearization can be used when examining the control problem of keeping the pendulum balanced and upright.
First ... thank you a lot...GREAT WORK
Q: where can I get more solved problem like this (using Lagrange's Equations)?
I have several videos on this channel that demonstrate how to solve problems using Lagrange's Equations. Also, there are undoubtedly numerous other RUclips channels which contain videos on using Lagrange's Equations to solve problems.
Absolutely love this kind of math! Especially when some one does such a good job of explaining!
I could be wrong but I believe at around 13:00 you were differentiating with respect to theta, but you increased the order of the X term.
I first differentiate with respect to θ and THEN I differentiate with respect to t. This is why the order of the derivative on X increases.
@@Freeball99 Thank you for the clarification.
Can you please explain the difference if it is not a cart but a wheel? like a Segway robot (with no curvature motion)
I modeled the spherical pendulum in this video: ruclips.net/video/Qo0IW91tniw/видео.html - you should be able to combine this with the model above to get the model you are describing.
Why is the generalized force for θ (torque) equals to 0? Doesn't the force F(t) applies a torque to the system?
We are considering only external forces in the case of generalized forces, so it's just F in this case (we can ignore forces from the rod) No, the force does not apply a moment to the small mass - it is purely applied to the cart and in the x-direction. If the force were applied directly to the small mass, m, then you would be correct that it would also produce an external moment.
For the generalized force, we only consider those forces that are acting directly on the particular coordinate. In the case, the external force is assumed to act act through the location of the hinge (the cart is assumed to be infinitely thin) and so cannot produce a moment about this point.
First of all, thank you for explaining complicated topics with such incredible clarity. Secondly, I refered to this video to cross check my own derivation of potential and kinetic energy, and for derivation of total kinetic energy, I started by adding translational kinetic energy of the cart with the rotational energy of the pendulum (point mass), but I am missing the -2*L*dFi/dt*dX/dt*cos(Fi). What would be a physical interpretation of this element of the equation? why isn't rotation of the pendulum and translation of the cart encompasing the total kinetic energy of the system?
It's a little hard to tell without looking at your work, but my sense is that you have not squared your velocity properly. Make sure you: 1. locate the position of the mass(es) using the coordinates and geometry of the problem, 2. Differentiate with respect to time to get the velocity of the mass(es), 3. Use this value for the velocity for the kinetic energy expression AND SQUARE IT! When dealing with rotations, do try to do this intuitively as it is easy to miss a term (usually a cross-product type of term) the result is that there is a coupling in the motion of the two masses that you are missing.
@@Freeball99 thank you very much for your answer.
Well, I basically just naively summed up all the kinetic energies that I thought are involved which come from both translation of both masses and the rotation of the pendulum, which equaled to T =1/2* (m+M)*v^2 + 1/2*m*L^2 *w^2 (assuming point mass).
So if I would here simply substitute v for dx/dt and w for dFi/dt, I would got something similar, but with discussed term missing (-2*L*w*v*cos(fi)).
I guess one can't just sum up what he assumes to be energies, but rather has to start bottom up and define radius vectors and calculate their derivative to obtain velocities and kinetic energies, but I am wondering if there is some interpretation of this missing term here.
I thought it has to do something with coordinate definitions perhaps, but what you mention as "coupling in the motion of the two masses" sounds interesting. Especially since this term does resemble cross product of linear and angular velocity (depending on the cos(fi)).
I am not 100% sure what are you refering to by this, could you perhaps point me somewhere where I could read more about it?
Thank you once again for you clarifications, they have been most helpful.
For the kinetic energy, can I write 0,5*M*x_dot^2 + 0,5*m*(L*theta_dot)^2? If the velocity of m is L*theta_dot, isn't it simple to use that way?
No. This is a common mistake - DON'T DO IT!!
The velocity of m is x_dot - L·θ_dot·cos θ and you need to square this. This gives you THREE components of velocity for the mass, m - the two that you have included plus a rotational effect that you are not including. If you look at Eqn. 6, you will find that you are missing the last term.
When you are dealing with rotating systems, this is generally nonlinear stuff. Solve it using basic principles and math rather than using intuition which is often wrong when dealing with rotations.
@@Freeball99 Hey! We don't see a term that involves moments of inertia in these equations. So has the effect of inertia been neglected for simplicity, or is it embedded in the cross term?
@@reubenthomas1033 When modeling a simple pendulum, it is common to treat the mass as a point mass and ignore and rotational kinetic energy of the mass. Really what we are saying here is that if the diameter of the mass is much less than the length of the rod, L, then the contribution of the rotational kinetic energy is negligible. This also keeps the math a little more simple - which is helpful for teaching purposes. I probably should have mentioned this at the start of the problem (I think I mentioned it for some of the other simple pendulum examples).
I have separately showing an example of a compound pendulum which does require one to include the rotational kinetic energy (ruclips.net/video/eBg8gof1RBg/видео.html)
@@Freeball99 Awesome! Got it. Thanks a lot :D
thanks alot!
Hi, i have some doubts with the potential energy of mass m, I thought that it´s delta height would be l+lcos(theta) because i´ve seen Lagrangian models in which the height is measured from the lowest point at which the pendulum can be. Please correct m if I am wrong.
If the pendulum was hanging down, you would use for its change in height l - lcos θ OR you can just define it's y-location as -lcos θ and call this the height depending on where you define you define y to be zero. These are the same thing just shifted by a constant, L. Both will produce identical results when differentiated in Lagrange's Eqns because the constant, L, disappears when you differentiate it. For the inverted pendulum, it would just be the negative of this.
Wouldn't the potential energy of the pendulum be at its lowest when the ball is pointing straight down (theta=180)? Your potential energy equation would imply that at this point we would have negative potential energy, not 0 (m*g*l*cos(180) = -m*g*l). I have seen other resources that indicate the same and I am thoroughly confused as to why. Any help would be greatly appreciated.
This is really just a question of where you are drawing your axes. Truth of the matter is that zero potential energy is only at the center of the earth, so if any problem we arbitrarily chose a zero potential point. In my case, the x-axis is on the cart and this is defined as zero potential. To be clear, all these different descriptions of the potential energy vary by a constant. When you substitute the potential energy into Lagrange's Equation, the constant gets integrated away. The result is that it make no difference what the absolute value of the potential energy is. Rather what is important, is the DERIVATIVE of the P.E. with respect to the particular coordinate. Also, this means that negative values of potential energy are fine. Hope this clears it up.
In 13:06 why did not you differentiate both x dot and cos(theta) wrt time instead of only cos(theta)?
I differentiated wrt x in the previous term.
Since both x_dot and Cos θ are functions of t (as you have pointed out) I need to apply the product rule when differentiating this. So first I differentiate the x_dot and multiply it by Cos θ and then I differentiate the Cos θ and multiply it by the x_dot. This is what I did in terms 2 and 3.
@@Freeball99 Hi, I think what he/she said is that ,
why d (-ml theta_dot multiply x_dot cos theta) not = -ml x_double_dot theta_dot cos_theta + ml multiply theta_dot_square x_dot sin_theta - ml theta_double_dot x_dot multiply cos_theta. I am stuck on there too. :(
Can you provide solutions of these kind of questions using only Newtonian mechanics. I just want to see how does that work out. Thanks
Yes, but it will take me a little while to get there. I have several other videos to make first.
Why the external moment is zero?
We have not been given any external moment in the problem. It is assumed that F(t) is acting directly through center of the hinge so it produces no moment about it.
Sorry, but what about the rotational kinetic energy? Why wasnt it considered in the Kinetic Energy equation?
Typically, we treat a simple pendulum as a point mass (though I should have made this more clear at the start), in which case its rotational KE is zero. In general, you are correct that the rotational kinetic energy should be included. In reality, what you'll find is that in most cases, the rotational KE is negligible for a simple pendulum UNLESS the radius of the mass is very large.
In the case of a compound pendulum (or in cases where the mass of the rod/string is not negligible) then the rotational kinetic energy must be included - I have another video showing this.
Which application is this for note making??
The app is called "Paper" by WeTransfer. It is running on an iPad Pro 13 inch and I am using an Apple Pencil.
That's good
What if the pendulum rod is directly attached to the axis of a single non-slipping wheel, in which case the input would be a torque applied between the wheel and the rod, like in a typical inverted pendulum robot? It's a similar case but it would be nice to have the differences pointed out! Thanks c:
The model as described in the problem really just consists of two point masses connected by a rod. As a result of this: 1) the pendulum bob has no rotational inertia (so no rotatory kinetic energy) and 2) the cart, wheels and applied force (F) are all located at a single point located at the hinge of the pendulum - so, the wheels have no radius and the force F produces no moment about the hinge. If you wanted to model the control input to the wheels, you would need to expand the model to include assumptions about the wheels, eg what is the radius, the mass and the moment of inertia of the wheel? What is the offset between the hinged and the wheels? Etc.
Thanks for fixing your errors! So, dumb question, if I wanted to solve for theta numerically, do I just use Euler's method or maybe the Runge-Kutta method? Would I need to solve for theta double prime in equation (11) and then plug that into equation (10) to solve for theta prime? Would I then use theta double prime to change theta prime and use theta prime to change theta? It's been a couple years since I took a course in differential equations, so I just want to make sure that this is the way you'd solve for theta numerically.
EDIT: Actually, I only need to worry about the second derivatives, right? I just calculate theta double prime and x double prime (and set F(t) to whatever I want). Then I change theta prime and x prime, which then changes x and theta. That makes sense to me.
I made it all work. I hope this helps whoever is also trying to simulate a cart-pole environment.
Yes, you can use Euler (which is really just RK1) or RK4 to get numerical solutions.
The method you have described is not correct...
You first need to rewrite the equations of motion in state-space form. In doing so, you are converting the system of equations from two 2nd order differential equations to a system of four 1st order differential equations. I have several videos on how to do this.
ruclips.net/video/e1q4vD2KjpE/видео.html
ruclips.net/video/SFpJbmHIUB0/видео.html
ruclips.net/video/yMeak8RWKtI/видео.html
Freeball Oh, I remember how to do that. It’s just a bunch of substitutions, which is similar to what I ended up doing anyway. Regardless, I saw what I’d call physically accurate behavior in my simulation with my implementation of solution approximation. Thanks!
What software are you using to write your equations? They look so elegant....
The app is called "Paper" by WeTransfer. Running on a iPad Pro 13-inch and using an Apple Pencil.
Which tool are you using in this video for the drawings?
App is "Paper" by WeTransfer. Running on an iPad Pro 13 inch and using an Apple Pencil.
@@Freeball99 thank you!
That's amazing , btw which pad or software is this you are using ?
Just curious
I’m using an iPad Pro 13-inch with an Apple Pencil. Software is called “Paper” by WeTransfer.
Hi sir, pls tell me: why equation (1) is "xm = X - l*sin(theta)" but not "xm = -l*sin(theta)"?
This is due to the displacement of the cart. If the pendulum angle remained zero at all. times, then the mass, m, will still be displaced by the same amount as the cart, so we need to add X.
Why equation of motion for x is equal to force ?? But equation of motion of theta is not equal to force ?? Please reply me
We place the generalized force/moment on the right-hand side of the equation. In the case of the x-coordinate, there is a force, F, in this direction, so this appears on the right side of the x-equation. In the case of the θ-coordinate, there is no external moment applied, so the right side of the θ equation is 0.
What software did you film this video in?
Drawing app is called "Paper" by WeTransfer. Running on an iPad Pro 13 inch and using an Apple Pencil. For screen recording I attach the iPad to a Mac and use Quicktime to record.
how do you know that the right side is f(t) in equation 1? Shouldn't it be 0?
The problem shows that f(t) is the force applied to the system in the x-direction. Therefore, it appears as a generalized force on the right-side of the equation of motion for the x-coordinate.
you take derivative of lagrange equation in the video (10.45 s) but you said derivation will be taken according to x_dot but you did not do that. You use product rule but we do not need to use it becuase if you take derivative of m*L*Q_dot* x_dot*cos(Q) according to x_dot , the answer will be m * L * Q_dot * x_doubledot * cos(Q), wont it ?
No, this is not correct.
If I take the derivative of m*L*Q_dot* x_dot*cos(Q) according to x_dot, then I get m*L*Q_dot*cos(Q) according to x_dot. I then need to take the derivative of this with respect to t. This is where the product rule come in because both Q_dot AND cos(Q) depend on time. This results in the TWO terms in the parentheses.
@@Freeball99 I get X-dot derivation, what about theta dot. cause the derivation of theta dot for mine is -mL*Xdot*cos theta (only derivation of theta dot), with respect to time, isnt the formula mLX_dott*sin(theta)?
hi, sorry for a stupid question, but isn't derivative of sin(theta) at 3:14 just cos(theta)?
The derivative, d/dθ (sin θ) = cos θ HOWEVER, we are taking the derivative with respect to t and NOT with respect to θ. Therefore the chain rule must be applied. d/dt (sin θ) = cos θ · d/dt (θ)
@@Freeball99 dear sir, thanks a lot for the reply, i have figured that out just a few minutes ago, and you have confirmed it. although initially i thought it has something to do with derivative of a complex function, like d sin(f(t))/dt which is equal to cos(f(t))f(t) + f(t)'sin(f(t))
Is the reason F doesn't have a component in the second equation because it's only being applied to the cart?
Yes, you could say that. A better explanation would be that the force, F, acts only in the x-direction and produces no moment in the θ direction.
@@Freeball99 thanks for getting back to me. I realize my confusion was that considering the whole system, pulling the cart would cause the arm to rotate, but we are not considering the whole system but rather just the virtual work done by F, which is zero in the theta coordinate.
Adam Johnston correct. That’s an even better explanation.
Ok man but how do you linearize that equation so that a controller could model and control the motion of Pendulum?
You can linearize the equations by assuming small displacements and then eliminating all higher-order terms - i.e. fully expand out the equations and eliminate all terms that contain x^2, θ^2 or x.θ (or higher powers). Also you will make the approximation that sinθ=θ and cosθ=1.
@@Freeball99 yes i've learnt some tricks in 4 months. Thanks anyway. Appreciate it
may I ask for a reference source for this question, sir?
This problem exists in many references, however, this came from my own notes. The diagram I re-drew comes from Wikipedia though it too exists in many places online and in many textbooks. The inverted pendulum is a fairly common problem in vibrations and controls classes.
@@Freeball99 Yes, thank you. What is one source of the book, sir, because I really love working on problems like this
@@D4kwah.1d You can try Mechanical Vibrations by S. S. Rao, 5th Edition. It does not contain the inverted pendulum problem, however, there are many other examples in there.
@@Freeball99 thanks very much sir
@@Freeball99 I was reading a survey paper the other day that said the inverted pendulum problem has been used as an educational tool in controls for 62 years !!! web.mit.edu/klund/www/keeling/Pendulum2009.pdf
isn't this solution wrong? there must be (1/2).I.(w^2) in T, too (rotational kinetic energy)
Technically you are correct! However, for the case of the simple pendulum, it is typically assumed that we are dealing with point masses which is why we can ignore the rotational kinetic energy. I mentioned this in the video on the double pendulum, but should have been more clear here. The reality is, that when dealing with a simple pendulum, the rotational kinetic energy is typically negligible when compared to the translational kinetic energy (except for cases when the diameter of the mass is very large and the connecting rod is very short).
Also in reality, the connecting rod is not massless and it will also contribute to the rotational kinetic energy (and is usually more significant than the rotational KE of the mass). I have shown this for the case of the so-called "compound pendulum" in this video: ruclips.net/video/eBg8gof1RBg/видео.html
So, for the simple pendulum, you can ignore the rotational KE with little loss of accuracy.
@@Freeball99 Thanks for the informative video. But continuing with Enise's question, if we include rotational kinetic energy as well, what I (moment of inertia) should be taken. Is it about the centre of mass? or is it about the hinge?
@@ashishnegi9663 You need to find the rotational KE about the center of mass. The effects of the mass rotating about the hinge are already taken into account by considering its translational velocity relative to the hinge.
@@Freeball99 ok, thanks. I’ll think about it.
I think the last equation is wrong because
derivation of cos(&) = - sin(&)
Yes, that is correct. But according to Lagrange's Equation, I need to subtract this term. This flips the sign again. So we have three negative signs: 1) the original sign of the term, 2) the sign we get from taking the derivative 3) the sign we get from the 2nd term of Lagrange''s Equation after substitution.
@@Freeball99
I want to connect with you via whatsapp, sir
I am Control Engineer
@@perceptronsaber4479 I don't use WhatsApp. You can email me at: apf999@gmail.com
@@Freeball99 I was also trying to figure out why we got that negative. Thank you so much for the video and all the explanations
Hey Freeball,
Keep up the good work. Can't explain how helpful your contents are!
So I just felt like taking this cart and pendulum model to python and play around with the initial condition to see how the system reacted. As expected, the cart had movement even when the initial condition for x (cart's position) was zero for different values of theta (pendulum's position) implying that they are coupled. However, for the case where the pendulum was initially horizontal ( theta = pi/2) I found no movement in cart (x = zero for all t). This looks wrong intuitively... is it because the EOM don't have the x_dot terms in it?
I agree that something seems off here. The cart should move whenever the pendulum swings, regardless of its initial condition. This is not related to the EOM's having no x_dot terms (these would come from adding damping).
@@Freeball99 Hey there, I worked on it and figured out this was a non linear problem so the mass matrix( being part of 2n x 2n matrix A from your video on Direct time integration) and B matrix (comprising of damping and stiffness matrix) were also varying with time and I had considered them constant. This has solved the above problem of theta and x coupling for theta = pi/2.
The reason I asked about x_dot was that the absence of x_dot in the EOMs made it feel like the system behaved independent of cart velocity. So assume I give an initial velocity to the cart, the pendulum hence theta should change but it's not.
@@NYKYADU This problem is a semi-definite problem because the system is not restrained and can move as a rigid body without oscillating. For example, if initially the cart had some velocity, x_dot and the pendulum was pointing perfectly straight up (theta = 0) then the cart would just continue to move along at its initial velocity with the pendulum pointing straight up. The initial velocity of the cart doesn’t affect the pendulum (unless there is damping applied to the cart), but rather it is the accelerations of the cart that impart a force/moment to the pendulum and hence the coupling.
Pro Tip: Any time you are dealing with geometric nonlinear problems, you will have to update the stiffness matrix with each time step. You will also find that updating the mass matrix with each time step becomes very expensive because you need to invert M. Inverting a matrix requires in the order of n^2 iterations. As a result, as n grows, inverting the mass matrix becomes prohibitively expensive (time consuming). The good news is that in many instances you actually don’t need to update the mass matrix (unless mass is being lost by the system) and this results in very little loss of accuracy, but a huge improvement in speed. You should alway test whether not updating the mass matrix produces similar/accurate results.
@@Freeball99
That clears things up. Never crossed my mind that it was a semi definite system.
Trying to understand balancing of inverted pendulum now.
Thanks for the tip. You have been phenomenal. Thanks a lot.
@@NYKYADU the balancing of the pendulum, which is a controls problem, requires you to first linearize the EOM, by assuming that the displacements are small and then throwing away the higher-order terms and making appropriate substitutions i.e. Sin θ = θ and Cos θ = 1.