-
Notifications
You must be signed in to change notification settings - Fork 15
/
makeIgorKinematics.m
61 lines (49 loc) · 1.44 KB
/
makeIgorKinematics.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function [ legKin, armKin, chassisKin ] = makeIgorKinematics(numLegs, numArms)
%MAKEIGORKINEMATICS returns kinematics for the legs, arms, and chassis of
% the X-Series Igor Robot
%
% Andrew Willig
% Nov 2020
%
% Left Arm and Leg = 1
% Right Arm and Leg = 2
% Forward = X
% Left = Y
% Up = Z
% Get relative path
localDir = fileparts(mfilename('fullpath'));
%%%%%%%%%%%%%%%%%%
% Leg Kinematics %
%%%%%%%%%%%%%%%%%%
R_hip = R_x(pi/2);
xyz_hip = [0; .0225; .055];
T_hip = eye(4);
T_hip(1:3,1:3) = R_hip;
T_hip(1:3,4) = xyz_hip;
legBaseFrames(:,:,1) = eye(4);
legBaseFrames(:,:,2) = eye(4);
legBaseFrames(1:3,4,1) = [0; .15; 0];
legBaseFrames(1:3,4,2) = [0; -.15; 0];
legBaseFrames(1:3,1:3,1) = R_x(-pi/2);
legBaseFrames(1:3,1:3,2) = R_x(pi/2);
for leg = 1:numLegs
legKin{leg} = HebiUtils.loadHRDF([localDir '/hrdf/igorLeg.hrdf']);
legKin{leg}.setBaseFrame(legBaseFrames(:,:,leg));
end
%%%%%%%%%%%%%%%%%%
% Arm Kinematics %
%%%%%%%%%%%%%%%%%%
% 1 = Left, 2 = Right
armBaseXYZ(:,1) = [0; .10; .20];
armBaseXYZ(:,2) = [0; -.10; .20];
armKin{1} = HebiUtils.loadHRDF([localDir '/hrdf/igorArm-Left.hrdf']);
armKin{2} = HebiUtils.loadHRDF([localDir '/hrdf/igorArm-Right.hrdf']);
for arm = 1:numArms
armTransform = eye(4);
armTransform(1:3,4) = armBaseXYZ(:,arm);
armKin{arm}.setBaseFrame(armTransform);
end
%%%%%%%%%%%%%%%%%%%%%%
% Chassis Kinematics %
%%%%%%%%%%%%%%%%%%%%%%
chassiskin = HebiUtils.loadHRDF([localDir '/hrdf/igorChassis.hrdf']);