|
2 | 2 | addpath('..\..\lib\') |
3 | 3 | addpath('..\..\lib\simulink') |
4 | 4 |
|
| 5 | +lambda = 10; |
| 6 | + |
5 | 7 | % O = Object |
6 | 8 | % C = camera |
7 | 9 | % W = space/world |
|
29 | 31 | vMax = .5; |
30 | 32 | wMax = deg2rad(20); |
31 | 33 |
|
32 | | -% W_T_C_0 = initial Camera pose w.r.t. world frame |
33 | | -% W_T_C_0 = W_T_C_desired*SE3(roty(180)*rotz(0), [.2, .2, -.5]'); |
34 | | -% W_T_C_0 = W_T_C_desired*SE3(roty(180)*rotz(0), [.2, .2, -.5]'); |
35 | | -% W_T_C_0 = W_T_C_desired*SE3(roty(1)*rotz(1), [0.01, 0, 0]'); |
36 | | -% W_T_C_0 = W_T_C_desired*SE3(roty(20)*rotz(10), ([1, 1, -1]/4.442636782659956)'); |
37 | | -% W_T_C_0 = W_T_C_desired*SE3(rotz(180)*roty(10), [10, 10, -10]'); |
38 | | -% W_T_C_0 = W_T_C_desired*SE3(roty(90)*rotz(90), [0.1, 0.1, -0.25]'); |
39 | | -% W_T_C_0 = W_T_C_desired*SE3(roty(0)*rotz(0), [-.2, -.2, -1]'); |
40 | | -% W_T_C_0 = W_T_C_desired*SE3(roty(70)*rotz(70), [0, 0, 0]'); |
41 | | -% W_T_C_0 = W_T_C_desired*SE3(roty(20)*rotz(10), [10, 10, -10]'); |
42 | | -% W_T_C_0 = W_T_C_desired*SE3(roty(180)*rotz(180), [10, 10, -10]'); |
43 | | -% W_T_C_0 = W_T_C_desired*SE3(roty(180)*rotz(30), [.1, .1, -0.2]'); |
44 | | - |
45 | | -% % rotax = sum(C_features_desired,2)/size(C_features_desired,2); |
46 | | -% % rotax = rand(3,1); |
47 | | -% % rotax = [0;1;0]; |
48 | 34 | [s_eq1, s_eq2, s_eq3, t_eq1, R_eq1, t_eq2, R_eq2, t_eq3, R_eq3, r_eq1, r_eq2, r_eq3] = computeEqPoints(C_features_desired); |
49 | 35 | [rotax] = (r_eq3+r_eq2)/2; |
50 | 36 | rotax = unit(rotax); |
51 | | -% % rotax = unit(rand(3,1)); |
52 | | -% % rotax = [-0.4538 -0.8911 -0.0001]'; |
53 | 37 | rotang = 0* deg2rad(120); |
54 | 38 | R_0 = angvec2r(rotang,rotax); |
55 | | -t_0 = (eye(3)-R_0)*sum(C_features_desired,2)/size(C_features_desired,2); |
56 | | -t_0 = t_0*0 + [1; 0; 0]; % 1e-4 = converge a shat |
57 | | -% % t_0 = t_0 + [0; ll; 0]; |
58 | | -Cd_T_C0_ins = SE3(R_0, t_0); |
| 39 | +t_0 = [1; 0; 0]; |
59 | 40 | W_T_C_0 = W_T_C_desired*SE3(R_0, t_0); |
60 | | -% % W_T_C_0 = W_T_C_desired*SE3(roty(180)*rotx(0), [0, 0, 0]'); |
61 | 41 |
|
62 | 42 |
|
63 | 43 | W_p_C_0 = W_T_C_0.transl'; |
64 | 44 | W_q_C_0 = rotm2quat(W_T_C_0.R); |
65 | 45 |
|
66 | 46 | % C_features_0 = features w.r.t. Camera initial frame |
67 | | - W_T_C_0_pert = W_T_C_0; |
68 | | -% W_T_C_0_pert = W_T_C_0*(Cd_T_C0_ins); |
69 | | -% W_T_C_0_pert = SE3([ rotx(180) [0 0 0]'; 0 0 0 1 ]); |
70 | | -% W_T_C_0_pert = W_T_C_0 * SE3([ rotx(180)*roty(180)*rotz(180) [0 0 0.0]'; 0 0 0 1 ]); |
71 | | -% W_T_C_0_pert = W_T_C_desired*SE3(roty(180)*rotz(0), [.2, .2, -.5]'); |
72 | | -C_features_0_pert = homtrans(inv(W_T_C_0_pert), W_features); |
73 | 47 | C_features_0 = homtrans(inv(W_T_C_0), W_features); |
74 | 48 |
|
75 | | -% % Compute the desired camera pose w.r.t. the initial camera pose with the |
76 | | -% % algorithm on the features |
77 | | -% [C0_T_Cdesired__alg] = computeTfeatures(C_features_0,C_features_desired); |
78 | | -% C0_T_Cdesired__alg = inv(C0_T_Cdesired__alg); % inversion needed |
79 | | -% % W_T_Cdesired_alg = camera desired pose w.r.t. world frame (after |
80 | | -% % algorithm) |
81 | | -% W_T_Cdesired_alg = W_T_C_0 * C0_T_Cdesired__alg; |
82 | | -% |
83 | 49 | % C0_T_Cdesired = camera desired pose w.r.t. initial camera frame (actual) |
84 | 50 | C0_T_Cdesired = inv(W_T_C_0) * W_T_C_desired; |
85 | 51 | % Cdesired_T_C0 = initial camera pose w.r.t. desired camera frame (actual) |
|
93 | 59 | s0 = C_features_0(:); |
94 | 60 | e0 = s0 - C_features_desired(:); % should be 0 if eo=0; |
95 | 61 |
|
96 | | -lambda = 10; |
97 | | - |
98 | 62 | C_features_0_ = homtrans(inv(W_T_C_0)*SE3(rotx(5),[0 0.2 0.01]), W_features); |
99 | 63 | s0_ = C_features_0_(:); |
100 | 64 | e0_ = s0_ - C_features_desired(:); |
101 | 65 |
|
102 | | -%% sim e_tilde |
103 | | -% lambda_const = 1/Ts; |
104 | | -% s_star = C_features_desired(:); |
105 | | -% lambda = lambda_const*.5; |
106 | | -% r_eq = calcEQrotax(C_features_desired,3); |
107 | | -% R_eq = angvec2r(deg2rad(180),r_eq); |
108 | | -% t_eq = (eye(3)-R_eq)*sum(C_features_desired,2)/size(C_features_desired,2); |
109 | | -% s_eq = homtrans([R_eq, t_eq; 0 0 0 1], C_features_desired); |
110 | | -% s_eq = s_eq(:); |
111 | | -% e_eq = s_eq - s_star; |
112 | | -% return |
113 | | -% s_star, lambda, e_eq |
| 66 | + |
114 | 67 |
|
0 commit comments