(actual, desired, dist_tol=0.0, angle_tol=0.0)
| 396 | |
| 397 | |
| 398 | def assert_trans_allclose(actual, desired, dist_tol=0.0, angle_tol=0.0): |
| 399 | __tracebackhide__ = True |
| 400 | |
| 401 | from ..transforms import Transform, angle_distance_between_rigid |
| 402 | |
| 403 | if isinstance(actual, Transform): |
| 404 | assert isinstance(desired, Transform), "Both must be Transform or ndarray" |
| 405 | assert actual["from"] == desired["from"], "'from' frame mismatch" |
| 406 | assert actual["to"] == desired["to"], "'to' frame mismatch" |
| 407 | actual = actual["trans"] |
| 408 | desired = desired["trans"] |
| 409 | assert isinstance(actual, np.ndarray), "actual should be ndarray" |
| 410 | assert isinstance(desired, np.ndarray), "desired should be ndarray" |
| 411 | assert actual.shape == (4, 4), "actual.shape should be (4, 4)" |
| 412 | assert desired.shape == (4, 4), "desired.shape should be (4, 4)" |
| 413 | angle, dist = angle_distance_between_rigid( |
| 414 | actual, desired, angle_units="deg", distance_units="m" |
| 415 | ) |
| 416 | assert dist <= dist_tol, ( |
| 417 | f"{1000 * dist:0.3f} > {1000 * dist_tol:0.3f} mm translation" |
| 418 | ) |
| 419 | assert angle <= angle_tol, f"{angle:0.3f} > {angle_tol:0.3f}° rotation" |
no test coverage detected