Carnegie Mellon An Introduction to Robot Kinematics Howie Choset Hannah Lyness © Howie Choset, 2019 Carnegie Mellon Robot kinematics refers to the geometry and movement of robotic mechanisms Prof Michael Kaess 16-665: Robot Mobility In Air, Land, and Sea. Underwater Robotics Lecture 2 Slide 31. Used with permission. Carnegie Mellon A select history of robotics Elmer, 1948 Unimate, 1959 CyberKnife, 1991 Asimo, 2000 Big Dog, 2005 Shakey, 1966 Baxter, 2011 Wabot 2, 1980 Kuka KR AGILUS, 2014 https://en.wikipedia.org/wiki/Shakey_the_robot#/media/File:SRI_Shakey_with_callouts.jpg, http://roamerrobot.tumblr.com/post/23079345849/the-history-ofturtle-robots, https://www.robotics.org/joseph-engelberger/unimate.cfm, https://en.wikipedia.org/wiki/BigDog, https://www.techexplorist.com/wpcontent/uploads/2016/03/Baxter_Robot-696x470.jpg Carnegie Mellon Goals - Use robotics kinematics terms to explain real world situations. - Express a point in one coordinate frame in a different coordinate frame. - Represent complex translations and rotations using a homogenous transformation matrix. - Determine the position and orientation of an end effector given link and joint information. Carnegie Mellon What does degrees of freedom mean? Carnegie Mellon Degrees of Freedom (DOF): the number of independent parameters that can fully define the configuration Carnegie Mellon How many degrees of freedom does this have? https://www.chamonix.net/english/leisure/sightseeing/mer-de-glace Carnegie Mellon 1 DOF https://www.chamonix.net/english/leisure/sightseeing/mer-de-glace Carnegie Mellon How many degrees of freedom does this have? http://www.andrew.cmu.edu/user/kbrennan/TeamZ-Lab9.html Carnegie Mellon 2 DOF http://www.andrew.cmu.edu/user/kbrennan/TeamZ-Lab9.html Carnegie Mellon How many degrees of freedom does this have? https://pureadvantage.org/news/2016/11/15/underwater-robots/ Carnegie Mellon 6 DOF https://pureadvantage.org/news/2016/11/15/underwater-robots/ Carnegie Mellon How many degrees of freedom does this have? https://www.shopecobambino.com/maple-landmark-starter-train-set.html Carnegie Mellon 1 DOF https://www.shopecobambino.com/maple-landmark-starter-train-set.html Carnegie Mellon How many degrees of freedom does this have? http://hades.mech.northwestern.edu/index.php/File:Human-arm.png Carnegie Mellon 7 DOF http://hades.mech.northwestern.edu/index.php/File:Human-arm.png Carnegie Mellon Definitions Reference Frame: Static coordinate system from which translations and rotations are based Link: Single rigid body Joint: Connection between links Constraints: Limitations on movement http://www.value-design-consulting.co.uk/co-ordinate-systems.html http://www.andrew.cmu.edu/user/kbrennan/TeamZ-Lab9.html Carnegie Mellon Grübler’s Formula to find degrees of freedom Basic Idea: DOF of mechanism = Link DOFs – Joint Constraints Carnegie Mellon Grübler’s Formula to find degrees of freedom 𝑗𝑗 𝑀𝑀 = 6𝑛𝑛 − �(6 − 𝑓𝑓𝑖𝑖 ) 𝑖𝑖=1 M is the degrees of freedom n is the number of moving links j is the number of joints f_i is the degrees of freedom of the ith joint Carnegie Mellon Grübler’s Formula – Simple Open Chain 𝑗𝑗 𝑀𝑀 = � 𝑓𝑓𝑖𝑖 𝑖𝑖=1 M is the degrees of freedom n is the number of moving links j is the number of joints f_i is the degrees of freedom of the ith joint http://hades.mech.northwestern.edu/index.php/File:Human-arm.png Carnegie Mellon Grübler’s Formula – Simple Closed Chain 𝑗𝑗 𝑀𝑀 = � 𝑓𝑓𝑖𝑖 − 𝑑𝑑 𝑖𝑖=1 M is the degrees of freedom n is the number of moving links j is the number of joints f_i is the degrees of freedom of the ith joint d is the dimension, 3 for planar, 6 for spatial http://ocw.upm.es/ingenieria-mecanica/mechanical-devices-forindustry/contenidos/lectura-obligatoria/lesson-1/four-bar-linkages Carnegie Mellon Types of Joints – Lower Pairs Revolute Joint 1 DOF ( Variable - ) Prismatic Joint 1 DOF (linear) (Variables - d) Spherical Joint 3 DOF ( Variables - 1, 2, 3) Carnegie Mellon Types of Joints – Higher Pairs Gears 1 DOF ( Variable - ) Cam and Follower 1 DOF (linear) (Variables - d) https://nptel.ac.in/courses/112103174/module4/lec3/1.html Carnegie Mellon Grübler’s Formula to find degrees of freedom Carnegie Mellon We are interested in two kinematics topics Forward Kinematics (angles to position) Inverse Kinematics (position to angles) What you are given: The length of each link The angle of each joint What you are given: The length of each link The position of some point on the robot What you can find: The position of any point (i.e. it’s (x, y, z) coordinates) What you can find: The angles of each joint needed to obtain that position Carnegie Mellon Forward Kinematics (angles to position) x,y l1 l2 t1 Given l1, l2, t1, t2 l1 l2 Find x, y, tf tf Carnegie Mellon Inverse Kinematics (angles to position) x,y l1 tf t2 l2 l2 Given l1, l2, x, y, tf l1 t1 Find t1, t2 Carnegie Mellon Quick Math Review Vector: A geometric object with magnitude and direction Carnegie Mellon Quick Math Review Vector: A geometric object with magnitude and direction Examples of vector quantities: Velocity, displacement, acceleration, force Carnegie Mellon Quick Math Review Vector Magnitude: Just the vector quantity without direction Examples: Magnitude of velocity is speed, magnitude of displacement is distance, etc. Carnegie Mellon Quick Math Review Unit Vector: Vector with magnitude of 1 Used to indicate direction Carnegie Mellon Quick Math Review Vector: A geometric object with magnitude and direction y x Can be written in matrix form as a column vector Carnegie Mellon Quick Math Review Vector Addition - Sum each component of the vector y Yields a new vector Commutative x Carnegie Mellon Quick Math Review y x Yields a scalar Commutative Carnegie Mellon Quick Math Review Yields a vector perpendicular to both original vectors Not commutative https://en.wikipedia.org/wiki/Cross_product Carnegie Mellon Quick Math Review Matrix Addition - Sum matching elements a b e c d + g f (a + e ) = h (c + g ) Matrices must be of same size Yields a new matrix of the same size Commutative (b + f ) (d + h ) Carnegie Mellon Quick Math Review Matrix Multiplication - Multiply rows and columns and sum products a b e c d ∗ g f (ae + bg ) = h (ce + dg ) (af + bh ) (cf + dh ) Matrices must have the same inner dimension Yields a new matrix of the same size Not commutative Carnegie Mellon We can use vectors to succinctly represent a point with respect to a certain reference frame Y X Carnegie Mellon We will use superscripts to indicate our reference frame Y O X N M L Carnegie Mellon Basic Transformations Representing a point in a different frame: Translation along the x-axis Y O X N Carnegie Mellon Basic Transformations Representing a point in a different frame: Translation along the x-axis Y O X N Carnegie Mellon Basic Transformations Representing a point in a different frame: Translation along the x-axis Y O X Px Px = distance between the XY and NO coordinate planes Notation: N Carnegie Mellon Writing V XY Y in terms of V NO O X Px N Carnegie Mellon Writing V XY Y in terms of V NO O X PX N Carnegie Mellon Basic Transformations Representing a point in a different frame: Translation along the x- and y-axes O Y N X Carnegie Mellon Basic Transformations Representing a point in a different frame: Translation along the x- and y-axes O Y N X Carnegie Mellon Using Basis Vectors Basis vectors are unit vectors that point along a coordinate axis O n o Unit vector along the N-Axis Unit vector along the N-Axis V NO Magnitude of the VNO vector o n V NO N NO V NO cosθ V NO • n V N V cosθ = O = NO = NO = NO V V sinθ V cos(90 − θ) V • o Carnegie Mellon Basic Transformations Representing a point in a different frame: Rotation about z-axis (out of the board) Y V VY VX X = Angle of rotation between the XY and NO coordinate axis Carnegie Mellon Y V VY VX X (Substituting for VNO using the N and O components of the vector) Carnegie Mellon Y V VY VX X (Substituting for VNO using the N and O components of the vector) Carnegie Mellon Basic Transformations Representing a point in a different frame: Rotation about z-axis (out of the board) Y V VY VX X Carnegie Mellon Compound Transformations Representing a point in a different frame: Translation along the x- and y-axes and rotation Y1 (VN,VO) Y0 VNO VXY P X1 Translation along P followed by rotation by θ X0 V XY V X Px cosθ = Y = + V Py sinθ − sinθ V N cosθ V O Carnegie Mellon Compound Transformations Representing a point in a different frame: Translation along the x- and y-axes and rotation Y1 (VN,VO) Y0 VNO VXY P X1 Translation along P followed by rotation by θ X0 V XY V X Px cosθ = Y = + V Py sinθ − sinθ V N cosθ V O (Note : Px, Py are relative to the original coordinate frame. Translation followed by rotation is different than rotation followed by translation.) Carnegie Mellon Relative versus absolute translation Relative: - Can be composed to create homogenous transformation matrix. - Translations are with respect to a frame fixed to the robot or point. Absolute: - Translations are with respect to a fixed world frame. Y0 P X1 X0 Y0 X1 P X0 Carnegie Mellon The Homogeneous Matrix can represent both translation and rotation V XY V X Px cosθ = Y = + V Py sinθ − sinθ V N cosθ V O V X Px cosθ = V Y = Py + sinθ 1 0 0 − sinθ V X cosθ = V Y = sinθ 1 0 cosθ H = sinθ 0 − sinθ cosθ 0 − sinθ cosθ 0 Px Py 1 cosθ 0 0 V N 0 V O 1 1 Px V N Py V O 1 1 What we found by doing a translation and a rotation Padding with 0’s and 1’s Simplifying into a matrix form Homogenous Matrix for a Translation in XY plane, followed by a Rotation around the z-axis Carnegie Mellon Rotation Matrices in 3D cosθ R z = sinθ 0 − sinθ cosθ 0 cosθ R y = 0 − sinθ 1 R x = 0 0 0 cosθ sinθ 0 1 0 0 0 1 sinθ 0 cosθ Rotation around the Z-Axis Rotation around the Y-Axis 0 − sinθ cosθ Rotation around the X-Axis Carnegie Mellon Homogeneous Matrices in 3D H is a 4x4 matrix that can describe a translation, rotation, or both in one matrix O Y N P X A Translation without rotation 1 0 H= 0 0 0 1 0 0 n x n H= y n z 0 ox oy oz 0 0 Px 0 Py 1 Pz 0 1 Z Y O N X Z A Rotation without translation ax ay az 0 0 0 0 1 Could be rotation around z-axis, x-axis, y-axis or a combination of the three. Carnegie Mellon Homogeneous Continued…. V V XY XY V N O V = H A V 1 n x n = y n z 0 The (n,o,a) position of a point relative to the current coordinate frame you are in. ox ax oy oz ay az 0 0 Px V N O Py V Pz V A 1 1 V X = n x V N + o x V O + a x V A + Px The rotation and translation part can be combined into a single homogeneous matrix IF and ONLY IF both are relative to the same coordinate frame. Carnegie Mellon Finding the Homogeneous Matrix W N O W W A P WI J W W K I W N O W W A Point relative to the I-J-K frame W Pi n i J W = Pj + n j W K Pk n k oi oj ok N ai W a j W O a k W A Point relative to the N-O-A frame WI ni J W = n j W K n k 1 0 oi oj ai aj ok 0 ak 0 Pi W N Pj W O Pk W A 1 1 Carnegie Mellon Finding the Homogeneous Matrix W N O W W A Y T P X Z X W Tx i x Y W = Ty + i y W Z Tz i z WI Substituting for W J W K jx jy jz I k x W k y W J k z W k W X i x Y W = i y W Z i z 1 0 jx jy jz 0 kx ky kz 0 W X i x Y W = i y W Z i z 1 0 jx jy jz 0 Tx n i Ty n j Tz n k 1 0 ai aj ak 0 oi oj ok 0 kx ky kz 0 Tx W I Ty W J Tz W K 1 1 Pi W N Pj W O Pk W A 1 1 Carnegie Mellon The Homogeneous Matrix is a concatenation of numerous translations and rotations W N W X O Y W = H W W A W Z 1 1 i x i H= y i z 0 jx jy jz 0 0 1 0 0 0 Tx i x 0 Ty i y 1 Tz i z 0 1 0 jx jy jz 0 kx ky kz 0 0 1 0 0 0 0 1 0 Tx n i Ty n j Tz n k 1 0 oi oj ok 0 ai aj ak 0 Pi Pj Pk 1 Product of the two matrices Notice that H can also be written as: 1 0 H= 0 0 kx ky kz 0 0 1 0 0 0 Pi n i 0 Pj n j 1 Pk n k 0 1 0 oi oj ok 0 ai aj ak 0 0 0 0 1 H = (Translation relative to the XYZ frame) * (Rotation relative to the XYZ frame) * (Translation relative to the IJK frame) * (Rotation relative to the IJK frame) Carnegie Mellon One more variation on finding the homogeneous transformation matrix W N O W W A Y T X P Z H= (Rotate so that the X-axis is aligned with T) * ( Translate along the new t-axis by || T || (magnitude of T)) * ( Rotate so that the t-axis is aligned with P) * ( Translate along the p-axis by || P || (magnitude of P)) * ( Rotate so that the p-axis is aligned with the O-axis) Carnegie Mellon Three-Dimensional Illustration • Rotate X • Translate X • Rotate Z • Translate Z Carnegie Mellon Rotation about X Carnegie Mellon Translation about X Carnegie Mellon Rotation about Z 1 Carnegie Mellon Translation in Z Carnegie Mellon Example Problem 1 Set up: - You have an RR robotic arm with base at the origin. - The first link moves th1 with respect to the x-axis. The second link moves th2 with respect to the first link. Question: - What is the position and orientation of the end effector of the robotic arm? Carnegie Mellon Geometric Approach Carnegie Mellon Algebraic Approach X2 Y2 Y0 X0 Carnegie Mellon Algebraic Approach X2 Y2 Y0 X0 Carnegie Mellon Algebraic Approach X2 Y2 Y0 X0 Carnegie Mellon Example Problem 2 Y3 Set up: U3 Y2 Y0 U2 2 X2 3 - You are have a three-link arm with base at the origin. - Each link has lengths l1, l2, l3, respectively. Each joint has angles θ1, θ2, θ3, respectively. 1 U1 X3 X0 Question: - What is the Homogeneous matrix to get the position of the yellow dot in the X0Y0 frame. Carnegie Mellon Algebraic Approach Y3 U3 Y2 U2 2 X3 3 X2 H = Rz(U 1 ) * Tx1(l1) * Rz(U 2 ) * Tx2(l2) * Rz(U 3 ) Y0 1 U1 X0 i.e. Rotating by 1 will put you in the X1Y1 frame. Translate in the along the X1 axis by l1. Rotating by 2 will put you in the X2Y2 frame. and so on until you are in the X3Y3 frame. The position of the yellow dot relative to the X3Y3 frame is (l1, 0). Multiplying H by that position vector will give you the coordinates of the yellow point relative the the X0Y0 frame. Carnegie Mellon Slight variation on the last solution: Make the yellow dot the origin of a new coordinate X4Y4 frame Y3 Y4 U3 Y2 2 U2 X2 X3 3 X4 H = Rz(U 1 ) * Tx1(l1) * Rz(U 2 ) * Tx2(l2) * Rz(U 3 ) * Tx3(l3) Y0 1 This takes you from the X0Y0 frame to the X4Y4 frame. U1 X0 0 X 0 Y = H 0 Z 1 1 The position of the yellow dot relative to the X4Y4 frame is (0,0). Notice that multiplying by the (0,0,0,1) vector will equal the last column of the H matrix. Carnegie Mellon Next Class: Inverse Kinematics Forward Kinematics (angles to position) Inverse Kinematics (position to angles) What you are given: The length of each link The angle of each joint What you are given: The length of each link The position of some point on the robot What you can find: The position of any point (i.e. it’s (x, y, z) coordinates) What you can find: The angles of each joint needed to obtain that position