Assignment 6 - Constrained Lagrange

Assignment 6 - Constrained Lagrange#

Note

Submit your assignment as a single PDF, including plots and source code (if any). We expect academic honesty. Collaboration is encouraged, but must be declared. Any use of AI must be declared along with any other sources used. This is not an exam. Do your best and show that you put in effort and the assignment will be approved.

In this assignment we will study the modeling of complex mechanical systems using the constrained Lagrange equations. Since the calculations of the partial derivatives of the Lagrangian can be involved, we will once more outsource this task by using SymPy.

Problem 1 - Hovering Mass#

Note

This problem contains a programming exercise. Template code is available as a Jupyter notebook at TTK4130/code-handouts. The relevant notebook is assingment-6-hovering-mass.ipynb.

We consider a helicopter lifting a mass. We model this system as two point masses coupled by a rigid link with length \(L\). The masses are \(m_1\) and \(m_2\), and their positions in space are given by \(\mathbf{p}_1 \in \mathbb{R}^3\) and \(\mathbf{p}_2 \in \mathbb{R}^3\). We assume that an external force \(\mathbf{u} \in \mathbb{R}^3\) is applied to \(m_1\) (helicopter).

a. Classical Lagrange Approach

We will first model this system using the classical Lagrange approach, where the number of coordinates equals the number of degrees of freedom. The position of the helicopter is described by \(\mathbf{p}_1 \in \mathbb{R}^3\), and the position of the hovering mass is described by the two angles \(\theta, \phi\), which give the orientation of the rigid link (spherical coordinates). Hence, the generalized coordinates are:

(45)#\[\begin{split}\mathbf{q} = \begin{bmatrix} \mathbf{p}_1 \\ \theta \\ \phi \end{bmatrix} \in \mathbb{R}^5.\end{split}\]

The fully assembled model takes the form:

(46)#\[\begin{split}\begin{aligned} \dot{\mathbf{q}} &= \mathbf{v},\\ M(\mathbf{q})\dot{\mathbf{v}} &= \mathbf{b}(\mathbf{q},\dot{\mathbf{q}},\mathbf{u}). \end{aligned}\end{split}\]

Complete the template assingment-6-hovering-mass.ipynb (found in the code handout repository) by performing the following tasks:

  1. Write the expression for the position \(\mathbf{p}_2\) of mass \(m_2\) from \(\mathbf{q}\).

  2. Write the expression for the generalized forces.

  3. Write the expression for the kinetic energy.

  4. Write the expression for the potential energy.

  5. Write the expression for the Lagrangian.

  6. Run the routine to obtain the expressions for \(M\) and \(\mathbf{b}\).

Include the equations and the implemented code in your answer.

b. Constrained Lagrange Approach

We now use the constrained Lagrange approach to model the system dynamics. The generalized coordinates in this case are:

(47)#\[\begin{split}\mathbf{q} = \begin{bmatrix} \mathbf{p}_1 \\ \mathbf{p}_2 \end{bmatrix} \in \mathbb{R}^6,\end{split}\]

and the scalar constraint is given by:

(48)#\[C = \frac{1}{2} \left( \mathbf{e}^\top \mathbf{e} - L^2 \right), \quad \text{where} \quad \mathbf{e} = \mathbf{p}_1 - \mathbf{p}_2.\]

The system dynamics are:

(49)#\[\begin{split}\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}t} \frac{\partial \mathcal{L}}{\partial \dot{\mathbf{q}}}(\mathbf{q},\dot{\mathbf{q}}) - \frac{\partial \mathcal{L}}{\partial \mathbf{q}}(\mathbf{q},\dot{\mathbf{q}}) - z \nabla C(\mathbf{q}) &= \mathbf{Q},\\ C(\mathbf{q}) &= 0. \end{aligned}\end{split}\]

The fully assembled model takes the form:

(50)#\[\begin{split}\begin{aligned} \dot{\mathbf{q}} &= \mathbf{v},\\ M(\mathbf{q}) \dot{\mathbf{v}} &= \mathbf{b}(\mathbf{q},\mathbf{z},\mathbf{u}),\\ 0 &= C(\mathbf{q}). \end{aligned}\end{split}\]

Perform the following tasks:

  1. Derive the model matrices \(M(\mathbf{q})\) and \(\mathbf{b}(\mathbf{q}, \dot{\mathbf{q}}, \mathbf{u})\).

  2. Compare the complexity of the models from part (a) and (b) in terms of symbolic expressions for \(M\) and \(\mathbf{b}\). What do you conclude?

Problem 2 - Delta-Robot#

Delta-robots are common in ultra-fast packaging applications. Figure Fig. 16 illustrates a Delta-robot. The three yellow arms of length \(l\) are actuated and can pivot in their vertical planes. These arms drive the three double thin rods of length \(L\) (typically made of ultra-light carbon fiber), connected to the nacelle (triangular shape at the bottom). The geometry imposes that the nacelle always remains horizontal. Moreover, the pivots on the nacelle are forced to remain at a distance \(L\) from the pivot at the extremities of the yellow arms.

In order to express the Lagrange function and the constraints, the following parameters and variables are defined: The Cartesian frame has its origin at the center of the upper platform, with the \(x\)-axis aligned with the frontal robot arm, and the \(z\)-axis pointing up. The position of the pivots of the yellow arms in this Cartesian frame, \(\mathbf{p}_{1,2,3}\), are given by

(51)#\[\begin{split}\mathbf{p}_k= R_k\begin{bmatrix}d+l\cos\alpha_k \\ 0 \\ -l\sin\alpha_k \end{bmatrix},\quad R_k = \begin{bmatrix}\cos \gamma_k & -\sin\gamma_k & 0 \\ \sin \gamma_k & \cos\gamma_k & 0 \\ 0 & 0 & 1\end{bmatrix},\end{split}\]

where \(\gamma_{1,2,3} = \left\{0, \frac{2\pi}{3},\frac{4\pi}{3}\right\}\), \(d\) is the constant distance from the center of the upper platform to the axis of the motors (black in the figure), and \(\alpha_k\) are the angles of the yellow arms with respect to the horizontal plane. The yellow arms together with the motors have an inertia \(J\), i.e. their kinetic energy is \(T_k = \frac{1}{2}J\dot\alpha_k^2\). The nacelle has a mass \(m\). For simplicity, we will assume that the nacelle is just a point where the long arms are all connected. This is a simplification.

../_images/Delta.svg

Fig. 16 Illustration of the Delta-robot. The yellow arms (length \(l\)) are actuated by the motors on the upper platform (black boxes).#

Tasks

a. Classical Unconstrained Lagrange Approach

Assume that we use the classical unconstrained Lagrange approach with the angles \(\alpha_{1,2,3}\) as the generalized coordinates. Explain what is the challenge with this approach in this particular case.

Hint: How would you find the position of the nacelle as a function of the generalized coordinates?

We choose the following generalized coordinates for the Delta-robot:

(52)#\[\begin{split}\mathbf{q} = \begin{bmatrix}\alpha_1 \\ \alpha_2 \\ \alpha_3 \\ \mathbf{p}\end{bmatrix},\end{split}\]

where \(\mathbf{p}\in\mathbb{R}^3\) is the position of the nacelle.

b. Lagrange Function and Constraints

Write down the Lagrange function \(\mathcal{L}\) of the Delta-robot, as well as the associated constraints \(\mathbf{c}\).

c. Differential Index of the DAE

What is the differential index of the DAE that results from \(\mathcal{L}\) and \(\mathbf{c}\)?

d. Consistency Conditions

What are the consistency conditions of the Delta-robot? The explicit expression is not needed, only the abstract form.