Scale the internal mcu values to units of milli-hz to reduce the
chance of roundoff error in the internal calculations.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
There have been some reports of the sanity check throwing an error
when the bed is depressed just under 50um. For now, increase the
valid depress range to avoid unnecessary errors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Implement some basic checks on the tap results and report an error if
the results look obviously incorrect.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Continue to run least squares evaluations until the uncertainty range
is within 50 nanometers (reduced from 250nm).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Directly calculate the evaluated matrices instead of using
mat_mat_mult() and mat_transp().
Cache the intermediate summations to improve processing when using
similar z guesses.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the least squares solution code in the local mathutil.py module
instead of using the numpy package. This allows users to utilize the
"tap" functionality without requiring additional package installation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use a different base frequency and base z value for the internal "tap"
least squares analysis to improve the numerical stability of the
calculations.
Rework the formulas being solved so that only the depressed slope
calculation is relative to the estimated z contact point. This
results in less variables that are dependent on the z contact.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support exporting the current SOS filter size from the DigitalFilter()
class. Pass that value to the MCU_SosFilter() class to avoid
allocating unneccessary MCU memory (previously 5 entries were
allocated while only 3 are currently needed).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add new add_lowpass(), add_highpass(), add_notch(), and
setup_initial_state() methods to DigitalFilter. Use these instead of
creating the filters from the constructor.
Also remove the unused filtfilt() method.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't calculate the nozzle/bed contact position from the descent
movement. Instead, obtain the data during the lifting movement and
determine the contact point by analyzing where the nozzle separates
from the bed.
This improves the precision and repeatability of the "tap" results.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Perform lifting at the end of EddyTap.run_probe(). This is in
preparation for performing tap analysis during retraction.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a new EddyParameterHelper to override ProbeParameterHelper.
Only use the printer.cfg lift_speed, samples, sample_retract_dist,
samples_result, samples_tolerance, and samples_tolerance_retries
settings for normal probe operations. Don't use these defaults when
using a "METHOD" set to "scan", "rapid_scan", or "tap". Each of these
probing mechanisms is distinct and it's unlikely a user could
meaningfully set a default for all of them.
Don't set sample_retract_dist when using "scan" and "rapid_scan"
modes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Theoretically a "tap" probe should detect the exact point that the
nozzle contacts the bed. In practice, however, there can be a
systemic bias that one may wish to account for. This bias may be due
to backlash, thermal expansion, a detection bias, or similar issues.
Add a new tap_z_offset config parameter to allow users to specify an
offset.
Also, update the Z_OFFSET_APPLY_PROBE command to support modifying
this value.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The config option 'z_offset' name is confusing as its behavior is
notably different from how other probe hardware uses 'z_offset'.
Rename to 'descend_z' to make its behavior more clear.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a new create_probe_result() helper function that can generate a
ProbeResult using a toolhead position and a set of probe offsets.
Use this helper in other modules.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow the "tap_threshold" to be overriden during PROBE type commands.
This makes it easier to calibrate an initial tap_threshold.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Verify no gaps at start and end of requested capture range.
Raise an error if a gap is detected.
Raise an error if not enough data collected during "tap".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Register an event handler to make sure measurements are stopped if a
gcode error occurs while using EddyScanningProbe. EddyTap and
EddyDescend use ProbeSessionHelper which already provides this
handling, but EddyScanningProbe doesn't use that wrapper so it must be
implemented manually.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 2a1027ce changed the "probe:update_results" event to take a
list, but failed to update the callers to utilize that modified list
in its results.
Change axis_twist_compensation to update all members in the list and
change the callers to use the resulting list.
Reported by @ritzi26.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
PROBE_CALIBRATE will try to adjust z_offset
Which will produce a confusing outcome and
will not do what it is supposed to do
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
To cancel out any lag, filter data on the host
Then to avoid derivatives lag,
compute central difference.
Assume that peak velocity is always the moment
right before collision happens.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use SOS filters + derivative filter to generate dF/dT on mcu.
Feed that to the MCU's trigger_analog peak detection.
Interpret peak time as a tap event
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Create the class at the start of PrinterEddyProbe and call it as
needed. This makes the class life-cycle similar to EddyDescend.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rework the internal EddyGatherSamples() class with a goal of making it
easier to add tap analysis in the future.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Remove the homing code from sensor_ldc1612.c and utilize the generic
homing support found in trigger_analog.c .
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make it possible for the probe's get_offsets() code to depend on the
parameters of the probe request. This is in preparation for eddy
"tap" support.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the low-level probe code to return ProbeResult tuples from
probe_session.pull_probed_results(). Also update callers to use the
calculated bed_xyz values found in the tuple instead of calculating
them from the probe's xyz offsets.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Return the manual probe results in a named tuple containing (bed_x,
bed_y, bed_z, test_x, test_y, and test_z) components. For a manual
probe the test_xyz will always be equal to bed_xyz, but these
components may differ when using automated z probes.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
I2C error means we don't know the sensor status.
Force data output to the host and cancel homing.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Currently, there is no way to adjust the calibration curve.
The existing z_offset infrastructure is not applicable
or disabled here.
To make it possible to fine tune calibration curve.
Reload Z_OFFSET helper for probe_eddy_current.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
A misplaced sensor or a misconfigured one
can return unreliable results.
Assist with this by refusing to use the too noisy points.
Filter noisy points by the frequency difference to noise ratio.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Separate homing operations (as called from probe:z_virtual_endstop)
from the normal probe command handling.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use the normal probe_session_start(), run_probe(),
pull_probed_results(), and end_probe_session() API from
ProbeSessionHelper. This removes the custom probing_move() callback.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the HomingViaProbeHelper() instance from ProbeSessionHelper to a
new ProbeEndstopSessionHelper class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When probing in "scan" mode, the toolhead will pause at each position,
but does not descend. This can notably reduce the total probing time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Support calculating the low-level kinematic toolhead position while
calculating the probed frequency.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>