You are on page 1of 7

1

Autonomous Systems Lecture HW01


Arturo Gomez Chavez
Due: 19-Sep-2013

1 Problem
Given the quaternions
q1 = (1, (2, 3, 4)) and q2 = (0.4811480, (0.1984591, 0.7246066, 0.4517253))
Which of the two represents an orientation? And why?
In order to represent an orientation (an angle displacement in the 3D space),
a quaternion q = qo + ~q must have a norm equal to 1; N (q) = 1. If this is the
case,
2

qo 2 + |~q| = 1
And since for any angle we know that
cos2 + sin2 = 1
2

there must be some angle such that cos2 = qo 2 and sin2 = |~q| . In this
way, if we have a unit quaternion we can associate an angle to it and represent
an orientation.
Based upon this, we compute the norm of the given quaternions to know if
they are unit quaternions.

N (q1 ) = 12 + 22 + 32 + 42 5.477 > 1

N (q2 ) = 0.48114802 + 0.19845912 + 0.72460662 + 0.45172532 1


As we can see, quaternion q1 cannot represent an orientation because it is not
a unit vector, but quaternion q2 can.

2 Problem
What are the quaternion representations of the three axes x, y and z in a Cartesian coordinate systems?
Vectors are represented in R4 as quaternions with a scalar value of zero.
Hence, since the axes x, y, z are represented in R3 as < 1, 0, 0 >, < 0, 1, 0 > and
< 0, 0, 1 > respectively, their quaternions representations are:
qx = (0, (1, 0, 0)) = 0 + i
qy = (0, (0, 1, 0)) = 0 + j
qz = (0, (0, 0, 1)) = 0 + k

for axis x
for axis y
for axis z

3 Problem
Given the quaternion q3 = (0.2191769, (0.4288243, 0.6384718, 0.6003541)). Convert it into a rotation matrix.
First we have to check that the given quaternion is a unit quaternion for the
reasons explained in Problem 1.

N (q3 ) =

p
0.21917692 + 0.42882432 + 0.63847182 + 0.60035412 1

Once this is verified, the correspondent equivalent rotational matrix R of the


quaternion q3 = qo + ~q = qo + q1 i + q2 j + q3 k can be found to be:
2
qo + q12 q22 q32
R = 2q1 q2 + 2qo q3
2q1 q3 2qo q2

2q1 q2 2qo q3
qo2 q12 + q22 q32
2q2 q3 2qo q1

2q1 q3 + 2qo q2
2q2 q3 2qo q1
qo2 q12 q22 + q32

Replacing the components of q3 by their numerical values, we obtained the


following rotation matrix:

0.536072517511710
R = 0.810704947346780
0.235040335434660

0.284369945185620
0.088700546274690
0.954529288356740

0.794745371303860
0.578575765482060
0.183002987279070

4 Problem
Find out how to convert a rotation matrix into a quaternion. Then, use the
quaternion multiplication to rotate the following two homogeneous coordinate
matrices by an angle of 30 degrees around the y-axis and express the resulting
frame as a quaternion/point-pair (i.e., quaternion for the orientation plus the
related 3D point of the origin of the frame):

0.866 0.433 0.250 0


0
0.5
0.866 0

H1 =
0.5 0.75 0.433 0
0
0
0
1

0.866 0.433 0.250 2


0
0.5
0.866 4

H2 =
0.5 0.75 0.433 1
0
0
0
1
First we have to derive the quaternion q4 with rotation vector j (the basis
vector associated with the y axis) for it to perform a rotation of /6 or 30.
According to what we explained in Problem 1 and considering that quaternions

3
perform a rotation twice as large as the angles associated with them, we choose
= (/6)/2 = /12 and write the quaternion q4 in the form
q4 = cos + j sin = 0.9659 + 0.2588 j
Then, it is necessary to consider the general form of a homogeneous matrix.

R1,1 R1,2 R1,3 t1


R2,1 R2,2 R2,3 t2

H=
R3,1 R3,2 R3,3 t3
0
0
0
1
The elements in the first 3 columns and rows in the homogeneous matrix
represent a rotation transformation. So we want to convert this 3 3 matrix R
into a quaternion to apply quaternion multiplication with q4 . To convert from
a rotation matrix to a quaternion a code in Matlab was generated based on [1],
the code is sent as another attachment.
Solution for H1 :
First we transform the rotation matrix from the homogeneous matrix into a
quaternion qH1

0.866 0.433 0.250


