forked from petercorke/robotics-toolbox-matlab
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathETS2Test.m
65 lines (48 loc) · 1.33 KB
/
ETS2Test.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
62
63
64
65
function tests = ETS2Test
tests = functiontests(localfunctions);
clc
end
function revolute1_test(tc)
import ETS2.*
a1 = 1;
E = Rz('q1') * Tx(a1);
tc.verifyTrue(isa(E, 'ETS2'))
tc.verifySize(E, [1 2])
tc.verifyEqual(E.n, 1) % number of joints
tc.verifyClass(char(E), 'char')
tc.verifyEqual(E.structure, 'R');
end
function revolute2_test(tc)
import ETS2.*
a1 = 1; a2 = 1;
E = Rz('q1') * Tx(a1) * Rz('q2') * Tx(a2);
tc.verifyTrue(isa(E, 'ETS2'))
tc.verifySize(E, [1 4])
tc.verifyEqual(E.n, 2) % number of joints
tc.verifyClass(char(E), 'char')
tc.verifyEqual(E.structure, 'RR');
end
function prismatic_test(tc)
import ETS2.*
a1 = 1;
E = Rz('q1') * Tx(a1) * Tx('q2');
tc.verifyTrue(isa(E, 'ETS2'))
tc.verifySize(E, [1 3])
tc.verifyEqual(E.n, 2) % number of joints
tc.verifyClass(char(E), 'char')
tc.verifyEqual(E.structure, 'RP');
end
function fkine_test(tc)
import ETS2.*
a1 = 1;
E = Rz('q1') * Tx(a1) * Tx('q2');
T = E.fkine([pi/2 1]);
tc.verifyClass(T, 'SE2')
tc.verifyEqual(double(T), [0 -1 0; 1 0 2; 0 0 1], 'AbsTol', 1e-12)
end
function plot_test(tc)
import ETS2.*
a1 = 1; a2 = 1;
E = Rz('q1') * Tx(a1) * Rz('q2') * Tx(a2);
E.plot([pi/4 -pi/4])
end