forked from s-kajita/IntroductionToHumanoidRobotics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSE3dynamics.m
More file actions
23 lines (19 loc) · 702 Bytes
/
SE3dynamics.m
File metadata and controls
23 lines (19 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function [P,L] = SE3dynamics(j,f,tau)
global uLINK
w_c = uLINK(j).R * uLINK(j).c + uLINK(j).p; % center of mass
w_I = uLINK(j).R * uLINK(j).I * uLINK(j).R'; % inertia in world frame
c_hat = hat(w_c);
Iww = w_I + uLINK(j).m * c_hat * c_hat';
Ivv = uLINK(j).m * eye(3);
Iwv = uLINK(j).m * c_hat;
P = uLINK(j).m * (uLINK(j).vo + cross(uLINK(j).w,w_c)); % linear momentum
L = uLINK(j).m * cross(w_c,uLINK(j).vo) + Iww * uLINK(j).w; % angular momentum
pp = [cross(uLINK(j).w,P);
cross(uLINK(j).vo,P) + cross(uLINK(j).w,L)];
if nargin == 3
pp = pp - [f; tau]; % 外力,外モーメントを加算
end
Ia = [Ivv, Iwv'; Iwv, Iww];
a0 = -Ia \ pp;
uLINK(j).dvo = a0(1:3);
uLINK(j).dw = a0(4:6);