0.5
0.866 0.483 + 0.836i 0.129j 0.224k = qH1
R1 = 0
0.5 0.75 0.433
Then we multiply qH1 by q4 to rotate the homogeneous matrix H1 . If we
define qH1 = so + ~s and q4 = po + p~, the quaternion product is
qH1 q4 = so qo ~s p~ + so p~ + po~s + ~s p~
so qo = (0.483)(0.9659) = 0.466
~s p~ = (0.836)(0) + (0.129)(0.2588) + (0.224)(0) = 0.0333
so p~ = (0.483)(0.2588)j = 0.124224j
po~s = (0.9659)(0.836i 0.129j
0.224k) = 0.8075i
0.1246j 0.2164k
i

j
k



~s p~ = 0.836 0.129 0.224
0
0.2588
0
= (0.224 0.2588)i + (0.836 0.2588)k
~s p~ = 0.05797i + 0.21635k
Agrouping terms,
qH1 q4 = (0.466 + 0.0333) + (0.8075 + 0.05797)i+
(0.124224 0.1246)j + (0.2164 + 0.21635)k
qH1 q4 = 0.433 + 0.866i 0.25j + 0k

4
Finally we can express the resulting frame as follows. Since in this case no
translation has been done (the first 3 elements of H1 last column are zeros), the
3D point of the origin of the frame is (0,0,0).
F1 0.433 + 0.866i 0.25j/(0, 0, 0)
Solution for H2 :
It can be observed that the rotation transformation in this homogeneous
matrix is the same as H1 , and it will rotated 30 degrees as well. Thus, the
quaternion to represent the resultant frame will be the same as the one obtained
for H1 .
However, H2 indicates that there has been also a translation transformation.
The origin of the frame has been translated by the vector t = (2, 4, 1)T ; so the
3D point of the frames origin will be (2,-4,1). The resulting frame is
F2 0.433 + 0.866i 0.25j/(2, 4, 1)

5 Problem
Given the homogeneous matrices A, B and C. Suppose that B and C are known
and that
AB =C
What is the easiest way, i.e., takes least computations, to determine A by
exploiting the fact that the three matrices are homogeneous?
The easiest way to determine A would be to multiply both sides of the equation by the inverse of matrix B as follows
AB =C
A B B 1 = C B 1
A I = C B 1
A = C B 1
This will be the easiest method because a homogeneous matrix is formed
by a rotational matrix whose inverse is its transpose. This inverse rotation
will be applied to rotate back the frame and the vector used to translate it.
Hence, just the matrix multiplication between the inverse rotation matrix and
the translation vector is needed. The rest is only a rearrangement of elements.

5
An example of a homogeneous matrix H and its inverse H 1 is given below.


 T

R t
R
RT t
1
H=
H =
0 1
0
1
Where R is the rotation matrix, t is the column vector indicating the translation transformation and 0 is the row vector with all elements equal to zero
and same number of elements as columns in the rotation matrix R.

6 Problem
Use the insight from above to determine A in
AB =C
with

0.866 0.433 0.250 2


0
0.5
0.866 4

B=
0.5 0.75 0.433 1
0
0
0
1

0.5
0.433 0.75 5
0
0.866
0.5
3

C=
0.866 0.25 0.433 0
0
0
0
1
As stated in Problem 5, we have to obtained the inverse of matrix B. So,
first we derived the inverse of the rotation matrix associated with B.

0.866 0.433
0.5
RB = 0
0.5 0.75

0.250
0.866
0.866 RB 1 = RB T = 0.433
0.433
0.250

0
0.5
0.866

0.5
0.75
0.433

Then we have to obtained the new translation vector t0 = RB T t according


to the inverse of a homogeneous matrix shown in the previous problem.

0.866
0
t0 = RB T t = 0.433 0.5
0.250 0.866

0.5
2
1.2320
0.75 4 = 0.3840
0.433
1
4.3970

If we concatenate RB T and t0 , we obtained the inverse B 1 .

B 1

 T
RB
=
0

0.866
0.433
RB T t
=
0.250
1
0


0
0.5
0.866
0

0.5
0.75
0.433
0

1.2320
0.3840

4.3970
1

6
Finally, we multiply C by B 1 to obtain the homogeneous matrix A.

0.5
0

0.866
0

1
A = C
B =

0.866
0
0.5 1.2320
0.433 0.75 5

0.866
0.5
3
0.433 0.5 0.75 0.3840

0.250 0.866 0.433 4.3970


0.25 0.433 0
0
0
0
1
0
0
1

0.8080
0.2500
A=
0.5335
0

0.4330 0.3995
0.8660 0.4330
0.2500 0.8080
0
0

1.2525
5.5310

0.7410
1

Bibliography
[1] Funda, J.; Taylor, R.H.; Paul, R.P., On homogeneous transforms, quaternions, and computational efficiency, Robotics and Automation, IEEE
Transactions on , vol.6, no.3, pp.382,388, Jun 1990

You might also like