TinyG icon indicating copy to clipboard operation
TinyG copied to clipboard

Probe report incorrect in inch mode

Open DanalEstes opened this issue 9 years ago • 6 comments

There is a difference in behavior if 'prb' reports when in G21 mm vs. G20 inch mode.

G38.2 results in a probe report such as:

{"r":{"prb":{"e":1,"x":0.000,"y":0.000,"z":0.259,"a":0.000,"b":0.000,"c":0.000}},"f":[1,0,0,9523]}

Coordinates in this report should be G53 absolute machine coordinates. Following the TinyG "canonical units" philosophy, they should always be in mm. The report should be the coordinates at the moment of contact, and the machine should stop.

However, it appears that the current behavior of the TinyG 440.14 edge branch is different when in inch vs mm. Consider the following, taking particular note of the posz: and the coor:0 and coor:2 reports immediately following the prb report:

G21
G38.2 Z-200 F0.1
{"r":{},"f":[1,0,17,76]}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":28.000,"vel":0.00,"unit":1,"stat":3,"feed":0.10,"coor":2,"momo":0,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":28.000,"vel":0.00,"unit":1,"stat":7,"feed":0.10,"coor":0,"momo":0,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"qr":32}
{"qr":31}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":28.000,"vel":0.10,"unit":1,"stat":7,"feed":0.10,"coor":0,"momo":1,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":27.999,"vel":0.10,"unit":1,"stat":7,"feed":0.10,"coor":0,"momo":1,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":27.999,"vel":0.10,"unit":1,"stat":7,"feed":0.10,"coor":0,"momo":1,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":27.999,"vel":0.10,"unit":1,"stat":7,"feed":0.10,"coor":0,"momo":1,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":27.998,"vel":0.10,"unit":1,"stat":7,"feed":0.10,"coor":0,"momo":1,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":27.998,"vel":0.10,"unit":1,"stat":7,"feed":0.10,"coor":0,"momo":1,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"r":{"prb":{"e":1,"x":0.000,"y":0.000,"z":27.998,"a":0.000,"b":0.000,"c":0.000}},"f":[1,0,0,5595]}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":27.998,"vel":0.10,"unit":1,"stat":7,"feed":0.10,"coor":0,"momo":1,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":27.998,"vel":0.00,"unit":1,"stat":3,"feed":0.10,"coor":2,"momo":4,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"qr":32}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":27.998,"vel":0.00,"unit":1,"stat":3,"feed":0.10,"coor":2,"momo":4,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
G20
{"r":{},"f":[1,0,4,4397]}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":1.102,"vel":0.00,"unit":0,"stat":3,"feed":0.00,"coor":2,"momo":4,"plan":0,"path":2,"gc":"G20","dist":0}}
 G38.2 Z-200 F0.1
{"r":{},"f":[1,0,17,76]}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":1.102,"vel":0.00,"unit":0,"stat":3,"feed":0.10,"coor":2,"momo":4,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":1.102,"vel":0.00,"unit":0,"stat":7,"feed":0.10,"coor":0,"momo":4,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"qr":32}
{"qr":31}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":1.102,"vel":0.10,"unit":0,"stat":7,"feed":0.10,"coor":0,"momo":1,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":1.101,"vel":0.10,"unit":0,"stat":7,"feed":0.10,"coor":0,"momo":1,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":1.101,"vel":0.10,"unit":0,"stat":7,"feed":0.10,"coor":0,"momo":1,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":1.101,"vel":0.10,"unit":0,"stat":7,"feed":0.10,"coor":0,"momo":1,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":1.100,"vel":0.10,"unit":0,"stat":7,"feed":0.10,"coor":0,"momo":1,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":1.100,"vel":0.01,"unit":0,"stat":7,"feed":0.10,"coor":0,"momo":1,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"r":{"prb":{"e":1,"x":0.000,"y":0.000,"z":1.100,"a":0.000,"b":0.000,"c":0.000}},"f":[1,0,0,6271]}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":0.043,"vel":0.01,"unit":0,"stat":7,"feed":0.10,"coor":0,"momo":1,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":0.043,"vel":0.00,"unit":0,"stat":3,"feed":0.10,"coor":2,"momo":4,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}
{"qr":32}
{"sr":{"line":0,"posx":0.000,"posy":0.000,"posz":0.043,"vel":0.00,"unit":0,"stat":3,"feed":0.10,"coor":2,"momo":4,"plan":0,"path":2,"gc":"G38.2 Z-200 F0.1","dist":0}}

mm mode is behaving correctly.

inch mode does not switch to unit:1 during the regular sr, even though the actual pos reports are clearly in mm, and it appears that the final result in the prb and all following sr are not correct.

DanalEstes avatar Jun 25 '15 03:06 DanalEstes

I created a pull request and therefore closed this... I think that caused it to go un-noticed. Therefore, reopening.

This is fixed in pull #136

DanalEstes avatar Jul 02 '15 10:07 DanalEstes

Clarified title.

DanalEstes avatar Jul 02 '15 10:07 DanalEstes

OK. Noted as well.

aldenhart avatar Jul 04 '15 20:07 aldenhart

Digging into this now.

giseburt avatar Jul 09 '15 21:07 giseburt

Ok, the meat of this problem is that at the end of the probe cycle it calls a function that returns the values in "units" (inches or mm), and passes those results to a function that assumes mm (which all internal values are stored in). I believe that it needs to use a different (very similarly named) function that simply returns the values in mm.

I'm not sure that that there's not more to it at the moment. Once I am sure I'll put in a fix.

Thank you @DanalEstes for finding this and digging in enough to attempt a fix. I'm sorry I can't pull it in as-is.

giseburt avatar Jul 09 '15 22:07 giseburt

No problem! Absolutely no expectation on my part that my very first effort would be pulled as-is. :-)

On Thu, Jul 9, 2015 at 5:33 PM, Rob Giseburt [email protected] wrote:

Ok, the meat of this problem is that at the end of the probe cycle it calls a function that returns the values in "units" (inches or mm), and passes those results to a function that assumes mm (which all internal values are stored in). I believe that it needs to use a different (very similarly named) function that simply returns the values in mm.

I'm not sure that that there's not more to it at the moment. Once I am sure I'll put in a fix.

Thank you @DanalEstes https://github.com/DanalEstes for finding this and digging in enough to attempt a fix. I'm sorry I can't pull it in as-is.

— Reply to this email directly or view it on GitHub https://github.com/synthetos/TinyG/issues/135#issuecomment-120166081.

DanalEstes avatar Jul 09 '15 22:07 DanalEstes