3D Kinematics Consists of two parts

Slides:



Advertisements
Similar presentations
Lecture 3: orientation Computer Animation.
Advertisements

Links and Joints.
John C. Hart CS 318 Interactive Computer Graphics
UBI 516 Advanced Computer Graphics
3D Graphics for Game Programming (J. Han) Chapter XI Character Animation.
3D Kinematics Eric Whitman 1/24/2010. Rigid Body State: 2D p.
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
Orientation & Quaternions
Computer Graphics Recitation 2. 2 The plan today Learn about rotations in 2D and 3D. Representing rotations by quaternions.
Ch. 2: Rigid Body Motions and Homogeneous Transforms
3D Coordinate Systems and Transformations Revision 1
3-D Geometry.
3D orientation.
CSCE 689: Computer Animation Rotation Representation and Interpolation
CSCE 441: Computer Graphics Rotation Representation and Interpolation
Quaternions CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004.
CSCE 641: Computer Graphics Rotation Representation and Interpolation Jinxiang Chai.
Rotation representation and Interpolation
Orientations Goal: –Convenient representation of orientation of objects & characters in a scene Applications to: – inverse kinematics –rigid body simulation.
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Technical Background.
CS 445 / 645 Introduction to Computer Graphics Lecture 21 Representing Rotations Lecture 21 Representing Rotations.
An Introduction to Robot Kinematics
More details and examples on robot arms and kinematics
CS 450: COMPUTER GRAPHICS 3D TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
Computer Vision Group Prof. Daniel Cremers Autonomous Navigation for Flying Robots Lecture 3.1: 3D Geometry Jürgen Sturm Technische Universität München.
Advanced Graphics (and Animation) Spring 2002
1 Kinematics ( 運動學 ) Primer Jyun-Ming Chen Fall 2009.
Rotations and Translations
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Game Physics – Part IV Moving to 3D
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
1 February 24 Matrices 3.2 Matrices; Row reduction Standard form of a set of linear equations: Chapter 3 Linear Algebra Matrix of coefficients: Augmented.
3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)
Mathematical Topics Review of some concepts:  trigonometry  aliasing  coordinate systems  homogeneous coordinates  matrices, quaternions.
CS 450: COMPUTER GRAPHICS QUATERNIONS SPRING 2015 DR. MICHAEL J. REALE.
Kinematics of Robot Manipulator
Computer Graphics Bing-Yu Chen National Taiwan University.
Mathematical Foundations Sections A-1 to A-5 Some of the material in these slides may have been adapted from university of Virginia, MIT and Åbo Akademi.
Chapter 2 Robot Kinematics: Position Analysis
Rotations and Translations
Advanced Computer Graphics Spring 2014
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Rotations and Quaternions Week 9, Wed 29 Oct 2003.
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
Chapter 2 Rigid Motions and Coordinate Transformations
Kinematics Primer Jyun-Ming Chen. Contents General Properties of Transform 2D and 3D Rigid Body Transforms Representation Computation Conversion … Transforms.
Animating Rotations and Using Quaternions. What We’ll Talk About Animating Translation Animating 2D Rotation Euler Angle representation 3D Angle problems.
Matthew Christian. About Me Introduction to Linear Algebra Vectors Matrices Quaternions Links.
CS 551/645 Fall 2000 Parameterized Rotations, Curves, and Surfaces.
What is Kinematics. Kinematics studies the motion of bodies.
CS 551 / 645: Introductory Computer Graphics Mathematical Foundations.
CS 551/651 Advanced Graphics Technical Background.
Quaternion 靜宜大學資工系 蔡奇偉副教授 大綱  History of Quaternions  Definition of Quaternion  Operations  Unit Quaternion  Operation Rules  Quaternion Transforms.
Euler Angles This means, that we can represent an orientation with 3 numbers Assuming we limit ourselves to 3 rotations without successive rotations about.
Week 5 - Monday.  What did we talk about last time?  Lines and planes  Trigonometry  Transforms  Affine transforms  Rotation  Scaling  Shearing.
Learning from the Past, Looking to the Future James R. (Jim) Beaty, PhD - NASA Langley Research Center Vehicle Analysis Branch, Systems Analysis & Concepts.
Fundamentals of Computer Animation Orientation and Rotation.
Graphics Graphics Korea University kucg.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실.
REFERENCE: QUATERNIONS/ Ogre Transformations.
CA 302 Computer Graphics and Visual Programming
Transformations Review 4/18/2018 ©Babu 2009.
Computer Animation Algorithms and Techniques
CPSC 641: Computer Graphics Rotation Representation and Interpolation
CS 445 / 645 Introduction to Computer Graphics
3D Kinematics Consists of two parts
UMBC Graphics for Games
A definition we will encounter: Groups
VIRTUAL ENVIRONMENT.
UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN
Game Programming Algorithms and Techniques
Presentation transcript:

