diff --git a/extras/DuCalibrator.md b/extras/DuCalibrator.md index 1a4da2e..4d2abff 100644 --- a/extras/DuCalibrator.md +++ b/extras/DuCalibrator.md @@ -7,83 +7,44 @@ description: An OctoPrint Plugin for performing micro calibration in linear delt author: Fabio Santos license: AGPLv3 -# TODO -date: today's date in format YYYY-MM-DD, e.g. 2015-04-21 +date: 2020-06-24 homepage: https://github.com/Fabi0San/DuCalibrator source: https://github.com/Fabi0San/DuCalibrator archive: https://github.com/Fabi0San/DuCalibrator/archive/master.zip -# TODO -# Set this to true if your plugin uses the dependency_links setup parameter to include -# library versions not yet published on PyPi. SHOULD ONLY BE USED IF THERE IS NO OTHER OPTION! -#follow_dependency_links: false - -# TODO tags: -- a list -- of tags -- that apply -- to your plugin -- (take a look at the existing plugins for what makes sense here) +- delta +- calibration +- 3d +- visualization -# TODO screenshots: -- url: url of a screenshot, /assets/img/... - alt: alt-text of a screenshot - caption: caption of a screenshot -- url: url of another screenshot, /assets/img/... - alt: alt-text of another screenshot - caption: caption of another screenshot -- ... +- url: /assets/img/plugins/DuCalibrator/screenshot.png + alt: Screenshot + caption: Main calibration tab showing the full calibration workflow. -# TODO -featuredimage: url of a featured image for your plugin, /assets/img/... +compatibility: + python: ">=2.7,<4" -# TODO -# You only need the following if your plugin requires specific OctoPrint versions or -# specific operating systems to function - you can safely remove the whole -# "compatibility" block if this is not the case. +featuredimage: /assets/img/plugins/DuCalibrator/screenshot.png -compatibility: +--- - # List of compatible versions - # - # A single version number will be interpretated as a minimum version requirement, - # e.g. "1.3.1" will show the plugin as compatible to OctoPrint versions 1.3.1 and up. - # More sophisticated version requirements can be modelled too by using PEP440 - # compatible version specifiers. - # - # You can also remove the whole "octoprint" block. Removing it will default to all - # OctoPrint versions being supported. +# Delta Micro Calibrator "ΔµCalibrator" +An [OctoPrint](https://octoprint.org/) Plugin for performing micro calibration in linear delta machines. - octoprint: - - 1.2.0 +[README](https://github.com/Fabi0San/DuCalibrator/blob/master/README.md) - # List of compatible operating systems - # - # Valid values: - # - # - windows - # - linux - # - macos - # - freebsd - # - # There are also two OS groups defined that get expanded on usage: - # - # - posix: linux, macos and freebsd - # - nix: linux and freebsd - # - # You can also remove the whole "os" block. Removing it will default to all - # operating systems being supported. +## Key features: +* Automatic probing +* Calibrates up to 18 geometry parameters +* 3D visualization of probed points and estimated points after proposed calibration - os: - - linux - - windows - - macos - - freebsd +![Screenshot](/assets/img/plugins/DuCalibrator/screenshot.png) ---- +## Demo + +{% include youtube.html vid="kTJlOl7_X2M" preview="'/assets/img/plugins/DuCalibrator/screenshot.png'" %} -**TODO**: Longer description of your plugin, configuration examples etc. This part will be visible on the page at -http://plugins.octoprint.org/plugin/DuCalibrator/ +Watch it in full screen diff --git a/octoprint_DuCalibrator/static/js/DuCalCommon.js b/octoprint_DuCalibrator/static/js/DuCalCommon.js index 6c9bb17..c51276d 100644 --- a/octoprint_DuCalibrator/static/js/DuCalCommon.js +++ b/octoprint_DuCalibrator/static/js/DuCalCommon.js @@ -85,28 +85,21 @@ class ProbePoint } class CollapseControl { - constructor(id) { - this.controlElement = $(id)[0]; + constructor() { + this.Visible = ko.observable(false); } - IsCollapsed() { - return this.controlElement.classList.contains("collapsed"); - } - - Toggle() { - this.controlElement.click(); + get IsHidden() + { + return !this.Visible(); } Hide() { - if (!this.IsCollapsed()) { - this.Toggle(); - } + this.Visible(false); } Show() { - if (this.IsCollapsed()) { - this.Toggle(); - } + this.Visible(true); } } diff --git a/octoprint_DuCalibrator/static/js/DuCalMachine.js b/octoprint_DuCalibrator/static/js/DuCalMachine.js index 1c3235f..bf30c6e 100644 --- a/octoprint_DuCalibrator/static/js/DuCalMachine.js +++ b/octoprint_DuCalibrator/static/js/DuCalMachine.js @@ -127,18 +127,18 @@ class MarlinMachine extends RealMachine idsTowerAngleOffset: "XYZ", idsEndStopOffset: "XYZ", idsStepsPerUnit: "XYZ", - DiagonalRodAdjust: "MNO", + DiagonalRodAdjust: "ABC", } } - async ProbeBed(x, y) + async ProbeBed(x, y, retract) { this.IsBusy(true); const commands = [ `${this.commands.Move} Z${this.settings.SafeHeight()}`, // safe height `${this.commands.Move} X${x.toFixed(5)} Y${y.toFixed(5)}`, // position - `${this.commands.ProbeBed}` // probe + `${this.commands.ProbeBed} E${retract ? 1 : 0}` // probe ]; const response = await this.comms.Execute(commands); diff --git a/octoprint_DuCalibrator/static/js/DuCalViewModel.js b/octoprint_DuCalibrator/static/js/DuCalViewModel.js index 7cd28a5..4adf1f8 100644 --- a/octoprint_DuCalibrator/static/js/DuCalViewModel.js +++ b/octoprint_DuCalibrator/static/js/DuCalViewModel.js @@ -37,9 +37,10 @@ class DuCalibratorViewModel { this.isReadyToCalibrate = ko.observable(false); this.plotDivElement = $("#surfacePlotDiv")[0]; - this.GeometryControl = new CollapseControl("#collapseGeometryControl"); - this.PlotControl = new CollapseControl("#collapsePlotControl"); - this.CalibrationControl = new CollapseControl("#collapseCalibrationControl"); + this.GeometryControl = new CollapseControl(); + this.PlotControl = new CollapseControl(); + this.CalibrationControl = new CollapseControl(); + this.HistoryControl = new CollapseControl(); // Observable data this.currentGeometry = ()=>this.machine()?.Geometry(); @@ -213,14 +214,14 @@ class DuCalibratorViewModel { var geometry = new THREE.BufferGeometry(); var vertices = new Float32Array(probeCount * 3).fill(0); // x,y,z - geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3)); + geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3)); var probedParticles = new THREE.Points(geometry, new THREE.PointsMaterial({ color: 0xff0000, size: 5, sizeAttenuation: true, transparent: true, opacity: 1 })); probedParticles.geometry.setDrawRange(0, 0); scene.add(probedParticles); var correctedGeometry = new THREE.BufferGeometry(); var correctedVertices = new Float32Array(probeCount * 3).fill(0); // x,y,z - correctedGeometry.addAttribute('position', new THREE.BufferAttribute(correctedVertices, 3)); + correctedGeometry.setAttribute('position', new THREE.BufferAttribute(correctedVertices, 3)); var correctedParticles = new THREE.Points(correctedGeometry, new THREE.PointsMaterial({ color: 0x00bb00, size: 5, sizeAttenuation: true })); correctedParticles.geometry.setDrawRange(0, 0); scene.add(correctedParticles); @@ -340,14 +341,13 @@ class DuCalibratorViewModel { zScale: 1, normalizeTo: radius / 3 }; - + + this.PlotControl.Show(); this.plot = this.preparePlot( this.plotDivElement, radius, this.probePointCount()); - this.PlotControl.Show(); - var points = DuCalUtils.GetSpiralPoints(this.probePointCount(), this.probeRadius()); for(const point of points) { @@ -363,7 +363,7 @@ class DuCalibratorViewModel { try { - const probe = await this.machine().ProbeBed(point[0],point[1]); + const probe = await this.machine().ProbeBed(point[0],point[1], point === points[points.length-1]); if(probe) this.logProbePoint(probe[0], probe[1], probe[2]); diff --git a/octoprint_DuCalibrator/templates/Calibration.jinja2 b/octoprint_DuCalibrator/templates/Calibration.jinja2 index 74dc031..e9e3c4d 100644 --- a/octoprint_DuCalibrator/templates/Calibration.jinja2 +++ b/octoprint_DuCalibrator/templates/Calibration.jinja2 @@ -10,11 +10,12 @@

