From: Joseph Coffland Date: Thu, 14 Nov 2019 00:26:25 +0000 (-0800) Subject: Changed default zero-backoff and latch-backoff. Added max-deviation. Fix far view... X-Git-Url: https://git.buildbotics.com/?a=commitdiff_plain;h=be56a126307f97183c4440c24f5478c9b85e4cde;p=bbctrl-firmware Changed default zero-backoff and latch-backoff. Added max-deviation. Fix far view of 3D preview. Prevent more than one firmware update. --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 367853b..30be9e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ Buildbotics CNC Controller Firmware Changelog - Show latest GCode message in ``Message`` field on CONTROL page. - Marked several GCodes supported in cheat sheet. - Solved planner lookahead failure for most reasonable cases. + - Prevent cutting off distant parts of 3D path view. + - Raised default ``latch-backoff`` to 100mm and ``zero-backoff`` to 5mm. + - Added ``max-deviation`` option. ## v0.4.11 - Don't reset global offsets on M2. diff --git a/scripts/update-bbctrl b/scripts/update-bbctrl index 06433ed..ad4023b 100755 --- a/scripts/update-bbctrl +++ b/scripts/update-bbctrl @@ -1,22 +1,27 @@ #!/bin/bash -UPDATE=/var/lib/bbctrl/firmware/update.tar.bz2 +( + flock -n 9 -if [ ! -e "$UPDATE" ]; then - echo "Missing $UPDATE" - exit 1 -fi + UPDATE=/var/lib/bbctrl/firmware/update.tar.bz2 -systemctl stop bbctrl + if [ ! -e "$UPDATE" ]; then + echo "Missing $UPDATE" + exit 1 + fi -rm -rf /tmp/update -mkdir /tmp/update -cd /tmp/update + systemctl stop bbctrl -LOG=/var/log/bbctrl.$(date +%Y%m%d-%H%M%S).install -tar xf "$UPDATE" -cd * -./scripts/install.sh "$*" 2>&1 > $LOG + rm -rf /tmp/update + mkdir /tmp/update + cd /tmp/update -cd - -rm -rf /tmp/update $UPDATE + LOG=/var/log/bbctrl.$(date +%Y%m%d-%H%M%S).install + tar xf "$UPDATE" + cd * + ./scripts/install.sh "$*" 2>&1 > $LOG + + cd - + rm -rf /tmp/update $UPDATE + +) 9> /var/lock/bbctrl.update.lock diff --git a/src/avr/src/exec.c b/src/avr/src/exec.c index 95979e8..c8f9314 100644 --- a/src/avr/src/exec.c +++ b/src/avr/src/exec.c @@ -224,7 +224,9 @@ stat_t exec_segment(float time, const float target[], float vel, float accel, ex.seg.cb = ex.cb; ex.cb = _segment_exec; - if (!ex.seg.cb) seek_end(); + // TODO To be precise, seek_end() should not be called until the current + // segment has completed execution. + if (!ex.seg.cb) seek_end(); // No callback when at line end return _segment_exec(); } diff --git a/src/js/axis-vars.js b/src/js/axis-vars.js index 40ddf43..bf2096b 100644 --- a/src/js/axis-vars.js +++ b/src/js/axis-vars.js @@ -72,8 +72,8 @@ module.exports = { var pathMin = this.state['path_min_' + axis]; var pathMax = this.state['path_max_' + axis]; var pathDim = pathMax - pathMin; - var under = pathMin - off < min; - var over = max < pathMax - off; + var under = pathMin + off < min; + var over = max < pathMax + off; var klass = (homed ? 'homed' : 'unhomed') + ' axis-' + axis; var state = 'UNHOMED'; var icon = 'question-circle'; @@ -108,12 +108,12 @@ module.exports = { case 'OVER': title = 'Tool path would move ' + - this._length_str(pathMax - off - max) + ' beyond axis bounds.'; + this._length_str(pathMax + off - max) + ' beyond axis bounds.'; break; case 'UNDER': title = 'Tool path would move ' + - this._length_str(min - pathMin + off) + ' below axis bounds.'; + this._length_str(min - pathMin - off) + ' below axis bounds.'; break; case 'NO FIT': @@ -136,7 +136,7 @@ module.exports = { } return { - pos: abs + off, + pos: abs - off, abs: abs, off: off, min: min, diff --git a/src/js/path-viewer.js b/src/js/path-viewer.js index 2d9a6d5..3cd1d01 100644 --- a/src/js/path-viewer.js +++ b/src/js/path-viewer.js @@ -251,8 +251,8 @@ module.exports = { var max = new THREE.Vector3(); for (var axis of 'xyz') { - min[axis] = this[axis].min + this[axis].off; - max[axis] = this[axis].max + this[axis].off; + min[axis] = this[axis].min - this[axis].off; + max[axis] = this[axis].max - this[axis].off; } var bounds = new THREE.Box3(min, max); @@ -283,7 +283,7 @@ module.exports = { this.enabled = true; // Camera - this.camera = new THREE.PerspectiveCamera(45, 4 / 3, 1, 1000); + this.camera = new THREE.PerspectiveCamera(45, 4 / 3, 1, 10000); // Lighting this.ambient = new THREE.AmbientLight(0xffffff, 0.5); diff --git a/src/pug/templates/settings-view.pug b/src/pug/templates/settings-view.pug index dd56872..0ce3f10 100644 --- a/src/pug/templates/settings-view.pug +++ b/src/pug/templates/settings-view.pug @@ -39,3 +39,25 @@ script#settings-view-template(type="text/x-template") h2 GCode templated-input(v-for="templ in template.gcode", :name="$key", :model.sync="config.gcode[$key]", :template="templ") + + fieldset + h2 Path Accuracy + templated-input(name="max-deviation", + :model.sync="config.settings['max-deviation']", + :template="template.settings['max-deviation']") + + p. + Lower #[tt max-deviation] to follow the programmed path more precisely + but at a slower speed. + + p. + In order to improve traversal speed, the path planner may merge + consecutive moves or round off sharp corners if doing so would deviate + from the program path by less than #[tt max-deviation]. + + - var base = '//linuxcnc.org/docs/html/gcode/g-code.html' + p. + GCode commands + #[a(href=base + "#gcode:g61-g61.1", target="_blank") G61, G61.1] and + #[a(href=base + "#gcode:g64", target="_blank") G64] also affect path + planning accuracy. diff --git a/src/py/bbctrl/Mach.py b/src/py/bbctrl/Mach.py index 689ffd4..acaf8a1 100644 --- a/src/py/bbctrl/Mach.py +++ b/src/py/bbctrl/Mach.py @@ -320,7 +320,7 @@ class Mach(Comm): self._get_cycle()) # Set the absolute position both locally and via the AVR - target = position - state.get('offset_' + axis) + target = position + state.get('offset_' + axis) state.set(axis + 'p', target) super().queue_command(Cmd.set_axis(axis, target)) diff --git a/src/py/bbctrl/Planner.py b/src/py/bbctrl/Planner.py index 0b0a7ef..623c33e 100644 --- a/src/py/bbctrl/Planner.py +++ b/src/py/bbctrl/Planner.py @@ -90,7 +90,8 @@ class Planner(): 'max-accel': state.get_axis_vector('am', 1000000), 'max-jerk': state.get_axis_vector('jm', 1000000), 'rapid-auto-off': config.get('rapid-auto-off'), - # TODO junction deviation & accel + 'max-blend-error': config.get('max-deviation'), + 'max-merge-error': config.get('max-deviation'), } if with_limits: diff --git a/src/resources/config-template.json b/src/resources/config-template.json index 0da3b9a..e16bfb8 100644 --- a/src/resources/config-template.json +++ b/src/resources/config-template.json @@ -4,6 +4,17 @@ "type": "enum", "values": ["METRIC", "IMPERIAL"], "default": "METRIC" + }, + "max-deviation": { + "help": + "Default allowed deviation from programmed path. Also see G64 & G61.", + "type": "float", + "min": 0.001, + "max": 100, + "unit": "mm", + "iunit": "in", + "scale": 25.4, + "default": 0.1 } }, "motors": { @@ -172,7 +183,7 @@ "unit": "mm", "iunit": "in", "scale": 25.4, - "default": 5, + "default": 100, "code": "lb" }, "zero-backoff": { @@ -181,7 +192,7 @@ "unit": "mm", "iunit": "in", "scale": 25.4, - "default": 1, + "default": 5, "code": "zb" } }