3D Kinematics Consists of two parts 3D rotation 3D translation The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z-axis) Next, we will discuss the treatment for spatial (3D) rotation

3D Rotation Representations Euler angles Axis-angle 3X3 rotation matrix Unit quaternion Learning Objectives Representation (uniqueness) Perform rotation Composition Interpolation Conversion among representations …

Euler Angles and GIMBAL LOCK Roll, pitch, yaw Gimbal lock: reduced DOF due to overlapping axes Ref: http://www.fho-emden.de/~hoffmann/gimbal09082002.pdf

Axis-Angle Representation

Axis-Angle Representation Rot(n,q) n: rotation axis (global) q: rotation angle (rad. or deg.) follow right-handed rule Rot(n,q)=Rot (-n,-q) Problem with null rotation: rot(n,0), any n Perform rotation Rodrigues formula Interpolation/Composition: poor Rot(n2,q2)Rot(n1,q1) =?= Rot(n3,q3) We create matrix R for rotation

Quaternions

Quaternion - Brief History Invented in 1843 by Irish mathematician Sir William Rowan Hamilton Founded when attempting to extend complex numbers to the 3rd dimension Discovered on October 16 in the form of the equation: From: http://en.wikipedia.org/wiki/Quaternion

Quaternion – Brief History William Rowan Hamilton

Quaternion Definition i j k

Applications of Quaternions Used to represent rotations and orientations of objects in three-dimensional space in: Computer graphics Control theory Signal processing Attitude controls Physics Orbital mechanics Quantum Computing, quantum circuit design From: http://en.wikipedia.org/wiki/Quaternion

Advantages of Quaternions Avoids Gimbal Lock Faster multiplication algorithms to combine successive rotations than using rotation matrices Easier to normalize than rotation matrices Interpolation Mathematically stable – suitable for statistics

Operators on Quaternions Addition Multiplication Conjugate Length

Unit Quaternion Define unit quaternion as follows to represent rotation Example Rot(z,90°) q and –q represent the same rotation Why “unit”? DOF point of view!

Quaternion – scalar and vector parts q = w + xi + yj + zk w, x, y, z are real numbers w is scalar part x, y, z are vector parts Thus it can also be represented as: q = (w, v(x,y,z)) or q = w + v

Quaternion – Dimension and Transformation Scalar & Vector 4 dimensions of a quaternion: 3-dimensional space (vector) Angle of rotation (scalar) Quaternion can be transformed to other geometric algorithm: Rotation matrix ↔ quaternion Rotation axis and angle ↔ quaternion Spherical rotation angles ↔ quaternion Euler rotation angles ↔ quaternion What are relations of quaternions to other topics in kinematics?

Details of Quaternion Operations

Quaternion Operations Addition/subtraction Multiplication Division Conjugate Magnitude Normalization Transformations Concatenation

Quaternion Operations Addition: Given two quaternions: q1 = q1w + q1xi + q1yj + q1zk q2 = q2w + q2xi + q2yj + q2zk The result quaternion q3 is: q3 = q1 + q2 q3 = (q1w + q2w) + (q1x + q2x)i + (q1y + q2y)j + (q1z + q2z)k

Quaternion Operations Subtraction: Given two quaternions: q1 = q1w + q1xi + q1yj + q1zk q2 = q2w + q2xi + q2yj + q2zk The result quaternion q3 is: q3 = q1 - q2 q3 = (q1w – q2w) + (q1x – q2x)i + (q1y – q2y)j + (q1z – q2z)k

