Skip to content

Commit 44e4bf6

Browse files
committed
update examples
1 parent 6a2c660 commit 44e4bf6

5 files changed

Lines changed: 13 additions & 113 deletions

File tree

examples/continuous_time_vs/init.m

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
addpath('..\..\lib\')
33
addpath('..\..\lib\simulink')
44

5+
lambda = 10;
6+
57
% O = Object
68
% C = camera
79
% W = space/world
@@ -29,57 +31,21 @@
2931
vMax = .5;
3032
wMax = deg2rad(20);
3133

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];
4834
[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);
4935
[rotax] = (r_eq3+r_eq2)/2;
5036
rotax = unit(rotax);
51-
% % rotax = unit(rand(3,1));
52-
% % rotax = [-0.4538 -0.8911 -0.0001]';
5337
rotang = 0* deg2rad(120);
5438
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];
5940
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]');
6141

6242

6343
W_p_C_0 = W_T_C_0.transl';
6444
W_q_C_0 = rotm2quat(W_T_C_0.R);
6545

6646
% 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);
7347
C_features_0 = homtrans(inv(W_T_C_0), W_features);
7448

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-
%
8349
% C0_T_Cdesired = camera desired pose w.r.t. initial camera frame (actual)
8450
C0_T_Cdesired = inv(W_T_C_0) * W_T_C_desired;
8551
% Cdesired_T_C0 = initial camera pose w.r.t. desired camera frame (actual)
@@ -93,22 +59,9 @@
9359
s0 = C_features_0(:);
9460
e0 = s0 - C_features_desired(:); % should be 0 if eo=0;
9561

96-
lambda = 10;
97-
9862
C_features_0_ = homtrans(inv(W_T_C_0)*SE3(rotx(5),[0 0.2 0.01]), W_features);
9963
s0_ = C_features_0_(:);
10064
e0_ = s0_ - C_features_desired(:);
10165

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+
11467

-602 Bytes
Binary file not shown.

examples/discrete_time_vs/init.m

Lines changed: 7 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
clear all
2+
13
%% add path
24
addpath('..\..\lib\')
35
addpath('..\..\lib\simulink')
@@ -26,36 +28,16 @@
2628

2729
Ts = 0.1;
2830
lambdaT_const = 1;
29-
vMax = .5;
30-
wMax = deg2rad(20);
31-
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];
31+
vMax = 1;
32+
wMax = deg2rad(60);
33+
34+
4835
[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);
4936
[rotax] = (r_eq3+r_eq2)/2;
5037
rotax = unit(rotax);
51-
% % rotax = unit(rand(3,1));
52-
% % rotax = [-0.4538 -0.8911 -0.0001]';
5338
rotang = deg2rad(120);
5439
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);
40+
t_0 = [1; 0; 0]; % 1e-4 = converge a shat
5941
W_T_C_0 = W_T_C_desired*SE3(R_0, t_0);
6042
% % W_T_C_0 = W_T_C_desired*SE3(roty(180)*rotx(0), [0, 0, 0]');
6143

@@ -64,21 +46,8 @@
6446
W_q_C_0 = rotm2quat(W_T_C_0.R);
6547

6648
% 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);
7349
C_features_0 = homtrans(inv(W_T_C_0), W_features);
7450

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;
8251
%
8352
% C0_T_Cdesired = camera desired pose w.r.t. initial camera frame (actual)
8453
C0_T_Cdesired = inv(W_T_C_0) * W_T_C_desired;
@@ -91,18 +60,3 @@
9160

9261
s_star_end = C_features_desired(:);
9362
s0 = C_features_0(:);
94-
e0 = s0 - C_features_desired(:); % should be 0 if eo=0;
95-
96-
%% sim e_tilde
97-
% lambda_const = 1/Ts;
98-
% s_star = C_features_desired(:);
99-
% lambda = lambda_const*.5;
100-
% r_eq = calcEQrotax(C_features_desired,3);
101-
% R_eq = angvec2r(deg2rad(180),r_eq);
102-
% t_eq = (eye(3)-R_eq)*sum(C_features_desired,2)/size(C_features_desired,2);
103-
% s_eq = homtrans([R_eq, t_eq; 0 0 0 1], C_features_desired);
104-
% s_eq = s_eq(:);
105-
% e_eq = s_eq - s_star;
106-
% return
107-
% s_star, lambda, e_eq
108-

examples/sim_near_pi/init.m

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
%% params
99

1010
Ts = 0.1;
11-
vMax = inf;%0.5;
12-
wMax = inf;%0.6;
11+
vMax = inf;
12+
wMax = inf;
1313

1414
load_O_features;
1515

@@ -18,17 +18,10 @@
1818
rotax = unit(rotax);
1919
rotang = deg2rad(180);
2020
R_0 = angvec2r(rotang,rotax);
21-
% t_0 = (eye(3)-R_0)*sum(C_features_desired,2)/size(C_features_desired,2);
22-
% t_0 = t_0*0 + [1; 0; 0]; % 1e-4 = converge a shat
2321
t_0 = [.3; 0; 0];
24-
% % t_0 = t_0 + [0; ll; 0];
2522
Cd_T_C0_ins = SE3(R_0, t_0);
26-
% W_T_C_0 = W_T_C_desired*SE3(R_0, t_0);
2723
C0_T_Cd = inv(Cd_T_C0_ins);
2824

29-
% C0_T_Cd = SE3(rotx(180)*roty(180)*rotz(180), [0.2, 0.1, 0.3]');
30-
31-
% C0_T_Cd = SE3(rotx(0.1)*roty(0.1)*rotz(0.1), [0.001, 0.001, 0.001]');
3225

3326
%% init
3427

1.18 KB
Binary file not shown.

0 commit comments

Comments
 (0)