# Part Pose Change Computation

Part position change computation is the first step of Pose Computation. The purpose of it is to calculate the change in pose of the run-time part from the target position.

For different applications, the target position is defined differently.

In alignment applications, all target positions are the part's trained golden pose.

Application | Motion Move Type | Feature Compare Mode | Part Pose Difference (Calculated based on features)
--- | --- | --- | ---
Alignment | Align To Base | Golden Pose | Run time -> Golden pose
Align To Gripper | Golden Pose

In assembly applications, if the chooses to train the golden pose of each part, the target pose for pose change computation is the golden pose established during train-time.

If user choose using paired features, then the target pose is the stationary part's pose (named as Part B)

Application | Motion Move Type | Feature Compare Mode | Part Pose Difference (Calculated based on features)
--- | --- | --- | ---
Assembly | Assembly Blind Transfer | Paired Features | Part A Run time -> Part B Run time
Golden Pose | Part A: Run time -> Golden pose Part B: Run time -> Golden Pose
Assembly Guided Pick | Paired Features | Part A Run time -> Part B Run time
Golden Pose | Part A: Run time -> Golden pose Part B: Run time -> Golden Pose
Assembly Guided Place | Paired Features | Part A Run time -> Part B Run time
Golden Pose | Part A: Run time -> Golden pose Part B: Run time -> Golden Pose

However, irrespective of the definition of the target position, the same techniques are used to compute the change in part pose.

## Point Feature Pose Computer

When one has one point feature, the change in part pose is the transform in Home2D that would align the run-time pose(translation and rotation) of the feature to the target pose of the feature.

When more than one point feature is available, the rotation parameter in the pose of each feature is ignored. Only the translation parameters are considered. The pose computer computes an affine transform that maps the run-time points to the train-time points in a fashion that minimizes the distances between the corresponding points in the least squared sense.

Note:

If one or more features could not be found in the run-time image, the pose computation process will infer the positions of the missing points using the found run-time and train-time features. Once this is done all the points are used to compute the part pose change.

The result of two-point alignment or assembly could be different with three or four points', here is an example:

When two point features are used, a transform that aligns the two run-time features to the line joining the corresponding train-time features will be computed. When three or more point features are used, the approximate medians of the parts will be aligned.

## Line Feature Pose Computer

When line feature is used, at least four line features should be found in run time for part pose computation. The four lines could be four edges around two corners or edges along four sides.

- Corner line features

- Side line features

There are two options to center line segments to line segments:

- CenterGroupALineSegEndPointsToGroupBLines

  In this mode, the pose computer centers a set of lines on one part to a set of points on another part. Feature correspondences are established between the lines by giving corresponding lines the same names during feature finder setup. This mode will try and minimize the variation in the point-line signed distance across all point-line correspondences.

  In the diagram above, A, B, C, ..., G are FinderNames of line features. The block uses the end points for the line segments from the first group and the corresponding line segments in the second group to compute the centering transform. In the example, eight line segments are located in each group and sixteen point line pairs are generated, ((A, AS), (A, AE), …, (H, HS), (H, HE)). This mode will try and minimize the variation in the point-line signed distance across all sixteen point-line correspondences.

  Here is a result of CenterGroupALineSegEndPointsToGroupBLines mode being used in four corner-line assembly: equal values are obtained among all gaps(G1=G2=G3=G4).

- CenterGroupAPointPairsToGroupBLinePairs

  In this mode, the feature correspondences are between point pairs and line pairs. The tool will try and minimize the variance in the point-line signed distance difference for each point-pair line-pair correspondence, across all point-pair line-pair correspondences. The point to line distance difference for a given point-pair line-pair correspondence is the difference between the point-line signed distance for the first point and the point-line signed distance for the second point in the point pair.

  In the diagram above, A, B, C, D are ProbeID values in line features' UserData dictionary, Finder00 ~ Finder07 are finder names of line features. In this mode, pose computer runs in the following steps:

  1. Every line segment has a UserData property which is of type CogDictionary. When the computer is configured to work in this mode it expects the dictionary to contain a valid value for the ProbeID key. The block pairs line segments that have the same value for the ProbeID key.

  2. It finds the midpoint of all the paired line segments and computes a list of point pairs.

  3. For each point pair from the first group, the block finds the corresponding line pair in the second group. It does this by finding lines with the same FinderName property.

  4. Once the list of point pairs and the line pairs are computed, the pose computer computes a centering transform

  Here is a result of CenterGroupAPointPairsToGroupBLinePairs mode being used in four side-line assembly: the symmetric features are paired and equal gaps are obtained(A1=A2, B1=B2).

## Custom Pose Computer

Certain application requirements cannot be satisfied by the standard part pose change computers that are described above due to the requirements that they satisfy. In such situations a custom pose computer can be employed.

In the application below, the target features are the two fiducials on a panel, and the run time features are two corners on a polarizer. The requirement is that the two fiducials on the panel should be 2mm above the line joining the two corners on the polarizer.

Custom pose computers allow the application to implement custom assembly rules. It can be implemented in the VisionPro Tool Block that is made available by the application, to use run-time features and target features, and output a transform that satisfies assembly requirement.