Quaternion Operations Multiplication Distributive Associative Not commutative because of the i2 =j2=k2=-1 i i (-i) (-j) k j (-k) k j

Quaternion Operations Multiplication Given two quaternions: q1 = q1w + q1xi + q1yj + q1zk q2 = q2w + q2xi + q2yj + q2zk The result quaternion q3 is: q3 = q1 * q2 q3 = q1w*q2w + q1w*q2xi + q1w*q2yj + q1w*q2zk + q1xi*q2w + q1xi*q2xi – q1x*q2x + etc…

Quaternion Operations Multiplication Resulting quaternion q3 is: q3= (q1wq2w + q1xq2x + q1yq2y + q1zq2z) + (q1wq2x + q1xq2w + q1yq2z – q1zq2y)i + (q1wq2y + q1yq2w + q1zq2x – q1xq2z)j + (q1wq2z + q1zq2w + q1xq2y – q1yq2x)k

Quaternion Operations Multiplication Or, in scalar-vector format: q3= q1q2 = (q1w, v1)(q2w, v2) = (q1wq2w - v1.v2, q1wv2 + q2v1 + v1 x v2) or q3 = q1wq2w - v1.v2 + q1wv2 + q2v1 + v1 x v2 scalar vector Dot product Cross product

Quaternion Operations Magnitude Also called modulus Is the length of the quaternion from the origin Given a quaternion: q = w + xi+ yj + zk The magnitude of quaternion q is |q|, where:

Quaternion Operations Normalization Normalization results in a unit quaternion where: w2 + x2 + y2 + z2 = 1 Given a quaternion: q = w + xi+ yj + zk To normalize quaternion q, divide it by its magnitude (|q|): Also referred to as quaternion sign: sgn(q)

Quaternion Operations Conjugate: Given a quaternion: q = w + xi+ yj + zk The conjugate of quaternion q is q*, where: q* = w – xi – yj – zk

Quaternion Operations Inverse Can be used for division Given a quaternion: q = w + xi+ yj + zk The inverse of quaternion q is q-1, where:

Quaternion Rotations

Matrix Rotation Matrix Rotation is based on 3 rotations: On axes: x, y, z Or yaw, pitch, roll (which one corresponds to which axis, depends on the orientation to the axes) Sequence matters (x-y may not equal y-x) x y z

Matrix Rotation x y z

Quaternion Rotation w = cos(θ/2) v = sin(θ/2)û Parts of quaternion v(x,y,z) w w = cos(θ/2) v = sin(θ/2)û Where û is a unit/normalized vector u (i, j, k) Quaternion can be represented as: q=cos(θ/2)+sin(θ/2)(xi+yj+zk) or q=cos(θ/2)+sin(θ/2) û Matrix rotation versus quaternion rotation

Let’s do rotation! x y z

Let’s do rotation! x y z b a c b a c b a c

Let’s do another one! x y z

Quaternion? w Can create rotation by using arbitrary axis (v(x,y,z)) and rotate the object by w amount. v(x,y,z)

Rotation of a Quaternion v(x,y,z) w Calculation is still done in matrix form Given a quaternion: q = w + xi+ yj + zk The matrix form of quaternion q is: Matrix entries are taken all from quaternion

Quaternion Rotation When it is a unit quaternion: w v(x,y,z) Quaternion matrix for unit quaternion: w=1

Example of unit quaternion Our notation: quaternion Rotation of vector v is v’ Where v is: v=ai+bj+ck By quaternion q=(w,u) Where w = 1 Vector (axis): u = i + j + k Rotation angle: 120° = (2π)/3 radian (θ) Length of u =√3 If we rotate a vector, the result should be a vector.

Example of quaternion rotation (cont’d) So to rotate v: v’ = q v q* Where q* is conjugate of q: So now we can substitute q v q* to matrix form of quaternion

Example of quaternion rotation (cont’d) Example (cont’d) Quaternion matrix

Gimbal Lock …until this It happens when you axis … turn this axis far enough… …aligns with this axis.

Gimbal Lock Gimbal lock occurs when rotated -90° or 90° on y-axis Remember that:  = rotation on x-axis  = rotation on y-axis  = rotation on z-axis

