[grbl Issue#1624] Soft limits do not prevent contact with limit switch.

未分类 bolang 6个月前 (10-14) 41次浏览

Issue #1624 | 状态: 已关闭 | 作者: jyelon | 创建时间: 2020-04-23


So the way GRBL implements soft limits, they don’t prevent the machine from hitting the limit switches. Good soft limits should prevent contact with the switches.

Currently, soft limits allow movement within the rectangle MPOS:(0,0,0) to MPOS:(-$130,-$131,-$132). Any attempt to move outside of that rectangle will trigger a soft limit error.

Unfortunately, that rectangle is always pressed right against the homing switches. For example, on my machine, when it homes, sets MPOS:(0,0,0) right up against the limit switches. So therefore, moving to MPOS:(0,0,0) triggers the limit switches again.

Ideally, what we would want is for the soft limits to respect the $27 back-off distance. The soft limits should prevent the machine from getting any closer to the hard limits than the back-off distance.

Interestingly, there’s a #define in config.h that changes how homing behavior works: HOMINGFORCESET_ORIGIN. If you set this flag, then the origin MPOS:(0,0,0) is initialized AFTER the machine has applied the back-off setting in $27. This makes soft limits work as expected! In this mode, the soft limits really do prevent contact with the limit switches.

I’ve recompiled my GRBL to use this flag. But it would be nice if soft-limits worked out of the box.


评论 (2)

#1 – jyelon 于 2020-04-23

I was looking into this matter a little deeper. Here’s some homing code from limits.c:


#ifdef HOMINGFORCESET_ORIGIN
setaxisposition = 0;
#else
if ( bitistrue(settings.homingdir_mask,bit(idx)) ) {
setaxisposition = lround((settings.maxtravel[idx]+settings.homingpulloff)*settings.stepspermm[idx]);
} else {
setaxisposition = lround(-settings.homingpulloff*settings.stepsper_mm[idx]);
}
#endif

So the important thing to remember about this code: the machine origin is ALSO one of the soft limits. Wherever you put the machine origin, you also put one of the soft limits. It’s therefore essential to put the machine origin wherever you want the soft limit to be.

In case 1, the machine origin (and hence soft limit) is placed at the backoff position. In case 3, the machine origin (and hence soft limit) is placed right up against the limit switches. That’s probably only a millimeter of difference, but it means that in case 1, the soft limits really do prevent contact with the limit switches, and in case 3, they don’t.

It’s obvious from looking at the code that somebody deliberately coded case 1 and case 3 to be different from each other. But why? I just don’t understand why you would sometimes want to put the soft limit at the backoff position, and at other times put the soft limit in direct contact with the switch. It seems to me that only one of those could be right.


#2 – jyelon 于 2020-04-24

Ah, crap, I just realized this is a dead repository for GRBL. Closing issue.


原始Issue: https://github.com/grbl/grbl/issues/1624

喜欢 (0)