# Knowledge-Based Automated Mechanical Design of a Robot Manipulator
## 2 Materials and Methods
### Kinematic Synthesis through Optimization
#### 2.1.1 Robot Genotype Encoding  
The robot kinematic structures are in the GA optimization represented by a genotype vector. The structure of a genotype vector for a 3 degree-of-freedom (DOF) manipulator is shown in Table 1. The genotype is a combination of link lengths and joint type. The length of the genotype depends on the number of DOFs in the robot and is set before optimization.  
The genotype vector is a vector of integers. The length is given in millimeters. The lower bound of the link length is different for each link. This is because we expected the joints towards the base to have more powerful and therefore bigger drive units. Towards the end effector, the requirements for joint torque are generally lower than in the base, and we could expect smaller drive units. The bounds can be modified for different applications. With our selected drive units, we have settled on lower bounds driven by a linear function (1). The maximum length is less important, since the fitness function is trying to minimize the length of the whole manipulator. For our experiments we have used 1000 which was more than enough for the used workspaces.  
\[a_{n}=300-n\cdot 25\ [\mathrm{mm}] \tag{1}\]  
where: \(n\) is the link number and an is the length of the \(n\)th link.  
The joint type describes the rotation of a joint relative to the previous joint, or in the case of the first joint relative to the world coordinate frame. We have used three different orientations shown in Figure 3. The transformation matrices for these joint types are defined in Equation (2).  
\begin{table}
\begin{tabular}{c c c c c c c} \hline
**Parameter** & a\({}_{1}\) & \(\alpha_{1}\) & a\({}_{2}\) & \(\alpha_{2}\) & a\({}_{3}\) & \(\alpha_{3}\) \\ \hline
**Description** & Link 1 length & Joint 1 type & Link 2 length & Joint 2 type & Link 3 length & Joint 3 type \\ \hline
**Upper bound** & 1000 & 2 & 1000 & 2 & 1000 & 2 \\ \hline
**Lower bound** & 275 & 0 & 250 & 0 & 225 & 0 \\ \hline \end{tabular}
\end{table}
Table 1: Robot Genotype Structure.  
\[\alpha_{i}=0\ \rightarrow\ T_{i}=\begin{bmatrix}\cos(\theta_{i})&\sin( \theta_{i})&0&a_{i}\\ -\sin(\theta_{i})&\cos(\theta_{i})&0&0\\ 0&0&1&0\\ 0&0&0&1\end{bmatrix} \tag{2}\] \[\alpha_{i}=1\ \rightarrow\ T_{i}=\begin{bmatrix}\cos(\theta_{i})&0& \sin(\theta_{i})&a_{i}\\ -\sin(\theta_{i})&0&\cos(\theta_{i})&0\\ 0&-1&0&0\\ 0&0&0&1\end{bmatrix}\] \[\alpha_{i}=2\ \rightarrow\ T_{i}=\begin{bmatrix}0&0&-1&a_{i}\\ -\sin\ (\theta_{i})&\cos(\theta_{i})&0&0\\ \cos(\theta_{i})&\sin(\theta_{i})&0&0\\ 0&0&0&1\end{bmatrix}\]  
Transformation matrices for an example 3 DOF kinematic structure with the genotype [300, 0, 400, 0, 200, 1] are shown in (3).  
\[T_{E}=\begin{bmatrix}\cos(\theta_{1})&\sin(\theta_{1})&0&0.3\\ -\sin(\theta_{1})&\cos(\theta_{1})&0&0\\ 0&0&1&0\\ 0&0&0&1\end{bmatrix}\begin{bmatrix}\cos(\theta_{2})&\sin(\theta_{2})&0&0.4\\ -\sin(\theta_{2})&\cos(\theta_{2})&0&0\\ 0&0&1&0\\ 0&0&0&1\end{bmatrix}\begin{bmatrix}\cos(\theta_{3})&0&\sin(\theta_{3})&0.2\\ -\sin(\theta_{3})&0&\cos(\theta_{3})&0\\ 0&-1&0&0\\ 0&0&0&1\end{bmatrix} \tag{3}\]  
where \(T_{E}\) is the transformation matrix from the base coordinate frame to the end effector coordinate frame and [\(\theta_{1}\), \(\theta_{2}\), \(\theta_{3}\)] is the current joint configuration.