ROBOTICS AND AUTOMATION
ME-465
LEC 3
Dr. Sara Ali
Todays Objectives
Revision (2D projections and finding transformation
matrix)
New:
Mapping – 3 different types
Operators
Working in 3D
Quiz
Mapping: Changing description from frame to frame
Involving translated frames:
Centers of rotation
plotvol([-5 4 -1 5]); *we first apply an origin shift, a
T0 = eye(3,3); translation from C to the origin of the
trplot2(T0, 'frame', '0'); reference frame, apply the rotation
X = transl2(2, 3); about that origin, and then apply the
trplot2(X, 'frame', 'X'); inverse origin shift, a translation from
the reference frame origin back to C.
R = trot2(2); A more better way to do this is
trplot2(R*X, 'framelabel', 'RX', 'color', through twists.
'r');
trplot2(X*R, 'framelabel', 'XR', 'color', We see that the frame
'r'); {RX}
has been rotated about
C = [1 2]'; the origin, while frame
plot_point(C, 'label', ' C', 'solid', 'ko') {XR} has been rotated
about the origin of {X}.
%creating a transformation matrix for How do we rotate
rotation about point C a coordinate
frame about an
RC = transl2(C) * R * transl2(-C) arbitrary point?
Twists
given any two frames we can find a rotational center
that will rotate the first frame into the second
In case of pure translation ……..
Rotational twist around a point C
• R stands for rotational. The twist object
C = [1 2]'; comprises of a 2-vector moment and a 1-vector
tw = Twist('R', C) rotation
• Unit twist since magnitude of rotation = 1
% to create transformation for a
rotation about this unit twist by 2
radians
tw.T(2)
%to get center of rotation also
known as pole
Twists
For an arbitrary planar transform
T = transl2(2, 3) * trot2(0.5)
% we can compute twist as
tw = Twist(T)
tw.T
Working in 3D
Working in 3D
Description of frame {B} wrt
frame {A} ?
We consider an arbitrary point P
wrt to each of the coordinate
frames and determine the
relationship between AP and BP to
obtain translation and
orientation0.
Translation is easy whereas
orientation for 3D is difficult
Orientation in 3D
Euler’s rotation theorem states that any rotation can be considered as a
sequence of rotations about different coordinate axes.
We start by considering rotation about a single coordinate axis.
Orientation in 3D
Non-
Commutative
Orientation and Pose estimation is
not simple. Slight variation results in
posture change
Orientation in 3D
• Mathematicians have developed many ways
to represent rotation: orthonormal rotation
matrices, Euler and Cardan angles, rotation
axis and angle, exponential coordinates, and
unit quaternions.
• All can be represented as vectors or matrices
Orthonormal Rotation Matrix
we can represent the orientation of a
coordinate frame by its unit vectors
expressed in terms of the reference
coordinate frame. Each unit vector has three
elements and they form the columns of a 3 ×
3 orthonormal matrix ARB
which transforms the description of a vector
defined with respect to frame {B} to a
vector with respect to {A}.
Orthonormal Rotation Matrix
Orthonormal Rotation Matrix
Orthonormal rotational matrices
Orthonormal Rotation Matrix in Toolbox
syms theta
Rx = rotx(theta)
Ry = roty(theta)
Rz = rotz(theta)
Rx = rotx(pi/2)
trplot(Rx)
tranimate(Rx)
Rxy = rotx(pi/2) *
roty(pi/2)
tranimate(Rxy)
Three-Angle Representations
We recall that Euler’s rotation theorem states that any rotation
can be represented by not more than three rotations about
coordinate axes. This means that in general an
arbitrary rotation between frames can be decomposed into a
sequence of three rotation angles and associated rotation axes
Euler’s rotation theorem requires successive rotation about three
axes such that no two successive rotations are about the same
axis. There are two classes of rotation sequence: Eulerian and
Cardanian, named after Euler and Cardano respectively
Euler: XYX, XZX, YXY, YZY, ZXZ, or ZYZ
Cardanian: XYZ, XZY, YZX, YXZ, ZXY, or ZYX
Three-Angle Representations
Euler-Angles: Most common sequence: ZYZ
R = rotz(0.1) * roty(0.2) * rotz(0.3);
R = eul2r(0.1, 0.2, 0.3)
%rotation to euler
gamma = tr2eul(R)
%problem if theta is negative, different angles are returned but same
rotation matrix
R = eul2r(0.1 , -0.2, 0.3)
tr2eul(R)
% problematic since mapping from a rotation matrix to Euler angles
is not unique and the Toolbox always returns a positive angle for θ
Three-Angle Representations
Cardan Angles: roll-pitch-yaw sequence as ZYX or XYZ
depending on of it is a mobile robot or a robotic arm.
Convention for vehicles (ships, aircraft and cars): x-axis points
in the forward direction and z-axis points either up or down.
It is intuitive to apply the rotations in following sequence (ZYX
angle sequence):
1. yaw (direction of travel)
2. pitch (elevation of the front with respect to horizontal) and
3. roll (rotation about the forward axis of the vehicle)
tripleangle
Three-Angle Representations
Convention for robot gripper: the z-axis points forward
and the x-axis is either up or down. This leads to the
XYZ angle sequence
The Toolbox defaults to the ZYX sequence but can be
overridden using the 'xyz‘ option
R = rpy2r(0.1, 0.2, 0.3)
%inverse
gamma= tr2rpy(R)
Three-Angle Representations
Limitation: Singularity/Gimbal Lock - when the
rotational axis of the middle term in the sequence
becomes parallel to the rotation axis of the first or third
term.
Gimbal Lock
Consider the situation
when the rotation angle of
the middle gimbal
(rotation about
the z-axis) is 90° – the
axes of the inner and
outer gimbals are aligned
and they share the same
rotation axis. Instead of
the original three
rotational axes, since two
are parallel, there are now
only two effective
rotational axes – we say
that one degree of
freedom has been lost.
[Link]
atch?v=zc8b2Jo7mno
Gimbal Lock
The loss of a degree of freedom means that mathematically we
cannot invert the transformation
All three-angle representations of attitude, whether Eulerian or
Cardanian, suffer this problem of gimbal lock when two consecutive
axes become aligned. For ZYZ Euler angles this occurs when θ = kπ, k
∈ Z and for roll-pitch-yaw angles when pitch θp = ±(2k + 1) π/2. The
best that can be hoped for is that the singularity occurs for an
attitude which does not occur during normal operation of the vehicle –
it requires judicious choice of angle sequence and coordinate system.
Singularities are an unfortunate consequence of using a minimal
representation. To eliminate this problem we need to adopt different
representations of orientation.
Two Vector Representation
For arm-type robots it is useful to consider a coordinate
frame {E} attached to the end-effector
Two Vector Representation
By convention the axis of the tool is associated with the
z-axis and is called the approach vector and denoted
z-axis is insufficient to describe the coordinate frame –
we also need to specify the direction of the x- and y-
axes. An orthogonal vector that provides orientation,
perhaps between the two fingers of the robot’s gripper
is called the orientation vector
Two Vector Representation
The two unit vectors are sufficient to completely define
the rotation matrix
Example: gripper’s approach and orientation vectors
are parallel to the world x- and y-directions respectively
a = [1 0 0]'; oa2r - Convert
o = [0 1 0]'; orientation and
R = oa2r(o, a) approach vectors
to rotation matrix
Two Vector Representation
Any two nonparallel vectors are sufficient to define a
coordinate frame. Even if the two vectors â and ô are
not orthogonal they still define a plane and the
computed n is normal to that plane. In this case we
need to compute a new value for ô′ = â × n which lies
in the plane but is orthogonal to each of â and n.
Rotation about an arbitrary vector
Two coordinate frames of arbitrary orientation are
related by a single rotation about some axis in space
R = rpy2r(0.1 , 0.2, 0.3); % roll-pitch-yaw to rotation matrix
% we can determine such an angle and vector by
[theta, v] = tr2angvec(R) % Convert rotation matrix to angle-vector
form
% where theta is the angle of rotation and v is the vector around which
the rotation occurs
Quaternion
Another representation of orientation is by means of four
numbers called the Euler parameters. Sometimes, the
Euler parameters are viewed as a 3 x 1 vector plus a
scalar. However, as a 4 x 1 vector, the Euler parameters
are known as a unit quaternion.
In terms of equivalent axis K=[Kx Ky Kz]T and equivalent
angle theta
Quaternion
The rotation matrix R€ that is equivalent to a set of Euler
parameters is
Given a rotation matrix, the equivalent Euler
parameters are
Quaternion in Toolbox
Denoted
as
%converts rotation matrix to a unit
quaternion
q = UnitQuaternion( rpy2tr(0.1, 0.2,
0.3) )
%convert quaternion to rotation
matrix
q.R
Pose in 3D
Similar to 2D case
Transformation of frame {B} wrt frame {A}
If points are represented by homogeneous coordinate
vectors
Pose in 3D in Toolbox
T = transl(1, 0, 0) * trotx(pi/2) *
transl(0, 1, 0)
We can think of this expression as representing a walk along the x-axis
for 1 unit, then a rotation by 90° about the x-axis and then a walk of 1
unit along the new y-axis which was the previous z-axis.
trplot(T)
t2r(T)
transl(T)’
SUMMARY
We are now in a position to describe the position and orientation of a manipulator in space