1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Lagrangian: Inverted telescoping pendulum (robot leg)

  1. Sep 6, 2010 #1
    Hi, hopefully someone can check my logic.

    I have a lever with a mass on top which is rising towards the vertical on a frictionless pivot. The length of the lever can change. (In reality this is a robot rocking onto a foot and straightening its leg). The intention is to bring the lever to a halt at the vertical by continuously controlling the length.

    I've been trying to use the Langrangian, but I'm not sure if I've captured the variables correctly.

    x is the length of the leg, theta is the angle from the vertical (so 0 is upright). (I hope my latex paste comes out ok)

    L=T-V \\
    L=\left[\frac{1}{2}m\omega^{2}+\frac{1}{2}m\dot{x}^{2}\right]-mgxcos(\theta) \\
    L=\frac{1}{2}m(x^{2}\dot{\theta}^{2}+\dot{x}^{2})-mgxcos(\theta)\\
    \frac{d}{dt}\frac{\partial L}{\partial\dot{\theta}}=\frac{\partial L}{\partial\theta}\\
    m\dot{x}^{2}\ddot{\theta}=mgxsin(\theta)\\
    \frac{d}{dt}\frac{\partial L}{\partial\dot{x}}=\frac{\partial L}{\partial x}\\
    m\ddot{x}=mx\dot{\theta}^{2}+mgsin(\theta)

    What worries me is the first partial derivative, something seems to be missing. Do I need to account for the energy involved in extending the leg?

    Then if you don't mind a mini part 2, if the pivot has friction, can I still use the Lagrangian (I assume not, but perhaps it's just an extra coefficient somewhere)
     
  2. jcsd
  3. Sep 6, 2010 #2

    Danger

    User Avatar
    Gold Member

    Welcome to PF, Garethpriede.
    If reality is involved, why on Earth would you assume a frictionless pivot?
    I have no idea about anything mathematical; I don't even know what a "Lagrangian" is, other than in reference to a Lagrange orbital point.
    I can't help wondering, though, why you can't just use a position sensor even as simple as a potentiometer to simply measure the leg position. That's how I'd do it, but I'm no genius. There are a lot of heavy-duty engineers and physicists here who can deal with the question in the way that you are hoping for. Unfortunately, I'm not one of them. :smile:
     
  4. Sep 6, 2010 #3
    Hi, thanks for the welcome :)

    I have sensors etc so I know what's happening in reality. But I need to design the control system and that requires some maths. Even if I'm making some simplifications, I need a solid base to start on. I saw quite a few other posts on solving Lagrangians, and even for pendulums and pendulums on springs, so I was hoping someone would see the "obvious flaw" in my derivation.
     
  5. Sep 6, 2010 #4

    Danger

    User Avatar
    Gold Member

    Ah, I see. Hmm... Fred Garvin was one of the PF experts in control systems, but I haven't seen anything from him in a long time. I think that Brewnog is very knowledgeable in the field as well, and definitely Astronuc. I'm sure that one or more of them can set you up.
     
  6. Sep 6, 2010 #5
    Sorry but the Latex code not coming out was really bugging me!

    [tex]
    L=T-V
    [/tex]

    then

    [tex]
    L=\left[\frac{1}{2}m\omega^{2}+\frac{1}{2}m\dot{x}^{2}\right]-mgxcos(\theta)
    [/tex]

    then

    [tex]
    L=\frac{1}{2}m(x^{2}\dot{\theta}^{2}+\dot{x}^{2})-mgxcos(\theta)\\
    [/tex]

    then

    [tex]
    \frac{d}{dt}\frac{\partial L}{\partial\dot{\theta}}=\frac{\partial L}{\partial\theta}\\
    [/tex]

    then

    [tex]
    m\dot{x}^{2}\ddot{\theta}=mgxsin(\theta)\\
    [/tex]

    and

    [tex]
    \frac{d}{dt}\frac{\partial L}{\partial\dot{x}}=\frac{\partial L}{\partial x}\\
    [/tex]

    then

    [tex]
    m\ddot{x}=mx\dot{\theta}^{2}+mgsin(\theta)
    [/tex]

    Isn't the energy of a rotating system
    [tex]
    E_{rot} = \frac{1}{2}I\omega^{2}
    [/tex]

    You can use the parallel-axis theorem to work out the mass-moment of inertia and I'm pretty damn sure that it will be a function of your x variable, that will probably create the missing extending arm term your missing.

    I'm interested how your going to control this - are you going to go for a state-space control of the pendulum ?
     
    Last edited: Sep 6, 2010
  7. Sep 14, 2010 #6
    If you want to add in friction you can model it using Reyleigh dissipation, basically the frictional terms appear as extra forces, so you get:

    [tex]\frac{d}{dt}\frac{\partial L}{\partial\dot{q}_{i}}-\frac{\partial L}{\partial q_{i}}=Q_{i}-D_{i}\dot{q_{i}}[/tex]

    Here [tex]Q_i[/tex] are the external applied forces for that i'th degree of freedom and [tex]D_i\dot{q_i}[/tex] are the friction terms you require.

    Sounds like a really fun problem :)

    Are you sure that is the right way to model the problem? Is the robot leg bending to change length?

    Can you please submit a diagram so that we can see the degrees of freedom?

    Lastly, if all that you can control is the length of the leg you're going to have a tough time to stabilise the system in the upright condition. Some work was done on stabilising an inverted pendulum using only movements that are parrallel to the length of the pendulum but that requires really high frequency pulsing.
     
    Last edited: Sep 14, 2010
  8. Sep 20, 2010 #7
    thanks for the reply, sorry for the delay in my reply.

    to provide some more input, I want a robot to rock sideways from leg to leg. So at t=0, the robot is balanced on the left leg with the right leg in the air and the legs are splayed by about 10degrees. It then starts to fall to the right until it lands on the right leg. Its momentum keeps it moving and it rises up on the right leg until it runs out of energy. It then falls back to the left again and repeats. There are losses in the ankle joint and the landing collision, so eventually the rocking comes to a halt.

    In order to overcome the losses and also to control the rocking frequency, i control the length of the landing leg (or you could call it the pivot leg) while the robot is rising and slowing down.

    i'm not interested in the dynamics while the robot is falling or with the collision, i only want to model what happens as the robot is rising on the pivot leg with a continuously changing leg length. so I can model this as an inverted pendulum with all the mass at the tip, having some initial angular velocity and some initial angle with the vertical.

    my first practical attempt is quite simple, I shorten the landing leg by a fixed amount to ensure there's enough angular velocity to keep the robot moving, then shortly afterwards, as soon as I have enough data to calculate the resulting angular velocity, I lengthen the leg once by some amount to stop it rocking too far (which I calculate using conservation of angular momentum, but that isn't the focus of this post)

    This results in a very rough controller which does work at keeping the robot rocking indefinitely, but without any insight into the frequency etc, and without the mathematical model to continuously control the leg length.

    So I've been trying to get a full non-linear model of the system, but my maths isn't up to it. It looks like a similar problem to the classical inverted-pendulum-on-a-cart problem, but without the cart and with a variable pendulum length. I'm happy to ignore the friction in the joint for now, I can determine it experimentally later, as a first go I just need to model the effect of leg length.

    Any help is greatly appreciated.
     
  9. Sep 20, 2010 #8
    Im assuming a point mass at the tip of an extendable rod, angle is zero when the rod is upright, the x direction is along the horizontal and y direction is along the vertical.

    Let the position vector be [tex]r(t)=[x,y][/tex]

    [tex]r(t)=[x(t)-l(t)sin\theta(t),\, l(t)cos\theta(t)][/tex]

    Therefore
    [tex]T=1/2m\dot{r(t)}\bullet\dot{r(t)}[/tex]

    Note: this is the vector dot product of [tex]\dot{r(t)}[/tex] with itself.

    [tex]V=mgl(t)cos(\theta(t))[/tex]

    Now the Lagragian is
    [tex]L=T-V[/tex]
    and you do exactly what we did before with the Lagrangian for each of the variables
    [tex]x(t),\theta(t), l(t)[/tex]
    but only [tex]l(t)[/tex] is actuated.

    Hence you'll get

    [tex]\frac{d}{dt}\frac{\partial L}{\partial \dot{x}}-\frac{\partial L}{\partial x}=0[/tex]

    [tex]\frac{d}{dt}\frac{\partial L}{\partial \dot{l}}-\frac{\partial L}{\partial l}=F_l[/tex]

    [tex]\frac{d}{dt}\frac{\partial L}{\partial \dot{\theta}}-\frac{\partial L}{\partial \theta}=0[/tex]

    where [tex]F_l[/tex] is the force you apply to lengthen or shorten the leg.

    I hope thats the sort of thing you were looking for :smile:
     
    Last edited: Sep 20, 2010
  10. Sep 20, 2010 #9
    As an aside, the other leg (i.e. the one not being balanced on) will enter the model as a stray (constant) torque in the [tex]\theta[/tex] co-ordinate, so you'll probably need to include it to model the dynamics correctly.

    Lastly, you are probably only interested in the dynamics in the [tex]\theta[/tex] co-ordinate only so you can neglect the other two equations if you assume that [tex]l(t)[/tex] moves to its controlled value much much faster than [tex]\theta(t)[/tex] changes.

    Hence you have

    [tex]\frac{d}{dt}\frac{\partial L}{\partial \dot{\theta}}-\frac{\partial L}{\partial \theta}=\tau_s[/tex]

    where [tex]\tau_s[/tex] is the stray torque I mentioned earlier
     
    Last edited: Sep 20, 2010
  11. Sep 22, 2010 #10
    Thankyou very much, that makes much better sense now. That's exactly what I was hoping to find out.
     
  12. Sep 22, 2010 #11
    My pleasure :smile:

    I've thought about some further refinements where you make the stray torque depend on the angle of the leg if you want to.

    [tex]\frac{d}{dt}\frac{\partial L}{\partial \dot{\theta}}-\frac{\partial L}{\partial \theta}=\tau_s(\theta)[/tex]

    Good luck!
    Let us know how it goes ^^
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Lagrangian: Inverted telescoping pendulum (robot leg)
Loading...