Compute Torque Control
Compute Torque Control
Lagrange-Euler Dynamics
i) Derive kinetic and potential energy
ii) Use Lagrange's equations of motion
Force, inertia, and Energy
Centripetal force : F cent =
mv 2
mrw 2 mr 2
r
linear velocity : v w r
1
2
P1 m1 ga1 s i n
1
velocity squared :
v2 x2 y 2 a1 1 a2 (1 2 ) 2 2a1a2 (1 12 ) cos 2
2
1
1
1
2
2
2
P2 m2 g y2 m2 g[a1 sin 1 a2 sin(1 2 )]
K 2 m2 v 2 2 m2 a1 2 1 2 m2 a 2 2 (1 2 ) 2 m2 a1 a 2 (1 2 12 ) cos 2
2) Lagrange's equation
d L L
)
dt q q
q 1 , q 1 , 1
2
2
2
L K P ( K1 K 2 ) ( P1 P2 )
1
1
2
2
2
2
(m1 m2 )a1 1 m2 a2 (1 2 ) 2 m2 a1a2 (1 12 ) cos 2
2
2
(m1 m2 ) ga1 sin 1 m2 ga2 sin(1 2 )
L
2
2
( m1 m2 ) a1 1 m2 a2 (1 2 ) m2 a1a2 ( 21 2 ) c o s 2
d L
2
2
( m1 m2 ) a1 1 m2 a2 (1 2 ) m2 a1a2 ( 21 2 ) c o s 2
dt 1
2
m2 a1a2 (212 1 ) sin 2
L
( m1 m2 ) ga1 cos1 m2 ga2 cos(1 2 )
1
L
2
m2 a2 (1 2 ) m2 a1a21 cos 2
2
d L
2
m2 a2 (1 2 ) m2 a1a21 cos 2 m2 a1a212 sin 2
dt 2
L
2
m2 a1a2 (1 12 ) sin 2 m2 ga2 cos(1 2 )
2
2
m2 a2 m2 a1a2 c o s 2
2
m2 a2 m2 a1a2 c o s 2 1
2
m2 a 2
2
2 sin
m2 ga2 cos(1 2 )
m
a
a
2 1 2 1
2
1
2
Mx
cx
M (q)q
Inertia
matrix
kx
V (q, q )
G (q)
Coriolis/centripetal
vector
Gravity
vector
3
* M(q) is symmetric.
Computed-Torque Control
( feedback linearization of nonlinear system)
Consider robot arm dynamics :
M (q)q N (q, q ) d
,where
d :
---
e(t ) qd (t ) q(t )
then,
e q d q
e qd q
e qd M 1 ( N d )
M (qd e) ( N d )
qd e M 1 ( N d )
e qd M 1 ( N d )
---
w M 1 d
then e u w
Defining state x :
e
x
e
u w
dt e 0 0 e I
I
---
dynamic is linear.
looks like feedback linearizing transformation
M (qd u) N
---
Kd e
Kp e
M ( qd
Kd e
K p e)
Kp e
Kd e
Kp e
Kp e
Kd e
e u w
():
Kd e
Kd e
Kp e
in state-space form :
d e
dt e
Kp
Kd e
Where, Kv diag{Kvi } ,
K p diag{K pi }
rowx_out=size(x,1);
x_end=x(rowx_out,:);
th_d=[g1*sin(fact*ts) g2*cos(fact*ts)];
dth_d=[g1*fact*cos(fact*ts) -g2*fact*sin(fact*ts)];
ddth_d=[-g1*fact^2*sin(fact*ts) -g2*fact^2*cos(fact*ts)];
e=[th_d(1)-x_end(1) th_d(2)-x_end(2)];
de=[dth_d(1)-x_end(3) dth_d(2)-x_end(4)];
m=[(m1+m2)*a1^2+m2*a2^2+2*m2*a1*a2*cos(x_end(2))
m2*a2^2+m2*a1*a2*cos(x_end(2))
m2*a2^2+m2*a1*a2*cos(x_end(2))
m2*a2^2];
m_inv=inv(m);
temp=-m2*a1*a2*(2*x_end(3)*x_end(4)+x_end(4)^2)*sin(x_end(2));
n=[temp+(m1+m2)*g*a1*cos(x_end(1))+m2*g*a2*cos(x_end(1)+x_end(2
))
m2*a1*a2*x_end(3)^2*sin(x_end(2))+m2*g*a2*cos(x_end(1)+x_end(2))]'
;
s=[ddth_d(1)+kv*de(1)+kp*e(1) ddth_d(2)+kv*de(2)+kp*e(2)];
torq=[m(1,1)*s(1)+m(1,2)*s(2)+n(1) m(1,2)*s(1)+m(2,2)*s(2)+n(2)];
[t,x_o]=ode45('xdot',[ts tf],x_end);
rowx_o=size(x_o,1);
x(rowx_out+1,:)=x_o(rowx_o,:);
theta(i+1,:)=th_d;
ee(i+1,:)=e;
tq(i+1,:)=torq;
subplot(3,1,1);
plot(theta), title('position and velocity');
subplot(3,1,2);
plot(ee), title('position error');
subplot(3,1,3);
%% FILE NAME=xdot.m
function x_dot=xdot(t,x)
global m_inv;
global n;
global torq;
x_dot=[
x(3)
x(4)
m_inv(1,1)*(-n(1)+torq(1))+m_inv(1,2)*(-n(2)+torq(2))
m_inv(1,1)*(-n(1)+torq(1))+m_inv(2,2)*(-n(2)+torq(2))
];
Kp e
Ki
Kd e
edt )
Kp e
Ki
K d e)
Ki
Kp
Kd e
0w
1
By Routh test
S3
Kd S 2
Kp S
Ki
K ii K vi K pi
9
10
11
12