- - {{ _('Calibration') }} + + + {{ _('Calibration') }}

-
+
Parameter
diff --git a/octoprint_DuCalibrator/templates/DuCalibrator_settings.jinja2 b/octoprint_DuCalibrator/templates/DuCalibrator_settings.jinja2 index 3f5bdd5..ac3b22c 100644 --- a/octoprint_DuCalibrator/templates/DuCalibrator_settings.jinja2 +++ b/octoprint_DuCalibrator/templates/DuCalibrator_settings.jinja2 @@ -30,7 +30,7 @@ mm
- Safe height that we can travel from probe point to probe point without dragging the probe across the bed. + Safe height that the nozzle can travel from probe point to probe point without dragging the probe across the bed. Should be bigger than your probe z offset.
diff --git a/octoprint_DuCalibrator/templates/DuCalibrator_tab.jinja2 b/octoprint_DuCalibrator/templates/DuCalibrator_tab.jinja2 index 9a8d7ac..3400859 100644 --- a/octoprint_DuCalibrator/templates/DuCalibrator_tab.jinja2 +++ b/octoprint_DuCalibrator/templates/DuCalibrator_tab.jinja2 @@ -38,3 +38,8 @@
+ + \ No newline at end of file diff --git a/octoprint_DuCalibrator/templates/Geometry.jinja2 b/octoprint_DuCalibrator/templates/Geometry.jinja2 index 2b1b156..91b7851 100644 --- a/octoprint_DuCalibrator/templates/Geometry.jinja2 +++ b/octoprint_DuCalibrator/templates/Geometry.jinja2 @@ -1,9 +1,11 @@ +