Example 1 of using quaternions in robotics: quaternion representing a rotation Rot(z,90°) x y z x y z Rot (90, 0,0,1) OR Rot (-90,0,0,-1)

Example of using quaternions in robotics How to represent rotation? Rot(z,90°) x y z x y Represented as quaternion z Represented as matrix Rot (90, 0,0,1) OR Rot (-90,0,0,-1)

Operations on Unit Quaternions Perform Rotation Composition of rotations Interpolation Linear Spherical linear (more later)

Example of rotation using unit quaternions y,x’ z,z’ y’ For comparison we first use matrices p(2,1,1) Rot(z,90°)

Example (cont) For comparison we use quaternions Next we convert to matrices We get the same result

New Example: multiplication of quaternions y,x’ z,z’ y’ y x,x’ z,y’ z’

Example: Conversion of quaternion matrix to rotation matrix R Matrix R represented with quaternions We substitute values of q And we get R

Matrix Conversion Formulas Relations between qi and rij Find largest qi2; solve the rest

Rodrigues Formula v’=R v r v a v’ References: http://mesh.caltech.edu/ee148/notes/rotations.pdf http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/as5/rotation.html

Rotation Matrix Meaning of three columns Perform rotation: linear algebra Composition: trivial orthogonalization might be required due to floating point errors Interpolation: ?

Gram-Schmidt Orthogonalization If 3x3 rotation matrix no longer orthonormal, metric properties might change! Verify!

Spatial Displacement Any displacement can be decomposed into a rotation followed by a translation Matrix Quaternion

Spherical Linear Interpolation

Interpolation Interpolation produces an arc instead of a line

Spherical Linear Interpolation q r quaternion unit sphere in R4 The computed rotation quaternion rotates about a fixed axis at constant speed References: http://www.gamedev.net/reference/articles/article1095.asp http://www.diku.dk/research-groups/image/teaching/Studentprojects/Quaternion/ http://www.sjbrown.co.uk/quaternions.html http://www.theory.org/software/qfa/writeup/node12.html

Spherical Linear Interpolation – Slerp for unit-length quaternions q0 and q1 are unit-length quaternions θ = angle between q0 and q1 t is interval [0, 1] “if q0 and q1 are the same quaternion, then θ = 0, but in this case, q(t) = q0 for all t.”

Spherical Linear Interpolation - Slerp if q1 = -q0 then θ = π use a third quaternion p perpendicular to q0 (which could be infinite number of vectors) interpolation is done from q0 to p for and from p to q1 for

Spherical Linear Interpolation - Slerp Used in joint animation by storing starting and ending joint position as quaternions. Allows smooth rotations in keyframe animations. “Spherical Linear interpolation supports the animation of joints when starting and ending joint positions are stored as quaternions that represent the joint rotations from canonical positions” – Rob Saunders, Advanced Games Design, Theory and Practice, March 2005, City University London

The concept of canonical (or conjugate) variables is of major importance. They always occur in complementary pairs, such as spatial location x and linear momentum p, angle φ and angular momentum L, and energy E and time t. They can be defined as any coordinates whose Poisson brackets give a Kronecker delta (or a Dirac delta incase of discrete variables).

Quaternion in Multi-Sensor Robot Navigation System (by S. Persa, P Quaternion in Multi-Sensor Robot Navigation System (by S. Persa, P. Jonker, Technical University Delft, Netherlands) Used quaternions

Dimensional Synthesis of Spatial RR Robots (A. Perez, J. M Dimensional Synthesis of Spatial RR Robots (A. Perez, J.M. McCarthy, University of California, Irvine) Finish* Start* *assumption

Let’s do rotation! x y z b a c b a c b a c

Visualization of quaternions Difficult to visualize Not for the weak-on-math

Visualizing Quaternion Rotation Removing 720 degree twist without moving either end (from: J.C. Hart, G.K. Francis, L.H. Kauffman, Visualizing Quaternion Rotation, ACM Transactions on Graphics, Vol. 13, No. 3 July 1994, p.267)

By Mathias Sunardi for Quantum Research Group Seminar June 15, 2006 Quaternion Explained! By Mathias Sunardi for Quantum Research Group Seminar June 15, 2006