add two-pass soft homing for X/Y and skip rehome on subsequent loading position presses#13
Open
hongquanli wants to merge 1 commit into
Open
add two-pass soft homing for X/Y and skip rehome on subsequent loading position presses#13hongquanli wants to merge 1 commit into
hongquanli wants to merge 1 commit into
Conversation
…g position presses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a two-pass (coarse → back off → slow) homing routine for the X and Y axes to eliminate run-to-run jitter caused by speed-dependent limit-switch trip hysteresis. The "Go to Loading Position" button now only triggers homing on the first press of a session; subsequent presses move via absolute coordinates, avoiding plate-to-plate calibration drift.
What's changed
software/control/_def.py— 5 newMachineConfigurationconstants for the soft-homing fine pass:SOFT_HOMING_VELOCITY_X/Y_mm(4.0 mm/s),SOFT_HOMING_ACCELERATION_X/Y_mm, andSOFT_HOMING_BACK_OFF_MM(3.0 mm).software/control/microcontroller.pysoft_home_x()/soft_home_y()/soft_home_xy()methods. Each performs coarse-home → back-off → lowered MAX_VELOCITY → fine-home, with atry/finallycovering everything after the velocity is lowered so any timeout in the fine pass still restores the original values.connection_session_idcounter, incremented insideattempt_connection()on every successful (re)connect. Used by the navigation layer to invalidate cached "homed" state across firmware position-counter resets.set_max_velocity_accelerationso the soft-home save/restore uses the actually-programmed values (not theMACHINE_CONFIGdefaults, which may have been overridden by other code).software/control/core/navigation.pyhas_been_homedproperty: True iff a soft-home was committed in the current microcontroller session (compares_homed_at_session_idagainst the microcontroller's currentconnection_session_id).loading_position_entergains awith_homingkwarg. Withwith_homing=False, the function moves via absolute coordinates without re-homing, but refuses to run unlesshas_been_homedis True (raisesRuntimeError).wait_till_operation_is_completedauto-recovers from timeouts by callingattempt_connection(), which bumpsconnection_session_id. If a reconnect happens mid-homing, the homed-state commit is skipped so the next attempt re-homes from scratch.home_x()/home_y()calls in the loading-position flow with the newsoft_home_*variants.software/control/gui_hcs.py— "Go to Loading Position" button passeswith_homing=not has_been_homed. First press of the session homes; subsequent presses skip.Why
Mechanical limit switches have speed-dependent trip hysteresis: the position at which they activate depends on the approach velocity. The pre-existing single-pass home approached the switch at full MAX_VELOCITY, which introduced run-to-run home-position jitter. Over a session of many plate exchanges, this caused visible plate-to-plate calibration drift.
The two-pass approach (coarse pass at MAX_VELOCITY to find the switch quickly, then a slow second pass for a velocity-independent trip point) removes that dependence. The session-aware skip-rehome removes the trip exposure entirely once a clean home is established within a session.
Test plan
homing - in loading position).no-homing - in loading position, fast move via absolute coordinates).