Simulation of linkages

Erik Ferrando and Mart´ın Forsberg Universitat Polit`ecnica de Catalunya

(Dated: May 31, 2019) Mechanical linkages and their possible movements are of interest in many parts of mechanical engineering and robotics. The theory behind this topic employs a considerable body of nontrivial mathematics, and in particular group theory. In this paper we study the algorithms that determine the allowed movements of a class of linkages, and implement them in Python.

I. INTRODUCTION freedom (S, E), two (C) and one (P,R,H).

When rigid bodies we get a , which takes place pairwise, thus giving the name kine- matic pair. There are two types of kinematic pairs: lower and upper. When we have a kinematic chain that is coupled with lower kinematic pairs, we can distin- guish between simple and complex kinematic chains. Regarding the former, there are two types, namely, open and closed; and regarding the latter we can differentiate between tree structures and chains with multiple closed loops.

The next important item is the kinematic constraint equations of a general mechanical system, that leads to the concept of dependent and independent generalized , by means of which the twists of all the links of the chain are expressed as linear transformations of the vector of independent generalized speeds. FIG. 1. Types of lower kinematic pairs

The relative associated with each of the lower II. THEORETICAL FRAMEWORK kinematic pairs constitutes a group under the operation of composition. These groups, which are subgroups of A. Kinematic pair types and degrees of freedom the Euclidean group G, are denoted by its letter shown in FIG.1: We know that there are two types of kinematic pairs, namely, lower and upper pairs. Lower pairs exist when • Revolute pair: R(A, e) is the subgroup of rotations the coupling between the two bodies occurs along a around an axis of vector e passing through a point surface, while upper pairs exist when the coupling takes A. place along a point or a line. There are six types of lower pairs (FIG.1) but all six can be decomposed into a • Prismatic pair: P(e) is the subgroup of the relative combination of prismatic (P ) and/or revolute (R) lower translations given by the vector e kinematic pairs. • Helical pair: H(A, p, e) is the group of rotations A kinematic chain is simple if each of its links is around an axis parallel to e and passing through a coupled to, at most, two other links, so then if all links point A with pitch p. are coupled to exactly two other links, the kinematic chain is closed. Otherwise (i.e. all links are coupled to • Cylindrical pair: C(A, e) is the subgroup of rota- two links, except two of them that are coupled to only tions and translations around an axis of vector e one), we have an open kinematic chain. In either case, passing through a point A. we can number the links uniquely. • Spherical pair: S(A) is the subgroup of rotations The degree of freedom of a kinematic chain is defined around a point A. as the number of variables that define uniquely the position and orientation of all its links. Among the lower • Planar pair: E(A) is the subgroup of relative mo- kinematic pairs, there are those with three degrees of tions perpendicular to a vector e 2

The dimension of one of the foregoing subgroups is chain cannot be reduced to an equivalent trivial chain it defined as the degree of freedom of the relative motion is termed paradoxical or overconstrained. it allows (e.g. dim(S) = 3). There exist subgroups of G Let’s assume that the product of all subgroups Gi of a that are not associated to any lower pair, such as plane trivial (n + 1)-link kinematic chain be a subgroup of G translations (T ) or three-dimensional translations (U). n Y 0 Taking the subchain composed of links numbered i, i+ Gi = G ⊂ G. i=0 1, . . . , i + j, in [4], the bond Bi,i+j between the links i and i + j is defined as the product of subgroups Gk for 0 Let d be the dimension of G and ri the number of k = i, i + 1, . . . , i + j − 1, where Gk denotes the subgroup constraints on the two bodies that Ki couples. Then the of relative associated with the kinematic pair degree of freedom of the chain is given by the Chebyshev- connecting links k and k + 1, which is not necessarily a Gr¨ubler-Kutzbach formula: subgroup itself. In an n-link closed kinematic chain, the n idle degree of freedom of the chain is X f = dn − ri − m (3) n X i=0 m := dim(Gk) − dim(B1,n+1), (1) k=1 where m is defined as in equation (1).

where the dimension of the bond B1,n+1 can be com- puted, using inclusion-exclusion principle, as Now, regarding exceptional chains, we introduce the concept of a reduced equivalent. There are some steps

n involved in the achievement of a reduced equivalent: X X B = dim(G ) − dim(G ∩ G ) + ... (2) 1,n+1 i i j (i) Get a second chain by decomposing all links as a i=1 1≤i

0 kinematic pairs, then Ki is simply defined as that III. SIMULATION FRAMEWORK 0 pair. If it is not, we decompose Gi as a product of subgroups of G associated with lower kinematic We have developed two tools to simulate the move- pairs. ment of two and three-dimensional closed-ring linkages (viii) The resulting trivial chain is called the reduced that only include rotational kinematic pairs. equivalent of the original exceptional chain. Since it is trivial, its degree of freedom can be obtained We have used Python with the Numpy, Pygame and with equation (3). Clearly, both chains have the OpenGL libraries. same degree of freedom.

A. 2D simulation B. The twist of a link and the Jacobian of a simple kinematic chain The 2-dimensional twist only has 3 dimensions be- cause the angular is a scalar instead of a vector. Given a kinematic chain, we have seen that it can be Given an ordered set of n two-dimensional points, we can decomposed into a chain of R and/or P pairs. Denote construct the Jacobian matrix of the linkage according Oi a point of the axis of the i-th pair in the chain, and to what has been explained before. for each of them take vi the velocity and ωi the ; then the twist is defined as We compute the null of the Jacobian using   ωi SVD decomposition. We now have dim[N (J)] different ti := vi vectors to move our linkage according to orthogonal degrees of freedom. So the user can simply tap the right We also define ri as the vector joining Oi and P and left keys to move according to a particular degree of freedom, and the tabulator key to change the degree of ri = ai + ··· + an. freedom. Assuming that the chain contains only R pairs, the angular velocity of the nth link is Every we move the linkage, the SVD is recom- puted, and SVD isn’t stable under small changed in the ωn = θ˙1e1 + ··· + θ˙nen, matrix, so while N (J) is always fairly close to the one and if we denote the position vector of P as in the previous frame, the vectors that are chosen by the p = a + ··· + a SVD method are not always similar to the one in the 1 n previous frame. In some cases we can get the same vec- then the velocity of P is tors but in the opposite directions, leading to a if the user presses an arrow key, instead of a fluid motion. vn := p˙ = a˙ 1 + ··· + a˙ n, where To solve this, we find the closest possible vector   in the current nullspace to the vector we used in the a˙ = ω × a = θ˙ e + ··· + θ˙ e × a . k k k 1 1 k k k previous frame. Let W = N (J) be in matrix form, and let v be the vector we used in the previous frame. Then, by the definition of ri, we obtain Then we use the generalized Moore-Penrose inverse, ˙ ˙ p˙ = θ1e1 × r1 + ··· + θnen × rn W + = (W T W )−1W T to get v0 = (W (W +vT ))T . With this, our program will always look fluid. Thus, the twist of the nth link can be written as tn = Jθ˙, where J is the Jacobian matrix of the kinematic chain. Moreover, the degree of freedom of the chain (i.e. 2D closed linkages are very limited. An has of the end link) is the dimension of the range of J and N − 3 degrees of freedom. We were able to observe this since it has 6 rows we can define f as follows fact in every linkage we tested. f := dim[range(J)] ≤ 6 Next, if we assume now that we have a closed kinematic B. 3D linkage simulation chain, then we need to add a last column to the Jacobian (representing the pair joining the 0th and the nth link, Since we used the 3D theoretical framework for the then the degree of freedom of the chain would be the 2D case, the 3D case is largely the same as the 2D case. range of a (n + 1) × 6 matrix, which is also the nullity of J, i.e., the dimension of the nullspace of J, N (J) To make the linkage visible, we made the axes of f = dim [N (J)] . rotation visible and put tetrahedra between the axes that are connected. 4

what do the degrees of freedom represent for a kinematic chain. Basically the degrees of freedom indicate us how many ways a chain has to move without breaking the structure and group theory helps us realizing how a chain can move taking into account the nature of its links.

FIG. 2. Simulation of a 2D mechanism with 5 links.

FIG. 3. Simulation of a Sarrus Linkage, with an artistic depic- tion of it at the side for visualization. While its 6 links would suggest that it is static, it has a single degree of freedom.

We were able to simulate various 3D structures. While N-link rotational pair, closed-ring 3D linkages usually have N − 6 degrees of freedom, there are exceptions to this. FIG. 4. A standard kaleidocycle. In the top, a visualization, In particular, if all the axes are in the same direction, and in the bottom, our simulation. Its symmetries make it it’s very similar to a planar structure, thus giving N − 3 mobile, even though it only has 6 links. degrees of freedom. There are other examples of this, such as Bennett’s linkage or spherical linkages. Since they have more degrees of freedom than one would assume by their number of links, they are called overconstrained. V. REFERENCES

Another example of an overconstrained mechanism [1] Angeles J., Rational , Springer Tracts is the Sarrus linkage, which we have simulated and in Natural Philosophy Vol. 34 (1988) included an image of in Figure 3. [2] Rico J.M. and Ravani B., (2002) On mobility anal- As a final example, in Figure 4 we can see a standard ysis of linkages using group theory, ASME 2002 Design 6-link kaleidocycle. This mechanism is a popular toy Engineering Technical Conferences and Computer and that can be made in origami. Information in Engineering Conference

[3] Antman S.S., Marsden J.E. and Sirovich L., (2010) Springer Geometric Design of Linkages IV. CONCLUSION [4] Herv J.M., (1978) Analyse structurelle des mcan- So, in this project, we have taken the theory in ismes par groupes de dplacement, Mechanism and ma- kinematics into practice via simulations, and checked chine theory, Vol. 13