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 @@