Changed default zero-backoff and latch-backoff. Added max-deviation. Fix far view...
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Thu, 14 Nov 2019 00:26:25 +0000 (16:26 -0800)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Thu, 14 Nov 2019 00:26:25 +0000 (16:26 -0800)
CHANGELOG.md
scripts/update-bbctrl
src/avr/src/exec.c
src/js/axis-vars.js
src/js/path-viewer.js
src/pug/templates/settings-view.pug
src/py/bbctrl/Mach.py
src/py/bbctrl/Planner.py
src/resources/config-template.json

index 367853bf55cd304919ed4546bfa3d3e6761b5613..30be9e0f1e4e8b6b971bc223fcbd2cd41078c29d 100644 (file)
@@ -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.
index 06433edd62b2459f85a8bdb4b36c3ae631cf24ca..ad4023b5fe627a0aadefd9ab136f33ef83768f62 100755 (executable)
@@ -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
index 95979e83755e3f1d138e123fed8d7938eea6397c..c8f93147da7873120767793953ad220bdee64467 100644 (file)
@@ -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();
 }
index 40ddf439ad1bd1d14cba0f7edb35b12e9d900a4f..bf2096b5af91050d5cb6a80be4e41f118cb43e77 100644 (file)
@@ -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,
index 2d9a6d5b0e6792faa8cad9f54af62c3fad153ea2..3cd1d018a36ac5a357922bc497b909d8e72f60b6 100644 (file)
@@ -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);
index dd568721bd218d8c0350276f0acb058a29f90f28..0ce3f1069ecb7b7621d1c8b9844c023dd143f71e 100644 (file)
@@ -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.
index 689ffd4a9d21e5bf5ec8134f743f3b57f31ade99..acaf8a1c1d7d031579bf1b11e511b501b372bb2e 100644 (file)
@@ -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))
 
index 0b0a7ef5cdcd0182695600345735107c5543d854..623c33ee731ea6d3a70a65e3d2abb3a3dbb52f52 100644 (file)
@@ -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:
index 0da3b9a5d649a508a0d3b860295d60e978a8daff..e16bfb8dd438d96768c0673d62446367b681733f 100644 (file)
@@ -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": {
           "unit": "mm",
           "iunit": "in",
           "scale": 25.4,
-          "default": 5,
+          "default": 100,
           "code": "lb"
         },
         "zero-backoff": {
           "unit": "mm",
           "iunit": "in",
           "scale": 25.4,
-          "default": 1,
+          "default": 5,
           "code": "zb"
         }
       }