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 the Matlab Symbolic Math Toolbox™

Problem 1 (Hovering Mass)

Principal Rotation Matrix

Rotation around an axis. Positive angle with the clock (Positive if vector with clock, and frame against clock).


Link to original

a)

The following Matlab script implements this

clear all
clc
 
% Parameters
syms m1 m2 L g real
%Force
u = sym('u', [3,1]);
 
% Position of point mass 1
pm1 = sym('p1', [3,1]);
dpm1 = sym ('dp1', [3,1]);
ddpm1 = sym('d2p1', [3,1]);
% Angles for point mass 2
a = sym('a', [2,1]); % a(1) is theta, a(2) is phi
da = sym('da', [2,1]);
dda = sym('d2a', [2,1]);
% Generalized coordinates
q = [pm1; a];
dq = [dpm1; da];
ddq = [ddpm1; dda];
 
% Position of point mass 2
pm2 = pm1 + L* [-sin(a(1))*cos(a(2));
                sin(a(2)); 
                -cos(a(1))*cos(a(2))];
% Velocity of point mass 2
dpm2 = jacobian(pm2, q)*dq;
% Generalized forces
Q = [u; 0; 0];
% Kinetic energy
T = 1/2*m1*dpm1.'*dpm1 + 1/2*m2*dpm2.'*dpm2;
T = simplify(T);
%Potential energy
V = g*(m1*pm1(3)+m2*pm2(3));
%Lagrangian
Lagr = T-V;
 
% Derivatives of the Lagrangian
Lagr_q = simplify(jacobian(Lagr,q)).';
Lagr_qdq = simplify(jacobian(Lagr_q.',dq));
Lagr_dq = simplify(jacobian(Lagr,dq)).';
Lagr_dqdq = simplify(jacobian(Lagr_dq.', dq)); %W
 
% Matrices for problem 1
M = Lagr_dqdq
b = Q + simplify(Lagr_q - Lagr_qdq*dq) 

b)

Problem 2 (-robot)

a)

b)

c)

The differential index of a DAE is the number of times must be applied in order to turn the DAE into an ODE.

Link to original

d)

Consistency Condition

Assume a hard problem (Differential Index > 1)

How to ensure that implies that ?

  • Need to impose
Link to original