## 3 Robotic Path Pre-Planning  
Environmental data from the RGB/D cameras can inform the process of a potential collision due to a given robotic motion. Since the robot is controlled with speed commands on an uncertain surface, collision detection and prevention is completed before the scan takes place. A custom CUDA-kernel was written to check whether the rough path taken by the robot is collision free, and to remove way-points that may cause a collision given their estimated  
Figure 3: The viewing frustum of a camera intersects with the part along planes given by either each row or column of pixels. The planes of this chosen direction return points along the surface that form a raster-segments. These ordered raster segments can be reduced (red) if too close together, or regionally padded (blue) if the smallest distance from one raster-segment to another is larger than the sensor aperture. Key points (dots) can then be extracted directly from the point cloud and used as way-points. The overall path combining original (green) and inferred raster lines (blue) are denoted.  
normals and position. The environmental data consists of the whole point cloud of the part and cell that is then separately refined for path planning, as well as a bounding box set to prevent collisions with the cell. The process of this function is documented in Algorithm 1.  
```
for\(\overrightarrow{p}\in\text{Path}\)do \(\overrightarrow{\Omega}_{p}=\{\overrightarrow{\theta}_{p}^{i}=1K(p,i):\text{ notCollision}(\overrightarrow{\theta}_{p}^{i})\}\)+ endfor for\(k\in\{0:\text{MaxConfgs}\}\), \(\overrightarrow{p}\in\text{Path}\)do \(\text{NextBestConfig}(k,p)=i:\min_{i\in\overrightarrow{\Omega}_{p+1}}| \overrightarrow{\theta}_{p}^{k}-\overrightarrow{\theta}_{p+1}^{j}|\)+ \(\text{ConfigCost}(k,p)=|\overrightarrow{\theta}_{p}^{k}-\overrightarrow{ \theta}_{p+1}^{i}|\) endfor for\(k\in\{0:\text{MaxConfgs}\}\)do \(t=0\), \(\text{GenCount}=0\) while\(t+1\leq|\text{Path}|\)do if\(\text{ConfigCost}(k,p)<L\)then \(k_{+1}=\text{NextBestConfig}(t,k)\) \(\text{Cost}(k)+=\text{ConfigCost}(k,p)\) \(\text{GenCount}+=1\) \(t=t+1\) else \(t=|\text{Path}|+1\) endif endwhile endfor
```  
**Algorithm 1**Calculate possible collision-free paths, and the cost of each path from each potential initial configuration.  
Then either the closest initial configuration to the current one can then be used, the one which will lead to the longest collision-free path (given by 'GenCount' in Algorithm 1, or the one that will lead to the shortest distance travelled in configuration-space depending on operator preference.  
After an initial configuration is decided, the approach is calculated using linear motion in the configuration space. If a collision is found, then a Rapidly-exploring Random Tree (RRT) framework calculates a collision free path from the current to the starting configurations.  
The limitations of this pre-scan method is that the uncertainty in the point-cloud position and orientation may lead to positions being removed without causing a collision in process. However, the speed command control method requires regular updates, rendering an in-process collision detection method for an unknown surface unfeasible due to latency.