|
| 1 | +# Robotic Assembly |
| 2 | + |
| 3 | +In the following we will see how to quantify and obtain data for these two metrics. |
| 4 | + |
| 5 | +<br> |
| 6 | + |
| 7 | +```{eval-rst} |
| 8 | +.. raw:: html |
| 9 | +
|
| 10 | + <a href="./_static/example_files/subtractive_gh_v1.gh" download style="display: inline-block; padding: 10px 20px; font-size: 16px; color: white; background-color: #28a745; text-align: center; text-decoration: none; border-radius: 5px;"> |
| 11 | + <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-arrow-down-circle" viewBox="0 0 16 16"> |
| 12 | + <path fill-rule="evenodd" d="M1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8m15 0A8 8 0 1 1 0 8a8 8 0 0 1 16 0M8.5 4.5a.5.5 0 0 0-1 0v5.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293z"/> |
| 13 | + </svg> |
| 14 | + Download .gh file |
| 15 | + </a> |
| 16 | +``` |
| 17 | + |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## Steps |
| 22 | + |
| 23 | +### 1. Input the data |
| 24 | +First things first, let's import your cleaned scan and corresponding polysurface model in Rhino. |
| 25 | + |
| 26 | +<p align="center"> |
| 27 | + <img style="background-color: transparent;" |
| 28 | + src="./_static/tutorials/fig_subtractive_start.png" width="600"> |
| 29 | +</p> |
| 30 | + |
| 31 | +### 2. Build the DFAssembly |
| 32 | +Here we convert the model of our structure into the internal datatype of diffcheck, DFAssembly. This component detects the joints and their faces. |
| 33 | + |
| 34 | +<p align="center"> |
| 35 | + <img style="background-color: transparent;" |
| 36 | + src="./_static/tutorials/fig_subtrative_high_res_2.png" width="500"> |
| 37 | +</p> |
| 38 | + |
| 39 | +```{hint} |
| 40 | +If you are evaluating round sections e.g. logs, you can set the `i_is_roundwood` input to `True` in the `DFBuildAssembly` component. This will allow DF to detect automatically the joints on the roundwood. |
| 41 | +
|
| 42 | +<p align="center"> |
| 43 | + <img style="background-color: transparent;" |
| 44 | + src="./_static/tutorials/fig_subtractive_log.png" width="600"> |
| 45 | +</p> |
| 46 | +``` |
| 47 | + |
| 48 | +> DF's components: |
| 49 | +> * [`DFAssebmly`](gh_DFBuildAssembly) |
| 50 | +
|
| 51 | +### 3. Registration of CAD and scan |
| 52 | +The registration is the process of aligning the CAD model with the scan. This is done by selecting corresponding points on the CAD model and the scan and find a transformation that minimizes the distance between them. |
| 53 | + |
| 54 | +<p align="center"> |
| 55 | + <img style="background-color: transparent;" |
| 56 | + src="./_static/tutorials/fig_subtrative_high_res_3.png" width="1000"> |
| 57 | +</p> |
| 58 | + |
| 59 | +> DF's components: |
| 60 | +> * [`DFBrepToCloud`](gh_DFBrepToCloud) |
| 61 | +> * [`DFCloudVoxelDownsample`](gh_DFCloudVoxelDownsample) |
| 62 | +> * [`DFCloudNormalEstimator`](gh_DFCloudNormalEstimator) |
| 63 | +> * [`DFRANSACGlobalRegistration`](gh_DFRANSACGlobalRegistration) |
| 64 | +> * [`DFICPRegistration`](gh_DFICPRegistration) |
| 65 | +
|
| 66 | +### 4. Segmentation of the scan |
| 67 | +Once the scan and the CAD model are aligned, we can segment the scan to isolate the parts of the raw point cloud of the scan that corresponds tothe joints. |
| 68 | + |
| 69 | +<p align="center"> |
| 70 | + <img style="background-color: transparent;" |
| 71 | + src="./_static/tutorials/fig_subtrative_high_res_4.png" width="1000"> |
| 72 | +</p> |
| 73 | + |
| 74 | +> DF's components: |
| 75 | +> * [`DFCloudNormalSegmentator`](gh_DFCloudNormalSegmentator) |
| 76 | +> * [`DFRemoveStatisticalOutliers`](gh_DFRemoveStatisticalOutliers) |
| 77 | +> * [`DFJointSegmentator`](gh_DFJointSegmentator) |
| 78 | +> * [`DFColorizeCloud`](gh_DFColorizeCloud) |
| 79 | +
|
| 80 | +### 6. Error computation |
| 81 | +At this point we can compute the error between the CAD model and the scan. The error is computed as the distance between the closest point on the CAD model and the scan. The current DF's output metrics are: |
| 82 | + |
| 83 | +* *distance* : the distance between the closest point on the CAD model and the scan |
| 84 | +* *mean* : the mean distance between the closest point on the CAD model and the scan |
| 85 | +* *max_deviation* : the maximum distance between the closest point on the CAD model and the scan |
| 86 | +* *min_deviation* : the minimum distance between the closest point on the CAD model and the scan |
| 87 | +* *std_deviation* : the standard deviation of the distance between the closest point on the CAD model and the scan |
| 88 | + |
| 89 | +<p align="center"> |
| 90 | + <img style="background-color: transparent;" |
| 91 | + src="./_static/tutorials/fig_subtrative_high_res_5.png" width="500"> |
| 92 | +</p> |
| 93 | + |
| 94 | +> DF's components: |
| 95 | +> * [`DFCloudMeshDistance`](gh_DFCloudMeshDistance) |
| 96 | +
|
| 97 | +### 7. Error Visulization |
| 98 | +DF allows you to quickly visualize the errors in the Rhino viewport. The color of the points represents the distance between the CAD model and the scan. The color scale can be adjusted to better visualize the error. We also provide a graph that shows the distribution of the errors. |
| 99 | + |
| 100 | +<p align="center"> |
| 101 | + <img style="background-color: transparent;" |
| 102 | + src="./_static/tutorials/fig_subtrative_high_res_6.png" width="600"> |
| 103 | +</p> |
| 104 | + |
| 105 | +<div style="display: flex; justify-content: space-around; align-items: center;"> |
| 106 | + <figure style="margin: 10px;"> |
| 107 | + <img src="./_static/tutorials/fig_subtractive_detail_viz.png" alt="subtr detail" style="height: 400px; background-color: transparent;"> |
| 108 | + <figcaption>View on the visualization of the analysed clouds on the CAD model itself. To not that only the points considered as valid are considered for the analysis. </figcaption> |
| 109 | + </figure> |
| 110 | + <figure style="margin: 10px;"> |
| 111 | + <img src="./_static/tutorials/fig_subtractive_graph_viz.png" alt="subtr graph" style="height: 400px; background-color: transparent;"> |
| 112 | + <figcaption>View of the graph of the corresponding distribution of the total error directly in Rhino.</figcaption> |
| 113 | + </figure> |
| 114 | +</div> |
| 115 | + |
| 116 | +> DF's components: |
| 117 | +> * [`DFVisualizationSettings`](gh_DFVisualizationSettings) |
| 118 | +> * [`DFVisualization`](gh_DFVisualization) |
| 119 | +
|
| 120 | +### 8. Export the results |
| 121 | +The results can be also exported in a CSV file for further analysis or documentation. |
| 122 | + |
| 123 | +<p align="center"> |
| 124 | + <img style="background-color: transparent;" |
| 125 | + src="./_static/tutorials/fig_subtrative_high_res_7.png" width="500"> |
| 126 | +</p> |
| 127 | + |
| 128 | +CSV can be exporting the value per joint.. |
| 129 | + |
| 130 | +| Joint ID | Min Deviation | Max Deviation | Std Deviation | RMSE | |
| 131 | +|----------|---------------|---------------|---------------|-------| |
| 132 | +| 0--0--0 | 0 | 0.006 | 0.0015 | 0.0023| |
| 133 | +| 0--1--0 | 0 | 0.0064 | 0.0011 | 0.0024| |
| 134 | +| 0--2--0 | 0.0001 | 0.0091 | 0.0019 | 0.0028| |
| 135 | +| 0--3--0 | 0 | 0.0061 | 0.0012 | 0.0018| |
| 136 | +| 0--4--0 | 0.0001 | 0.0062 | 0.0009 | 0.0021| |
| 137 | + |
| 138 | +.. or per face |
| 139 | + |
| 140 | +| Joint Face ID | Min Deviation | Max Deviation | Std Deviation | RMSE | Mean | |
| 141 | +|---------------|---------------|---------------|---------------|-------|-------| |
| 142 | +| 0--0--0 | 0 | 0.0032 | 0.0006 | 0.0009| 0.0007| |
| 143 | +| 0--0--1 | 0.2933 | 0.6587 | 0.1164 | 0.4882| 0.4741| |
| 144 | +| 0--0--2 | MISSING_PCD | MISSING_PCD | MISSING_PCD | MISSING_PCD| MISSING_PCD| |
| 145 | +| 0--0--3 | MISSING_PCD | MISSING_PCD | MISSING_PCD | MISSING_PCD| MISSING_PCD| |
| 146 | +| 0--0--4 | MISSING_PCD | MISSING_PCD | MISSING_PCD | MISSING_PCD| MISSING_PCD| |
| 147 | +| 0--0--5 | MISSING_PCD | MISSING_PCD | MISSING_PCD | MISSING_PCD| MISSING_PCD| |
| 148 | +| 0--0--6 | 0.2602 | 0.3317 | 0.0171 | 0.2991| 0.2986| |
| 149 | +| 0--0--7 | 0.1829 | 0.2453 | 0.0176 | 0.2076| 0.2069| |
| 150 | +| 0--0--8 | 0.0107 | 0.2884 | 0.0897 | 0.1512| 0.1217| |
| 151 | +| ... | ... | ... | ... | ...| ... | |
| 152 | + |
| 153 | +> DF's components: |
| 154 | +> * [`DFCsvExporter`](gh_DFCsvExporter) |
0 commit comments