We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 12
More On Transformations
Transformations of a frame (object, or point) which are
relative to the fixed reference frame Pre-multiply the transformation matrix with the coordinates described in the moving frame: e.g. for a rotation about the z axis followed by a translation about the x axis, followed by a rotation about the y axis: Transformxyz = Ry · Tx · Rz More On Transformations (cont’d) Transformations of a frame (object, or point) which are relative to the moving reference frame Post-multiply the transformation matrix with the coordinates described in the moving (current) frame: Forward Kinematics vs Inverse Kinematics Forward Kinematics: the calculation of the position and orientation of a robot’s end-effector from its joint coordinates Inverse Kinematics: given a position and orientation of a robot’s end-effector, calculate the angles θ of the joints. Forward Kinematics Forward Kinematics Representation of Configuration Space of a Robot The position and orientation of all links. The pose of the end-effector (i.e. location and orientation) can be described with basic transformation matrices that can be multiplied together to get the homogeneous matrix. HomogeneousMatrix = Transf1 ∗ Transf 2 ∗ Transf 3 ∗ . . . ∗ Transfn where n is the number of links (assuming that each of these matrices is the total transformation for each link). Example of a 1-joint Robot Arm Rotation by angle q1 and then translation by a1. The homogeneous transformation describing the overall result can be calculated using the following: EndEffector = Rot(q1) · Tx (a1) (4) Pose of the End-Effector - 1-Joint 2D Robot Arm (cont’d) In Python Robotics Toolbox: >>> q1 = Symbol('q1') >>> trot2(q1) >>> a1=Symbol('a1') >>> transl2(a1,0) >>> E = trot2(q1) @ transl2(a1, 0) or equivalently as a ETS2 object: >>> e = ET2.R()*ET2.tx(a1) >> e.plot(0) >> e.plot(math.pi/4) The homogeneous transformation describing the overall result can be calculated using the following: EndEffector = Rot(q1) · Tx (a1) · Rot(q2) · Tx (a2) (5) Pose of the End-Effector - 2-Joint 2D Robot Arm (cont’d) In Python Robotics Toolbox: E = simplify(E) Example of a 3-joint Planar Robot Arm The homogeneous transformation describing the overall result can be calculated using the following: EndEffector = Rot(q1)· Tx (a1)· Rot(q2)· Tx (a2)· Rot(q3)· Tx (a3) Pose of the End-Effector - 3-Joint 2D Robot Arm (cont’d) In Python Robotics Toolbox: The Problem of Forward Kinematics The calculation of the position and orientation of a robot’s end-effector from its joint coordinates θi The Denavit-Hartenberg (DH) Notation The relationship between two coordinate frames is described by 6 parameters (3 translations and 3 rotations). Can this be improved? Attach a coordinate frame to the end of each link. Reduces the relationship between 2 coordinate frames from 6 parameters to 4 parameters. Each joint in a robot is described by 4 parameters. How is this achieved? The coordinate frames have constraints. x axis of frame j intersects the z axis of frame j − 1 x axis of frame j is perpendicular to the z axis of frame j − 1 −→ 6 parameters - 2 constraints means 4 parameters are needed. The Denavit-Hartenberg (DH) Notation (cont’d) 4 parameters used associated with each link i and joint i: θi: joint angle di: link offset ri: link length αi: link twist Each homogeneous transformation Ai is represented as the product of 4 basic transformations: The DH Table The DH notation requires a table. The number of rows equals the number of joints and it has 4 columns each one corresponding to the 4 parameters for the joint i of that row. For revolute joints: Only θ changes, all the other 3 parameters are fixed according to the robot mechanism. For prismatic joints: Only d changes, all the other 3 parameters are fixed according to the robot mechanism. Example of DH Notation Finding the Pose of the End-Effector relative to the Base Frame Assume that A1, A2, A3 . . . An are the DH matrices of all the robot joints 1, 2, 3, . . . n. Then the calculation requires the multiplication of all the matrices: Poseend effector = A1 · A2 · A3 . . . An (8) Example: Calculation of the Pose of the End-Effector The following DH matrices correspond to the joints of a robot, from robot base to end-effector. Find the pose of the end-effector relative to the robot base. Example: Calculation of the Pose of the End-Effector (cont’d) Simply calculate A1 ∗ A2 ∗ A3. The problem of Forward kinematics Kinematic chain: a series of rigid bodies (e.g. links of a robotic arm) connected together by joints. The joint angles of a kinematic chain determine the position and orientation of the end effector. A coordinate frame i relative to coordinate frame i − 1 is denoted by i−1Ti The Problem of Forward Kinematics (cont’d) The problem of forward kinematics is expressed as the calculation of the transformation between a coordinate frame fixed in the end-effector and another coordinate frame fixed in the base. For example, for 6-joint manipulator: The Problem of Inverse Kinematics Given a position and orientation of a robot’s end-effector, calculate the angles θ of the joints. Solving the kinematics equations of a manipulator robot is a nonlinear problem. Given the homogeneous matrix of the end-effector with respect to the base frame, solve for all the joint angles θ1, θ2, . . . , θn. Challenging mathematical problem due to: 1. nature of the nonlinear equations. Often no analytic solutions (closed form) can be calculated and numerical methods are required. 2. often, there are multiple solutions (i.e. multiple sets of joint angles) that can place the end effector at the desired position. −→ The algorithm must choose the solution that results in the most natural and efficient motion of the robot. 3. It is possible that no solutions exist Applications of Inverse Kinematics Manufacturing and assembly Surgery Search and rescue Methods for Solving Inverse Kinematics Closed-form methods Iterative methods Closed-form solutions are desirable because they are faster than numerical solutions and identify all possible solutions. They are not general, but robot dependent. To calculate, they take advantage of particular geometric features of specific robot mechanisms. As the number of joints increases, this becomes increasingly difficult. For some serial-link robot manipulators, no analytical (closed form) solution exists! Closed-form Methods Algebraic methods Geometric methods Algebraic Methods for Solving Inverse Kinematics 1. Identify the significant equations containing the joint variables. 2. Manipulate them into a soluble form. A common strategy is reduction to a equation in a single variable, e.g. C1 cos θi + C2 sin θi + C3 = 0 where C1, C2, C3 are constants. Algebraic Methods for Solving Inverse Kinematics (cont’d) Another useful strategy is the reduction to a pair of equations having the form: C1 cos θi + C2 sin θi + C3 = 0 C1 sin θi − C2 cos θi + C4 = 0 only one solution: θi = atan2(−C1C4 − C2C3, C2C4 − C1C3) Geometric Methods for Solving Inverse Kinematics Such methods involve identifying points on the manipulator relative to which position and/or orientation can be expressed as a function of a reduced set of the joint variables using trigonometric relationships. −→ often results to the decomposition of the spatial problem into separate planar problems. Decomposition of the full problem into inverse position kinematics and inverse orientation kinematics. The solution is derived by rewriting equation (2) as: Calculating Analytical Solutions in the Python Robotics Toolbox Consider a 2-joint Planar (2D) Robot Given the position of the end-effector (xE , yE ) calculate the required joint angles to achieve this position. Calculating Analytical Solutions in Python (con’d) >>> a1 = Symbol('a1') >>> a2 = Symbol('a2') >>> q1, q2 = symbols("q1:3") >>> e = ET2.R()*ET2.tx(a1)*ET2.R()*ET2.tx(a2) >>> TE = e.fkine([q1, q2]) >>> x_fk, y_fk = TE.t >>> print(x_fk) >>> print(y_fk) >> x, y = symbols("x, y") >>> eq1 = (x_fk**2 + y_fk**2 - x**2 - y**2).trigsimp() >>> print(eq1) >>> q2_sol = sympy.solve(eq1, q2) >>> print(q2_sol) >>> eq2 = tuple(map(sympy.expand_trig, [x_fk - x, y_fk - y])) >>> print(eq2) >>> q1_sol = sympy.solve(eq2, [sympy.sin(q1), sympy.cos(q1)]) >>> print(q1_sol) Calculating Analytical Solutions in Python (con’d) >>> print(q1_sol[sin(q1)]/q1_sol[cos(q1)]) >>> sympy.atan2(q1_sol[sin(q1)], q1_sol[cos(q1)]).simplify() Iterative (Numerical) Methods for Solving Inverse Kinematics Can be applied to any kinematic robot structure (not robot dependent). Slower In some cases they do not compute all possible solutions Refining the solution through iterations Initial starting point affects the solution time How? Minimise the error between the forward kinematics solution and the desired end-effector pose ξE : (FK(q) − ξE ) Numerical Methods for Solving Inverse Kinematics (cont’d) Various classical numerical methods can be applied, including among others: Newton-Raphson: first order approximation of original equations Levenberg–Marquardt optimisation: using the second order derivative for the approximation of the original system. The Newton-Raphson Algorithm The slope (tangent) of a function f (x) for x = xn is defined (calculated) by the derivative of the function at that point: Calculating Numerical Solutions in Python >>> a1 = 1; a2 = 1 >>> q1, q2 = symbols("q1:3") >>> e = ET2.R()*ET2.tx(a1)*ET2.R()*ET2.tx(a2) >>> des_pos = np.array([0.5, 0.4]) >>> def E(q): >>> return np.linalg.norm(e.fkine(q).t - des_pos) >>> sol = optimize.minimize(E, [0, 0]) >>> print(sol.x) [1.91964289 3.7933814 ] >>> e.fkine(sol.x).printline() Other topics/issues in Robotics 1. Forward Instantaneous Kinematics → Given all members of the kinematic chain and the rates of motion about all joints, find the total velocity of the end-effector. → Usage of the Jacobian matrix J(q) k vN = J(q)q˙ (6) where k vN is the velocity of the end-effector expressed in any frame k 2. Inverse Instantaneous Kinematics → Given the positions of all the members of the kinematic chain and the total velocity of the end-effector, find the rates of the motion of all joints. → Usage of the inverse of the Jacobian matrix q˙ = J −1 (q)vn (7) What is Robot Control? A robot needs to move its joints to achieve tasks A mobile robot moves to different locations The movement of a robot (joints) is done using actuators. In general, everything can be considered as control: Decisions we make affect (control) our future Decision while driving affect (control) the next position and the final location Control theory is a big area used not only in engineering and robotics, but in computer science Can be seen as what is the best next action to take (given a specific state) so as to achieve (optimise) specific objectives! Actuators (Motors) An actuator is a device that causes motion. Linear motion Rotary The output of an actuator can be: Speed Force Types of actuators: Hydraulic (using compressed oil) Pneumatic (using compressed air) Electric (using current) Components of a Robot Joint Control System The dynamic system that is to be controlled is called the plant. Open-loop Control In open-loop (feedforward) control the control action from the controller is independent of the process (dynamic system or plant) output. Example: Control of a boiler using a timer The controller (timer) switches the boiler on or off based on specific times and independent of the temperatures that the boiler has reached There is no feedback from the plant output to the controller on what actual temperature the boiler reached. Closed-loop (Feedback) control Block diagram of closed-loop control system: Error Response How to measure the current error? The desired behaviour (reference input) is compared with the current actual output value of the plant: Example: the desired joint position of a multi-joint robot is θd (t) and the actual joint position is θ(t), then the joint error is: θe = θd (t) − θ(t) (1) Error Response - Characteristics of a Good Controller An ideal controller would drive the error to 0 instantly and keep it 0 forever. In practice, it takes time to reduce the error and a value of 0 might never be achieved. Error Response - Characteristics of a good Controller (cont’d) An error response θe (t) can be described by: A steady-state response: the error as time goes to infinity A transient response → overshoot → settling time A good controller achieves an error response θe (t) with: small or no steady-state error little or no overshoot a short settling time stability: a steady state error is achieved (no oscillations) A Surgical Robot - Impedance Control (Mass-Spring-Damper Example) Simulation of a robot used as a haptic surgical simulator, mimicking the mass, stiffness and damping properties of a virtual surgical instrument in contact with virtual tissue. surgical instrument −→ mass tissue −→ spring The Surgical Robot (cont’d) The dynamics of a 1-degree of freedom robot rendering an impedance is described by: mx¨ + bx˙ + kx = f (2) where: x: is the position m: is the mass (surgical instrument) b: is the damping k: is the stiffness (of the tissue) f : is the force The Surgical Robot (cont’d) To simplify, in the case that the robot force f = 0, the above second order differential equation can be written in the equivalent form of an algebraic equation: ms2 + bs + k = 0 (3) One can solve for s, called the poles of the system The poles define the response (position) of the system as a function of time Simulink Model of the Surgical Robot Experiment with different values... Start with: b = 10, k = 400, m = 2, x0 = 1, v0 = 0. Running the Simulink Model Multi-joint Manipulator Robot Control - Independent Joint Control A common robot control strategy for manipulators: Each joint has its own controller Only a few parameters of the software controller need to be changed The parameters changed are done in a way so that they can control the different size motors attached to each joint. Discrete vs Continuous Dynamic Systems Discrete dynamic systems are described by difference equations. x(n) = 5 ∗ x(n − 1) + 6 ∗ x(n − 2) + 2 Continuous dynamic systems are described by differential equations. x¨ = 5 ∗ x˙ + 10 ∗ x + 10 Linear vs Non-Linear Control Although in practice many robotic systems follow non-linear dynamics: In many cases, a linear model can be developed → It is much easier to develop controllers → It is much easier to analyse mathematically → It is much easier to prove mathematically the stability Not possible to linearise complex dynamic systems! Fascination for mechanical devices such as automata. Complex enough (for that time) to demonstrate some kind of life-like behaviour. Example: Vaucanson’s Digesting Duck (1739) Flap its wings, eat grain and defecate. History and Terminology The word robot comes from the word Robota in Slav languages, first introduced by the Czech playwright Karel Capek in his play Rossum’s Universal Robots (RUR) in 1920. The original word meaning was worker. Robots in many: Science fiction books Movies In the mid twentieth century (1950s), the term cybernetics was used for an exciting science field to understand life and create intelligent machines. The 3 Laws of Robotics — Isaac Asimov 1. A robot may not injure a human being or, through inaction, allow a human being to come to harm. 2. A robot must obey orders given it by human beings except where such orders would conflict with the First Law. 3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Law. Videos on the history of Robots Robots - A 50 year journey video Robots - The journey continues video Robots Today Robotic automation mostly used in Manufacturing (millions of arm-type robots), e.g.: Welding Painting Machine loading/unloading Electronic assembly Packaging Categorising Robots and Definition or according to the operation they perform: Manufacturing Service robots (cleaning, personal care, medical) Field robots (agriculture, mining, construction) Humanoid robots having the form of a human being and perform more than one tasks A robot can be defined as (according to Peter Corke): A goal oriented machine that can sense, plan and act. Characteristics of Robots Consistent Accurate Reliable Do things that people Rigid Bodies and Robotic Manipulators The most common form of an industrial robot is a mechanical manipulator. A mechanical manipulator consists of rigid bodies (called links) connected by joints. The joints are moved by actuators (e.g. electric motors). An end-effector (gripper or hand) is usually attached to a specific link. A rigid body is a solid body which cannot be deformed (or deformations are so small that can be neglected). The distance between any 2 points in a rigid body remains constant even if forces are applied. A Modern Robotic Manipulator The above has 7 degrees of freedom as explained a bit later. Robotic Manipulators and Configuration Space How can we specify the exact position of a Robot (Manipulator)? Configuration Space The answer to How can we specify the exact position of a Robot is: Robot Configuration: a specification of the positions of ALL points of a robot. Robot links are rigid: therefore only a few numbers are required to represent its configuration (position). Configuration Examples How can the configuration of a door be represented? → angle θ about its hinge. How can the configuration of a point on a plane be described? → 2 coordinates (x, y) Configuration Examples (cont’d) How can the configuration of a coin lying on a table be represented? → 2 coordinates (x, y) to specify the position of a fixed point on the coin (e.g. centre) and one coordinate θ to specify the coin’s orientation. Degrees of Freedom of a Body (Robot) The number of degrees of freedom (DOF) of a body (e.g. robot) is the smallest number of real-valued variables needed to represent its configuration. C-space (Configuration space): the n-dimensional space of all possible configurations of a robot Degrees of freedom n is the dimension of the C-space Degrees of Freedom of a Spatial Rigid Body A rigid body in a 3-dimensional space (spatial rigid body ) has 6 degrees of freedom. (x, y, z) coordinates for specifying the position of the centre of mass. 3 angles (θ, ϕ, ψ) specifying the orientation (attitude) of the body. Degrees of Freedom for Robots degrees of freedom = (sum of freedoms of the bodies) − (number of independent constraints) Types of Robot Joints Robot Joints: Degrees of Freedom and Constraints A joint provides freedoms to allow one rigid body to move relative to another Equivalently: a joint provides constraints on the possible motions of 2 rigid bodies it connects. The number of degrees of freedom of a rigid body (3 for planar bodies, 6 for spatial bodies) minus the number of constraints provided by a joint, must equal the number of freedoms provided by that joint. Gr¨ubler’s Formula The number of degrees of freedom of a mechanism (robot) with links and joints can be calculated using Gr¨ubler’s formula which is another expression of equation (1). Consider a mechanism (robot) with: N links (ground is also considered a link) J joints m is the degrees of freedom of a rigid body (m = 3 for planar mechanisms, m = 6 for spatial mechanisms) fi the number of freedoms provided by joint i ci the number of constraints provided by joint i, where fi + ci = m for all joints i. assumes all joints constraints are independent. Derivation of Gr¨ubler’s Formula dof = m · (N − 1) Example of Gr¨ubler’s Formula - Open Chain 3R Serial (3 revolute) Example of Gr¨ubler’s Formula - Closed Chain mechanism Four-Bar Linkage Example of Gr¨ubler’s Formula - Slider-crank mechanism 3 revolute joints and 1 prismatic joint. Coordinate Reference Frames Fixed to the body of the robot (moving) Fixed somewhere in space (stationary) Kinematics The science of motion that treats motion without considering the forces which cause it. Forward Kinematics: Given the angles for the joints, calculate (compute) the position and orientation of the end-effector of a robot manipulator. Kinematics (cont’d) Inverse Kinematics: Given the position and orientation of the end-effector, compute all possible sets of joint angles that can be used to achieve this position and orientation. Robots: Social Issues and Ethics Social Issues: Workers losing their jobs and income Economic consequences Legal rights of robots (as they become more advanced and intelligent) Ethical Issues: Self driving cars: → Choosing to save the driver over pedestrians or other drivers, etc? → Who is to blame, the robot, the software developer, the manufacturer or the owner of the car? Robotic healthcare: who to blame (surgery failure, etc.)? Robots looking after elderly people: is this right as their quality of life is affected by removing human contact? Robots looking after children? Using robots in armies to kill human beings? Pose is the position and orientation of one coordinate frame with respect to another reference coordinate frame. Multiple coordinate frames are used in robotics to facilitate the computations for motion and different types of functionality. NASA is using them to simplify calculations! Pose (cont’d) The robotic hand needs to grasp something located in a specific point in space. The orientation of the hand needs to be described A coordinate frame is attached to the body (hand) The coordinate frame attached to the body needs to be described with respect to a reference coordinate frame (possible the world coordinate frame) Reference Frames in Real World Robots How to Specify Pose Using transformations: Rotation → represents orientation → changes the reference frame in which a vector or frame is represented → rotate a vector or a frame Translation (linear move along one of the axes) Terminology of Coordinate Frames Pose in the 2D Space Rotation: A new coordinate frame {B} with the same origin as {A} but rotated counter-clockwise by angle θ (positive angle) Transforms vectors (their coordinates) from new frame {B} to the old frame {A}: cosθ −sinθ sinθ cosθ Properties of the Rotation Matrix The inverse matrix is the same as the Transpose! R → easy to compute The determinant is 1: det(R) = 1 → the length of a vector is unchanged after the rotation Creating a rotation matrix in the Python Robotics Toolbox >>> R = rot2(math.pi/2) >>> rot2(90, 'deg') Visualising Rotation The orientation represented by a rotation matrix can be visualised as a coordinate frame: R2 = rot2(-math.pi/2) trplot2(R2) Operations for Matrix Rotations The product of two rotation matrices is also a rotation matrix: R2=rot2(-math.pi/2) R=rot2(math.pi/2) R@R2 theta = Symbol('theta') R = Matrix(rot2(theta)) >>> R*R >>> R.det() >>> R.det().simplify() How to Represent Translation Just a vector with 2 elements corresponding to how much we move along the x and y axes. V = vx/vy Assuming P is the position of some object in a 2D space then we can apply transformation TV by simply adding V to P: TV (P) = P + V (3) Homogeneous Form To represent both rotation and translation using a single matrix: cosθ −sinθ Vx sinθ cosθ Vy 0 0 1 The left part is the rotation matrix and the right column is the translation vector! A row [0, 0, 1] is appended in the end. The above represents first a translation (Vx , Vy ) followed by a rotation with angle θ. Derivation of the Homogeneous Form Derivation of the Homogeneous Form (cont’d) The homogeneous transformation can be considered as the relative pose which first translates the coordinate frame by AtB with respect to frame {A} and then is rotated by ARB (θ) Working with the Toolbox for Homogeneous Transformations >>> trot2(0.3) followed by a rotation of 0.3 radians: >>> transl2(0, 0) @ trot2(0.3) An example of a translation of (1, 2) followed by a rotation of 30 degrees: >>> TA = transl2(1,2) @ trot2(30, "deg") A coordinate frame representing the above pose can be plotted: plotvol2([0, 5]); trplot2(TA, frame="A", color="b"); T0 = transl2(0, 0); trplot2(T0, frame="0", color="k"); Working with the Toolbox for Homogeneous Transformations (cont’d) Pose in the 3D Space Rotation: A new coordinate frame {B} with the same origin as {A} but rotated with respect to {A} Transforms vectors from new frame {B} to the old frame {A}: Elementary Rotation Matrices in 3D Rotation about the x-axis: Rx (θ) = 1 0 0 0 cosθ −sinθ 0 sinθ cosθ Rotation about the y-axis: Ry (θ) = cosθ 0 sinθ 0 1 0 −sinθ 0 cosθ Rotation about the z-axis: Rz (θ) = cosθ −sinθ 0 sinθ cosθ 0 0 0 1 Properties of the 3D Rotation Matrix Similarly with the 2D case: The inverse matrix is the same as the Transpose! R −1 = R(T) → easy to compute The determinant is 1: det(R) = 1 → the length of a vector is unchanged after the rotation Rotations in 3D are not commutative (the order of rotation matters!) Representation of Rotation in 3D as an Axis-Angle Combining: a unit vector e indicating a single axis of rotation an angle θ describing the magnitude of the rotation about the a rotation of 90◦ about the z-axis. Python Toolbox Example Rx (π/2) can be represented as: >>> R = rotx(math.pi / 2) The orientation represented by a rotation matrix can be visualized as a coordinate frame rotated with respect to the reference coordinate frame: How to Represent Translation in 3D Just a vector with 3 elements corresponding to how much we move along the x, y and z axes. V = vx / vy /vz Assuming P is the position of some object then we can apply transformation TV by simply adding V to P: TV (P) = P + V Representing Pose in 3D Different ways: Vector and 3 angles (roll, pitch, yaw) Homogeneous transformation (rotation and translation) → advantage of transformations calculations using matrix multiplications! Homogeneous Transformation in 3D Construct a 4 × 4 array with the rotation matrix with 3 zeros (0) in the row below it, and the translation vector with an extra element of 1, as a column next to the rotation matrix: e.g. rotation about x-axis with translation elements of vx , xy , vz −→ Remember, the matrix-based transformations allow to apply them (or even to combine them!) using matrix multiplication! Homogeneous Transformation in 3D - Inverse Transformation Although the inverse of the homogeneous transformation can be calculated as normally by computing the inverse of the original matrix (transformation), this can be done much faster.