调整传感器位置
This commit is contained in:
@@ -99,11 +99,10 @@ def _default_safety_limits() -> dict[str, float]:
|
||||
#: How far the axis may descend looking for contact before the run is
|
||||
#: aborted (workflow P7, no-contact abort).
|
||||
"contact_search_mm": 3.0,
|
||||
#: Stage envelope, from the confirmed bench values: the yaw stage turns a
|
||||
#: half-turn either way, the pitch stage a full turn. These are the limits a
|
||||
#: pose move is checked against before any axis is commanded.
|
||||
#: Stage envelope. Yaw turns ±180. Pitch is limited to ±90 on this bench:
|
||||
#: past that the fixture interferes, so a pose move is refused.
|
||||
"max_yaw_deg": 180.0,
|
||||
"max_pitch_deg": 360.0,
|
||||
"max_pitch_deg": 90.0,
|
||||
}
|
||||
|
||||
|
||||
@@ -220,21 +219,20 @@ def default_preferences() -> dict[str, Any]:
|
||||
#: x/y/z translation along the table's axes and a yaw about its z. **The z
|
||||
#: is the mounting plate**, so the plate is not a setting of its own — it
|
||||
#: lifts the sensing face and does nothing else, and two fields for one
|
||||
#: number drift apart.
|
||||
"finger_sensor_offset_mm": [0.0, 0.0, 0.0],
|
||||
#: number drift apart. The bench plate under the finger is 8 mm thick.
|
||||
"finger_sensor_offset_mm": [0.0, 0.0, 8.0],
|
||||
"finger_sensor_yaw_deg": 0.0,
|
||||
#: Where the tool is, in the table frame, mm. Straight above the table
|
||||
#: origin unless the real machine says otherwise; every XY move is measured
|
||||
#: against it, so it is what makes the reported move match the bench. A tool
|
||||
#: tip offset belongs here — it used to be a separate field, and having two
|
||||
#: of them is what let the picture and the numbers disagree.
|
||||
#: Where the tool is, in the table frame, mm. A tool-tip offset belongs
|
||||
#: here. The bench X shift is the initial position, not this number.
|
||||
"finger_tool_xy_mm": [0.0, 3.0],
|
||||
#: Stage travel, degrees. Confirmed at the bench: the vertical stage turns
|
||||
#: a full half-turn either way (±180), and the horizontal stage turns
|
||||
#: continuously. An earlier value of 90 was wrong and made half the patch
|
||||
#: look unreachable when it is not.
|
||||
#: Where 「回初始位」 parks the table, mm. X is 1 mm toward the negative
|
||||
#: direction. Y is 15.0 mm forward of the old zero.
|
||||
"table_initial_x_mm": -1.0,
|
||||
"table_initial_y_mm": 15.0,
|
||||
#: Stage travel, degrees. Yaw turns ±180. Pitch is held to ±90 because the
|
||||
#: fixture interferes outside that.
|
||||
"finger_yaw_limit_deg": 180.0,
|
||||
"finger_pitch_limit_deg": 360.0,
|
||||
"finger_pitch_limit_deg": 90.0,
|
||||
}
|
||||
|
||||
|
||||
@@ -277,6 +275,10 @@ def load_preferences() -> dict[str, Any]:
|
||||
offset.append(0.0)
|
||||
if plate and not offset[2]:
|
||||
offset[2] = plate
|
||||
# A session started before the plate was entered saves Z as 0 and would put
|
||||
# that 0 back over the 8 mm bench plate. Keep a stored non-zero thickness.
|
||||
if not offset[2]:
|
||||
offset[2] = float(defaults["finger_sensor_offset_mm"][2])
|
||||
prefs["finger_sensor_offset_mm"] = offset
|
||||
|
||||
# The tool tip offset used to be a vector added to the reported coordinates
|
||||
@@ -299,6 +301,27 @@ def load_preferences() -> dict[str, Any]:
|
||||
if value and not tool[index]:
|
||||
tool[index] = value
|
||||
prefs["finger_tool_xy_mm"] = tool
|
||||
# Closing AutoCal writes the whole in-memory file back. A session that started
|
||||
# on the previous initial position would otherwise put that old Y over this one.
|
||||
prefs["table_initial_x_mm"] = defaults["table_initial_x_mm"]
|
||||
prefs["table_initial_y_mm"] = defaults["table_initial_y_mm"]
|
||||
# 360° was the old pitch envelope. This fixture interferes outside ±90, and a
|
||||
# session started on 360 would write that envelope back on close.
|
||||
limits = prefs.get("safety_limits")
|
||||
if isinstance(limits, dict):
|
||||
try:
|
||||
if float(limits.get("max_pitch_deg")) == 360.0:
|
||||
limits["max_pitch_deg"] = 90.0
|
||||
except (TypeError, ValueError):
|
||||
limits["max_pitch_deg"] = 90.0
|
||||
try:
|
||||
if float(prefs.get("finger_pitch_limit_deg")) == 360.0:
|
||||
prefs["finger_pitch_limit_deg"] = 90.0
|
||||
except (TypeError, ValueError):
|
||||
prefs["finger_pitch_limit_deg"] = 90.0
|
||||
# Yaw travel is ±180. The same-sign pitch solution sits near ±150° of yaw,
|
||||
# and a stored ±90 drops it, leaving the opposite pitch sign on one side.
|
||||
prefs["finger_yaw_limit_deg"] = float(defaults["finger_yaw_limit_deg"])
|
||||
# A hand-edited task number must not reach the controller as typed.
|
||||
prefs["bas_task"] = clamp_bas_task(prefs.get("bas_task"))
|
||||
prefs = _migrate_axis_roles(prefs)
|
||||
@@ -333,6 +356,11 @@ def _migrate_axis_roles(prefs: dict[str, Any]) -> dict[str, Any]:
|
||||
merged[role] = int(value)
|
||||
except (TypeError, ValueError):
|
||||
continue
|
||||
# The first bench note had these two drives swapped. A session that still
|
||||
# has that pair would otherwise put it back on close.
|
||||
if merged.get("pitch") == 2 and merged.get("yaw") == 3:
|
||||
merged["pitch"] = 3
|
||||
merged["yaw"] = 2
|
||||
prefs["axis_roles"] = merged
|
||||
return prefs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user