- + + {{ _('Current Geometry') }}

-
+
Parameter
@@ -63,3 +65,4 @@
+
diff --git a/octoprint_DuCalibrator/templates/History.jinja2 b/octoprint_DuCalibrator/templates/History.jinja2 index f3207e0..4bda29d 100644 --- a/octoprint_DuCalibrator/templates/History.jinja2 +++ b/octoprint_DuCalibrator/templates/History.jinja2 @@ -1,9 +1,9 @@

- + {{ _('Probing history') }}

-
+
diff --git a/octoprint_DuCalibrator/templates/Instructions.md b/octoprint_DuCalibrator/templates/Instructions.md index 6e65f16..d8fbd0e 100644 --- a/octoprint_DuCalibrator/templates/Instructions.md +++ b/octoprint_DuCalibrator/templates/Instructions.md @@ -21,11 +21,12 @@ Set the probing parameters. * Start by running with the simulated printer first to see how things work, it won't send anything to your machine. * A repeatable probe is essential. -* Repeatable end stops are very important, stepper phase homing is ideal. (I've recently added that to Marlin) +* Repeatable end stops are very important, stepper phase homing is ideal. (I've [recently added that to Marlin](https://github.com/MarlinFirmware/Marlin/pull/17299), look for TMC_HOME_PHASE) +* Precision of measurements is also important, Marlin's default 2 fractional digits are not enough, use SERIAL_FLOAT_PRECISION >=4 (Also [recently added to Marlin](https://github.com/MarlinFirmware/Marlin/pull/18367) bugfix branch) * The bed must be very flat, borosilicate, or aluminum with fused pcb, or pcb should work fine, magnet mats and textured covers may introduce too much fluctuation. * Tune down the max acceleration for best repeatability. * Some geometry factors may be dependent or correlated so they can't be calibrated together, the ui will try to enforce what is possible. -* Not all firmware flavors support individual adjustment for arm lengths and tower radius, some don't support automated setting of them and need to recompile. +* Not all firmware flavors support individual adjustment for arm lengths and tower radius, some don't support automated setting of them and need to recompile. (M665 ABC [recently added to Marlin](https://github.com/MarlinFirmware/Marlin/pull/18423) bugfix branch.) * More points will make calibration to offset probe noise and converge faster, 7 is too little, 50 is a good number, 500 things start to get slow, 5000 will take a while to complete and not be much better than 500. * When probing a flat target, steps per unit errors are ambiguous to radius and arm length. I suggest you use a machinist dial to calibrate steps per unit then calibrate the other geometry factors. * Belts significantly stretch and shrink with room temperature and humidity fluctuations, radius and arms lentgth won't change significantly, so if you see a drift on your bed flatness you can calibrate steps per unit daily without touching factors you know didn't change. diff --git a/octoprint_DuCalibrator/templates/Probing.jinja2 b/octoprint_DuCalibrator/templates/Probing.jinja2 index 718f9ff..e0d080a 100644 --- a/octoprint_DuCalibrator/templates/Probing.jinja2 +++ b/octoprint_DuCalibrator/templates/Probing.jinja2 @@ -1,3 +1,4 @@ +

- + {{ _('Probing') }}

-
+
@@ -36,3 +37,4 @@
+
diff --git a/setup.py b/setup.py index e319e48..c1733dd 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ plugin_name = "Delta Micro Calibrator" # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module -plugin_version = "1.0.3" +plugin_version = "1.0.4" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module