1 of 30

��Chapter 3�Euler-Lagrange Equations

2 of 30

Euler-Lagrange Equations

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

2

3 of 30

Potential Energy

  • Two types in this class, 1) gravity field, 2) compliance or springs
  • Gravity (typically zero when y, or other configuration variable is zero)

  • Springs (works for rotary and linear springs)

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

3

4 of 30

Generalized Coordinates and Forces

  • Generalized Coordinates – Minimum set of variables used to uniquely define the configuration of a mechanical system
    • Examples:
      • Robot arm – one degree of freedom or variable (theta)
      • Pendulum on cart – two degrees of freedom (theta and z)
      • Satellite – two degrees of freedom (theta and phi)
  • Generalized Forces – nonconservative forces and torques that act in the direction of each generalized coordinate.
    • E.g. the applied forces, either by actuators or by friction and other external forces.

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

4

5 of 30

Friction and Any Other External Force

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

5

  • Book presents one model of what is called “viscous friction” (where a constant coefficient multiplies the derivative of our generalized coordinates), but there are many other models.
  • All of the nonconservative forces (including other friction models) would be placed on the right-hand side!!!

6 of 30

Friction and Any Other External Force

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

6

 

7 of 30

Friction and Any Other External Force

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

7

8 of 30

Design Study A

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

8

9 of 30

Design Study A

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

9

10 of 30

Design Study B

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

10

11 of 30

Design Study B

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

11

12 of 30

Design Study B

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

12

13 of 30

Design Study C

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

13

14 of 30

Design Study C

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

14

15 of 30

Design Study C

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

15

16 of 30

Appendix P.4�Numerical Solutions to Differential Equations

16

17 of 30

Numerically Solving an ODE

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

17

18 of 30

Numerically Solving an ODE

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

18

19 of 30

Euler Method / Runge-Kutta 1 (RK1)

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

19

20 of 30

Euler Method / Runge-Kutta 1 (RK1)

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

20

import numpy as np

class systemDynamics:

# Model the system yddot + a1*ydot + a2*sin(y) = b*u

def __init__(self, Ts=0.01):

self.Ts = Ts # sample rate

# Specify the initial condition

y0 = 0.0 # y at time zero

ydot0 = 0.0 # ydot at time zero

self.state = np.array([[y0], [ydot0]]) # state at time zero

self.a1 = 2.0

self.a2 = 2.0

self.b = 4.0

def update(self, u):

# This is the external method that takes the input u and

# returns the output y.

self.rk1_step(u) # propagate the state by one time sample

y = self.h() # return the corresponding output

return y

def rk1_step(self, u):

# Integrate ODE using Runge-Kutta RK1 algorithm

F1 = self.f(self.state, u)

self.state = self.state + self.Ts * F1

21 of 30

Runge-Kutta 2 (RK2)

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

21

22 of 30

Runge-Kutta 2 (RK2)

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

22

import numpy as np

class systemDynamics:

    #  Model the system yddot + a1*ydot + a2*sin(y) = b*u

    def __init__(self, Ts=0.01):

        self.Ts = Ts  # sample rate

        # Specify the initial condition

        y0 = 0.0  # y at time zero

        ydot0 = 0.0  # ydot at time zero

        self.state = np.array([[y0],[ydot0]])  # state at time zero

        self.a1 = 2.0

        self.a2 = 2.0

        self.b = 4.0�

    def update(self, u):

        # This is the external method that takes the input u and

        # returns the output y.

        self.rk2_step(u)  # propagate the state by one time sample

        y = self.h()  # return the corresponding output

        return y�

    def rk2_step(self, u):

        # Integrate ODE using Runge-Kutta RK2 algorithm

        F1 = self.f(self.state, u)

        F2 = self.f(self.state + self.Ts / 2 * F1, u)

        self.state += self.Ts / 2 * (F1 + F2)

23 of 30

Runge-Kutta 4 (RK4)

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

23

24 of 30

Runge-Kutta 4 (RK4)

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

24

import numpy as np

class systemDynamics:

    #  Model the system yddot + a1*ydot + a2*sin(y) = b*u

    def __init__(self, Ts=0.01):

        self.Ts = Ts  # sample rate

        # Specify the initial condition

        y0 = 0.0  # y at time zero

        ydot0 = 0.0  # ydot at time zero

        self.state = np.array([[y0],[ydot0]])  # state at time zero

        self.a1 = 2.0

        self.a2 = 2.0

        self.b = 4.0�

    def update(self, u):

        # This is the external method that takes the input u and

        # returns the output y.

        self.rk4_step(u)  # propagate the state by one time sample

        y = self.h()  # return the corresponding output

        return y�

def rk4_step(self, u):

# Integrate ODE using Runge-Kutta RK4 algorithm

F1 = self.f(self.state, u)

F2 = self.f(self.state + self.Ts / 2 * F1, u)

F3 = self.f(self.state + self.Ts / 2 * F2, u)

F4 = self.f(self.state + self.Ts * F3, u)

self.state += self.Ts / 6 * (F1 + 2 * F2 + 2 * F3 + F4)

25 of 30

Design Study A

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

25

26 of 30

Design Study A

  • Discuss python implementation

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

26

27 of 30

Design Study B

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

27

28 of 30

Design Study B

  • Discuss python implementation

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

28

29 of 30

Design Study C

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

29

30 of 30

Design Study C

  • Discuss python implementation

Introduction to Feedback Control, Beard, McLain, Peterson, Killpack

30