-
+
@@ -1398,12 +1403,12 @@ The center of the frame if \(O_W\)
Reference Position with respect to fixed frame {W}: \({}^WT_R\)
-
Dxr = 0;
-Dyr = 0;
-Dzr = 0.1;
-Rxr = pi;
-Ryr = 0;
-Rzr = 0;
+ Dxr = 0;
+ Dyr = 0;
+ Dzr = 0.1;
+ Rxr = pi;
+ Ryr = 0;
+ Rzr = 0;
@@ -1411,12 +1416,12 @@ Rzr = 0;
Measured Position with respect to fixed frame {W}: \({}^WT_M\)
-
Dxm = 0;
-Dym = 0;
-Dzm = 0;
-Rxm = pi;
-Rym = 0;
-Rzm = 0;
+ Dxm = 0;
+ Dym = 0;
+ Dzm = 0;
+ Rxm = pi;
+ Rym = 0;
+ Rzm = 0;
@@ -1425,19 +1430,19 @@ We measure the position and orientation (pose) of the element represented by the
Thus we can compute the Homogeneous transformation matrix \({}^WT_M\).
-
%% Measured Pose
-WTm = zeros(4,4);
+
+ WTm = zeros(4,4);
-WTm(1:3, 1:3) = [cos(Rzm) -sin(Rzm) 0;
- sin(Rzm) cos(Rzm) 0;
- 0 0 1] * ...
- [cos(Rym) 0 sin(Rym);
- 0 1 0;
- -sin(Rym) 0 cos(Rym)] * ...
- [1 0 0;
- 0 cos(Rxm) -sin(Rxm);
- 0 sin(Rxm) cos(Rxm)];
-WTm(1:4, 4) = [Dxm ; Dym ; Dzm; 1];
+ WTm(1:3, 1:3) = [cos(Rzm) -sin(Rzm) 0;
+ sin(Rzm) cos(Rzm) 0;
+ 0 0 1] * ...
+ [cos(Rym) 0 sin(Rym);
+ 0 1 0;
+ -sin(Rym) 0 cos(Rym)] * ...
+ [1 0 0;
+ 0 cos(Rxm) -sin(Rxm);
+ 0 sin(Rxm) cos(Rxm)];
+ WTm(1:4, 4) = [Dxm ; Dym ; Dzm; 1];
@@ -1445,19 +1450,19 @@ WTm(1:4, 4) = [Dxm ; Dym ; Dzm; 1];
We can also compute the Homogeneous transformation matrix \({}^WT_R\) corresponding to the transformation required to go from fixed frame \(\{W\}\) to the wanted frame \(\{R\}\).
-
%% Reference Pose
-WTr = zeros(4,4);
+
+ WTr = zeros(4,4);
-WTr(1:3, 1:3) = [cos(Rzr) -sin(Rzr) 0;
- sin(Rzr) cos(Rzr) 0;
- 0 0 1] * ...
- [cos(Ryr) 0 sin(Ryr);
- 0 1 0;
- -sin(Ryr) 0 cos(Ryr)] * ...
- [1 0 0;
- 0 cos(Rxr) -sin(Rxr);
- 0 sin(Rxr) cos(Rxr)];
-WTr(1:4, 4) = [Dxr ; Dyr ; Dzr; 1];
+ WTr(1:3, 1:3) = [cos(Rzr) -sin(Rzr) 0;
+ sin(Rzr) cos(Rzr) 0;
+ 0 0 1] * ...
+ [cos(Ryr) 0 sin(Ryr);
+ 0 1 0;
+ -sin(Ryr) 0 cos(Ryr)] * ...
+ [1 0 0;
+ 0 cos(Rxr) -sin(Rxr);
+ 0 sin(Rxr) cos(Rxr)];
+ WTr(1:4, 4) = [Dxr ; Dyr ; Dzr; 1];
@@ -1465,8 +1470,8 @@ WTr(1:4, 4) = [Dxr ; Dyr ; Dzr; 1];
We can also compute \({}^WT_V\).
-
WTv = eye(4);
-WTv(1:3, 4) = WTm(1:3, 4);
+ WTv = eye(4);
+ WTv(1:3, 4) = WTm(1:3, 4);
@@ -1477,8 +1482,8 @@ This homogeneous transformation can be computed from the previously computed mat
-
%% Wanted pose expressed in a frame corresponding to the actual measured pose
-MTr = [WTm(1:3,1:3)', -WTm(1:3,1:3)'*WTm(1:3,4) ; 0 0 0 1]*WTr;
+
+ MTr = [WTm(1:3,1:3)', -WTm(1:3,1:3)'*WTm(1:3,4) ; 0 0 0 1]*WTr;
@@ -1487,22 +1492,22 @@ Now we want to express \({}^VT_R\):
\[ {}^VT_R = ({{}^WT_V}^{-1}) {}^WT_R \]
-
%% Wanted pose expressed in a frame coincident with the actual position but with no rotation
-VTr = [WTv(1:3,1:3)', -WTv(1:3,1:3)'*WTv(1:3,4) ; 0 0 0 1] * WTr;
+
+ VTr = [WTv(1:3,1:3)', -WTv(1:3,1:3)'*WTv(1:3,4) ; 0 0 0 1] * WTr;
-
%% Extract Translations and Rotations from the Homogeneous Matrix
-T = MTr;
-Edx = T(1, 4);
-Edy = T(2, 4);
-Edz = T(3, 4);
+
+ T = MTr;
+ Edx = T(1, 4);
+ Edy = T(2, 4);
+ Edz = T(3, 4);
-% The angles obtained are u-v-w Euler angles (rotations in the moving frame)
-Ery = atan2( T(1, 3), sqrt(T(1, 1)^2 + T(1, 2)^2));
-Erx = atan2(-T(2, 3)/cos(Ery), T(3, 3)/cos(Ery));
-Erz = atan2(-T(1, 2)/cos(Ery), T(1, 1)/cos(Ery));
+
+ Ery = atan2( T(1, 3), sqrt(T(1, 1)^2 + T(1, 2)^2));
+ Erx = atan2(-T(2, 3)/cos(Ery), T(3, 3)/cos(Ery));
+ Erz = atan2(-T(1, 2)/cos(Ery), T(1, 1)/cos(Ery));