# Automatic Optimal Robotic Base Placement for Collaborative Industrial Robotic Car Painting
## 4 Construction of the First Cost Function: Minimizing the Possibility of Collision
It can be easily seen that \(\mathcal{A}_{i,j}\Big{(}\mathbf{p}_{i},\mathbf{p}_{j}\Big{)}\geq 0\) for all \(\mathbf{p}_{i}\), \(\mathbf{p}_{j}\), and \(1\leq i<j\leq M\) (i.e., overlap areas are positive or zero). Moreover, \(\mathcal{A}_{i,j}\Big{(}\mathbf{p}_{i},\mathbf{p}_{j}\Big{)}=\mathcal{A}_{i,j }\Big{(}\mathbf{p}_{j},\mathbf{p}_{i}\Big{)}\) due to symmetry. It is now possible to define the cost function quantifying the possibility of collision between the \(M\) robots during painting. In particular, using the ellipse overlap areas, we define the cost function \(\mathcal{F}_{1}(\cdot)\) according to  
\[\mathcal{F}_{1}(\mathbf{p}_{1},\cdots,\mathbf{p}_{M}):=\sum_{1\leq i<j\leq M} \mathcal{A}_{i,j}\Big{(}\mathbf{p}_{i},\mathbf{p}_{j}\Big{)}. \tag{12}\]  
There are a variety of ellipse overlap area computation algorithms in the literature such as computationally intensive Monte Carlo methods [48], approximations based on polyarcs [49], and polygon-based methods [50]. Since we feed the cost function \(F_{1}(\cdot)\) given by (12) to a multi-objective optimizer, we need a fast and accurate algorithm for computing ellipse overlap areas. A very appealing algorithm suited for our needs is the one due to [PERSON] and [PERSON] [51], which avoids the use of approximating proxy curves. Rather, that algorithm, which is based on a strategy that combines segment and polygon areas to compute the overlap, is applicable to any two general ellipses. The algorithm distinguishes between a variety of different ellipse intersection configurations (see Figure 7) and utilizes the Gauss-Green theorem to compute segment areas (see [51] for further details). Figure 7: The algorithm proposed by [51] distinguishes between a variety of different ellipse intersection cases. It computes the overlap area of any two general ellipses without resorting to proxy curves. **Remark 4**. : _While the overlap of robotic arm workspaces provides a useful heuristic for evaluating collision potential, it is important to recognize that the actual likelihood of collisions is primarily influenced by the motion planning and control strategies applied after base placement. Workspace overlap alone does not directly correlate with collision risk, as modern algorithms are capable of dynamically adjusting the robot trajectories to avoid collisions, even in scenarios where significant overlap exists. However, poor base placement can negatively impact the performance of subsequent path planning algorithms, potentially leading to suboptimal coverage or even failure in certain areas. To address this, advanced collision avoidance strategies that operate in densely populated robotic environments are applied after base placement. These strategies mitigate the risks associated with workspace overlap while maximizing the effective utilization of robotic arms. This hierarchical approach ensures that while base placement reduces collision potential, the subsequent dynamic adjustments during motion planning handle remaining collision concerns (see, e.g., [34; 52]), thus optimizing both safety and efficiency._  
Construction of the Second Type of Cost Functions: Maximization of the Possibility of Paint Coverage  
In this section, we construct a group of cost functions to quantify the amount of vehicle paint coverage. These cost functions are obtained by projecting the point clouds, which are computed in the pre-processing stage, onto the sides and top of the vehicle. We first create grid map representations of the top and sides of the car. These grid maps are computed using standard image processing algorithms like the Moore-Neighbor Tracing algorithm (see, e.g., [53]), which traces given contours and detects object boundaries in the vehicle's CAD model (see Figure 8). It is remarked that the grid map computation needs to be run only once. After creating the grid maps from the vehicle's CAD model, we consider the point cloud representation of the reachable workspace of the robotic forearms.