优化传感器对准压头
This commit is contained in:
@@ -169,19 +169,14 @@ def test_the_initial_view_is_the_commissioned_orientation(qt_app, bundle):
|
||||
f"sensor +Y must point up the screen, but moved {tip[1] - origin[1]:+.1f} px"
|
||||
)
|
||||
|
||||
# Sensor +Z is the sensing face's own axis and must face the viewer. It is
|
||||
# the platform's -Y on this mount. ``forward`` points from the eye into the
|
||||
# scene, so a surface normal aimed *at* the camera has a positive dot with
|
||||
# it — the opposite of what the depth term in a projection does, and the
|
||||
# sign this assertion got wrong first time.
|
||||
# The commissioned camera sits in front of the shell and a little below
|
||||
# it, looking back toward platform −Y. That is the ad049d12 preview.
|
||||
eye, _distance = preview._camera() # noqa: SLF001
|
||||
centre = preview._view_target() # noqa: SLF001
|
||||
_centre, forward, _right, _up = preview._view_basis(eye) # noqa: SLF001
|
||||
lens_axis = to_sensor(np.array([0.0, -1.0, 0.0]), stack.axis_map)
|
||||
lens_axis = lens_axis / np.linalg.norm(lens_axis)
|
||||
assert float(lens_axis @ forward) > 0.2, (
|
||||
f"sensor +Z must face the viewer, but points away: "
|
||||
f"{float(lens_axis @ forward):+.3f}"
|
||||
)
|
||||
assert eye[1] > centre[1]
|
||||
assert eye[2] < centre[2]
|
||||
assert forward[1] < -0.5, f"the view must look toward −Y, but forward is {forward}"
|
||||
finally:
|
||||
preview.deleteLater()
|
||||
|
||||
@@ -1253,8 +1248,8 @@ def test_the_tool_position_sets_the_move_and_not_the_reading(panel):
|
||||
def test_the_readouts_name_the_frame_mapping(panel):
|
||||
"""The one line the bench will want to check when x and y are interchanged."""
|
||||
text = panel._readout_labels["frames"].text() # noqa: SLF001
|
||||
assert "x" in text and "z" in text
|
||||
assert "-y" in text or "−y" in text
|
||||
assert "x->-x" in text
|
||||
assert "z->y" in text
|
||||
|
||||
|
||||
def test_the_readout_names_the_chosen_pose_and_the_key_that_chose_it(panel):
|
||||
@@ -1271,7 +1266,7 @@ def test_the_readout_names_the_chosen_pose_and_the_key_that_chose_it(panel):
|
||||
|
||||
pose = panel._last_pose # noqa: SLF001
|
||||
text = panel._readout_labels["branch"].text() # noqa: SLF001
|
||||
assert pose.branch_reason in {"only", "alignment", "in_range", "upright", "smallest"}
|
||||
assert pose.branch_reason in {"only", "alignment", "in_range", "upright", "smallest", "crown"}
|
||||
assert t(f"finger.branch_{pose.branch_reason}") in text
|
||||
# And the alternative's cost is on screen too, not just the chosen one's.
|
||||
assert f"{pose.other_travel_deg:.1f}" in text
|
||||
@@ -1294,7 +1289,9 @@ def test_the_press_readout_says_why_it_is_held_and_then_names_the_target(panel):
|
||||
targets, held = panel.solved_pose()
|
||||
assert held == ("z",)
|
||||
assert "z" not in targets
|
||||
assert targets["x"] == pytest.approx(pose.table_xy_mm[0])
|
||||
from orisys_autocal.sensor.frames import TABLE_X_GAIN
|
||||
|
||||
assert targets["x"] == pytest.approx(-TABLE_X_GAIN * pose.table_xy_mm[0])
|
||||
|
||||
# With the bench's zero entered, the same contact height becomes a coordinate.
|
||||
panel.set_press(PressAxis(zero_mm=2.0, rising=True, calibrated=True))
|
||||
|
||||
Reference in New Issue
Block a user