Forced averaging for M558



  • Hi,

    I would like to see an option for M558 to force the averaging of a fixed number of probes.

    No checking for consecutive readings, just probe A times and average them all.

    Perhaps some special value for for S could be used to enable this mode?

    Thanks.

    Frederick



  • @fcwilt I guess you want this feature because of your other post where you noticed that the average of all readings was not being done as documented. Please see my follow up post, I don't think this is really necessary if that one would be being honored, right?



  • @token47 said in Forced averaging for M558:

    @fcwilt I guess you want this feature because of your other post where you noticed that the average of all readings was not being done as documented. Please see my follow up post, I don't think this is really necessary if that one would be being honored, right?

    The current approach will stop probing if two readings are within the range defined by the S parameter.

    Even with S = 0.00 two identical readings (which happens) will stop the probing.

    I would like to be able to force taking a fixed number of readings and simply average them, regardless of any consecutive values.

    I think a simple approach might be to treat S = 0.00 as a special case and use that to force the averaging.

    Thanks.

    Frederick



  • @fcwilt I think the current way of measuring the G31 Z height is like pre-averaging, since you're taking several results from your probe, averaging them together, and then the A and S values work to say if you get a result within tolerance of the G31 value, you're good to go. I'm not sure what you gain by averaging the values at print time. Getting two consecutive values would indicate that it's closer to the true height than an average would be, no?

    I'm not disagreeing with your request, just trying to understand the nature of it.



  • @phaedrux
    I wrote a simple macro to do ten single probes.

    So lets assume the results were:

    1 1 2 2 2 2 2 2 2 2

    Currently, using A=10 and S=0.00, the first two readings of 1 and 1 would stop the probing and use 1 as the value.

    However the average of the ten readings is 1.8 - quite a difference from 1.

    I may be wrong but it seems to me that creating the mesh height map would benefit from averaging.

    Frederick



  • Does your macro allow you to reset Z0 by touching nozzle to bed in between each probe?

    In your example of 1s and 2s, if I had a result like that during the G30 S-1 measurements I would rather use the mode value of 2 instead of the average of 1.8. That way as long as the A and S values get me within plus or minus 0.01 of 2 I would be pretty happy.

    How much does your probe vary in repeatability? I think I may have asked that before... I think if your probe repeatability is very poor and inconsistent it would be better to improve that rather than average it.

    The probe trigger height should be a fairly consistent value since it's a distance measurement. If the probe isn't triggering consistently, replace the probe, because even an average could be quite off.

    The point of the G30 S-1 measuring is to give you a good consistent trigger height, either by average or mode. M558 is just setting the tolerance for getting close to that average.

    0_1536705288563_cc5e6eae-42b0-42fb-842d-5e2369e74848-image.png

    M558 P9 H3 F100 T6000 A5 R0.3 S0.005 B1

    So if I get two probe results within 0.005 of 2.025 I'm pretty happy and that's enough to get a good consistent first layer height.

    How far off is your probe? Is it a result of probe inconsistency, or delta calibration? I'm not a delta user, so I'm useless there, but I understand it can be quite persnickety.



  • I guess the best way to achieve that is to control how many readings need to be in range (default 2, but you could increase to the same number of max readings then you would force all of them to be averaged).



  • @token47 said in Forced averaging for M558:

    I guess the best way to achieve that is to control how many readings need to be in range (default 2, but you could increase to the same number of max readings then you would force all of them to be averaged).

    I like that. Even more versatile then what I was thinking of.

    I began thinking that perhaps there is some statistical function better than averaging for trying to obtain the most accurate result?

    Statistics is not my field of expertise.

    Frederick



  • I'm not a stats guy either but I think with a large enough set of values the mode would be the most accurate because it's the value that happens the most often. But that's going to depend a lot on the repeatability of the probe.


  • administrators

    @fcwilt said in Forced averaging for M558:

    Hi,

    I would like to see an option for M558 to force the averaging of a fixed number of probes.

    No checking for consecutive readings, just probe A times and average them all.

    Perhaps some special value for for S could be used to enable this mode?

    Thanks.

    Frederick

    Yes, that should be straightforward to implement. Please remind me a week from now and I'll see if I can implement it in the 2.02 release.



  • @dc42 I think averaging is the way it is handled in Marlin and Repetier (just guessing though). As I get bad repeatability as well - partly due to https://github.com/dc42/RepRapFirmware/issues/210

    As a reminder, I opened an issue on github


 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.