# Workspace Analysis of a Mobile Manipulator with Obstacle Avoidance in 3D Printing Tasks
## 2 Materials and Methods
### Modelling the Environment
#### 2.3.2 Obstacle Avoidance  
The main idea is that the mobile manipulator can develop the 3D printing task through trajectory tracking control while avoiding obstacles. The concept of potential fields allows obtaining the angular and longitudinal velocity of the mobile platform [34]. Then, a distance function to avoid collision between links and mobile platform with the manipulator is defined. In this regard, we consider \(h_{eed}\) as the desired trajectory defined by the building elements; \(h_{rob}\) represents the \(x,~{}y\) position of the mobile platform, and \(h_{obs}\) is the position of objects in the plane \(x,~{}y\) of the construction site. \[U(h_{red},h_{rob},h_{obs})=U_{attr}(h_{eed},h_{rob})+U_{rep}(h_{rob},h_{obs}) \tag{3}\]  
We generated a rejection vector to avoid collision between objects and the mobile manipulator in the construction sites. In Equation (3) \(U_{attr}\) is the target position that produces an attractive force for the end-effector, and \(U_{rep}\) represents the repulsive forces for the parts of the mobile manipulator. \(U_{attr}(h_{end},h_{rob})\) depends on the robot configuration and the desired trajectory and \(U_{rep}(h_{rob},h_{obs})\) represents the repulsive force between the mobile platform and the obstacles on the construction site. The attractive function defined in Equation (4) allows for achieving the 3D printing of the proposed building elements through a quadratic function of distance that relates the printing profile and the mobile platform. \[U_{attr}(h_{eed},h_{rob})=\frac{1}{2}\xi_{h_{end}}d^{2}(h_{eed},h_{rob}) \tag{4}\]  
The proposed potential repulsion field (see Equation (5)) creates a barrier around obstacles to ensure that the mobile manipulator does not crash. Therefore, the mobile manipulator motion is not affected if the repulsive potential field is far enough away from the obstacles. \[U_{rep}(h_{rob},h_{obs})= \begin{cases}0&if~{}~{}Q_{inf}\leq d(h_{rob},h_{obs})\\ \xi_{r}\Big{(}\frac{1}{d(h_{rob},h_{obs})}-\frac{1}{Q_{inf}}\Big{)}&if~{}~{}Q_{ min}\leq d(h_{rob},h_{obs})\leq Q_{inf}\\ \xi_{r}\Big{(}\frac{1}{Q_{min}}-\frac{1}{Q_{inf}}\Big{)}&if~{}~{}d(h_{rob},h_{ obs})\leq Q_{min}\end{cases}  \tag{5}\]  
where \(Q_{inf}\) is the distance from the obstacle that does not influence the mobile manipulator, \(Q_{min}\) represents the minimum safety distance between the obstacle and \(\xi_{r}\) is the change of the repulsive function. The generated variables modify the linear \((\mu_{obs})\) and angular \((\omega_{obs})\) velocity for the mobile platform. The manipulator control variables consider the collision distance between the links and the mobile platform with the robotic arm. \(\dot{\theta}_{obs}=\big{[}\dot{\theta}_{1 obs}~{}\dot{\theta}_{2 obs}~{}\dot{ \theta}_{3 obs}~{}\dot{\theta}_{4 obs}~{}\dot{\theta}_{5 obs}~{}\dot{\theta}_{6 obs}\big{]}\) \begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline
**Robotic Arm** & \(\theta_{1}\) & \(\theta_{2}\) & \(\theta_{3}\) & \(\theta_{4}\) & \(\theta_{5}\) & \(\theta_{6}\) & **Mobile Platform** & & & \\ \hline \(\theta_{min}\) (rad) & \(-\frac{2\pi}{3}\) & \(-\frac{\pi}{2}\) & \(-\frac{\pi}{2}\) & \(-\frac{\pi}{4}\) & \(-\frac{\pi}{4}\) & 0 & \(\mu_{min}\) (m/s) & \(\pm 0.1\) & \(\omega_{min}\) (rad/s) & \(-\pi\) \\ \(\theta_{max}\) (rad) & \(\frac{2\pi}{3}\) & \(\frac{5\pi}{36}\) & \(\frac{5\pi}{36}\) & \(\frac{5\pi}{6}\) & \(\frac{5\pi}{6}\) & \(\pi\) & \(\mu_{max}\) (m/s) & \(\pm 0.7\) & \(\omega_{max}\) (rad/s) & \(\pi\) \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Analysis of the workspace of a mobile manipulator based on the Monte Carlo method. Upper and lower rotation limits of the mobile manipulator joints. represents the control variables modified by collision avoidance, \(O_{e}\) is the position of the end-effector, and the centre of the robot platform is \(<R>\), as shown in Figure 4.  
We define a distance function \(H_{i}\) (\(i=1,2,\ldots,n\)) to capture the relationship between the mobile platform and the manipulator links.