#gage blocks and backpack packing
1 messages · Page 1 of 1 (latest)
@zenith nymph - When you're here... tell me how far you've gotten, what language we're working in, etc...
The initial request asks for pseudocode, but he did mention ATTINY85, so either pseudocode or an arduino sketch would be my first guesses.
0% real progress, and this is basically my first real electronics project, so probably best to stick with pseudocode at this point.
okay -
so here's a typical set of 88 block gage block sized I found:
9 blocks .1001 through .1009 (steps of .0001)
49 blocks .101 through .149 (steps of .001)
19 blocks .050 through .950 (steps of .050)
4 blocks 1.000 through 4.000 (steps of 1")
3 blocks .100025, .10005, .100075
4 blocks 1/16, 5/64, 3/32, 7/64
the first five sets each let you "solve" a single range of the measurement
[you cannot put three xxx's in a row in your messages]
oy
for example a.bcdNef the N can be solved by one block from the first set
@zenith nymph - do you have experience coding?
Only in gcode lol
okay - so you've got an exciting (if twisty) road ahead
first thing - you cannot use floating point for this problem!
This is because binary-floating point cannot represent these value exactly - and the whole point here is that you need exact
SO - you should compute this all in microns so that all sizes are integers.
using microns = long;
Because these blocks have a minimum size... it is going to be best to work from small to large.
hmmm maybe a round about way of doing this but I would write an excel program first, then get that to work, and then translate it over to arduino code.
This seems very workable for an excel sheet
Starrett kind of does it:
http://www.starrett-webber.com/GB49.html
something like:
bool packBlocks(microns h) {
// first set: -.----nn
switch (h % 100) {
case 0: break;
case 25: h -= 100025; break; // use 0.100025 block
case 50: h -= 100050; break;
case 75: h -= 100075; break;
default: return false; // no other values can be built
}
if (h == 0) return true;
if (h < 0) return false;
// more to come
}
Now the others don't need to be quite so "write it all out":
// second set: -:---n00
if (h % 1000 > 0) {
micons b = 100000 + (h % 1000); // use block b
h -= b;
if (h == 0) return true;
if (h < 0) return false;
}
so at each step of the process you are figuring out which block will "clear" the lower part of the remaining value, removing that block for the the height (h) to pack. If h is now zero, you are done. If h is negative, it can't be done. (You can't, for example, make a height of 0.100125).
This all works because the blocks are in "radix sets" - meaning each set covers a "radix" of the measurement
The only hitch are the four blocks at the end: 1/16, 5/64, 3/32, 7/64
-- or really in our microns universe: 62500, 78125, 93750, and 109375
The really easiest way I can think to handle these is pack without them... then pack(h - 62500) and see if that's better... then pack(h - 78125), etc....
Okay - I've blabbed alot... @zenith nymph is that making any sense?
Oopps... I'm an idiot - "micron" is explicitly metric... if you're blocks are metric, great! if they are english, then "micro" would be a better term, meaning millionth of an inch
Also - if you intend to have heights larger than 5" with this set... it is possible, but now things get ugly - since you can build up the extra inches from combos of the smaller ones.... this, in the, ultimate, gets you back to the very expensive full backpack problem. SO - unless your project really needs inputs over the range the gage block set can easily handle.... I wouldn't go there!
Yeah, this is great, thanks for going through it all.