Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Soft limits in v0.9 #226
Just experimenting with v0.9. Used it for a few simple projects (with my hand on the red button;-))
Everything looks ok, but I'm a bit confused about the soft-limits behavior. Not sure if it's a bug or intended. (maybe I do not understand the exact function of the soft-limits)
I have soft limits ($22=1) on and set the limits (max travel distance): X to 500 mm ($9 = 500), Y at 700 mm ($10 = 700) and Z at 110 mm ($11 = 110).
After power-up Grbl is in STATUS_OK and Robot in STATUS_IDLE.
Say X-work is at 220.50 and machine-X is at -220.50.
After sending G0 G91 X260 Grbl v0.9 responds with an "ALARM: Hard/soft limit MPOS?" and the robot is in STATE_ALARM. This was not expected because:
220.50 + 260 = 480.50mm X-work coordinate
none of them is greater than the 500mm X limit (travel distance).
After sending a reset (ctrl-X) Grbl responds with an "ok" (STATUS_OK), but the machine is still in STATE_ALARM. Sending "$X" gets the machine back in STATE_IDLE.
Try to get the machine moving over X so:
Send G0 G91 X260 => Alarm
Am I missing something or is it a little bug in Grbl v0.9?
@rverhag : Thanks for reporting on the soft limits. Haven't had too many people test it out and state how it works. First, it's never been tested on a mill on my end, as my machine is in storage while I've been remodeling my garage. So it will likely have oddities and bugs that I wasn't able to account for, mentally or by software testing.
Secondly, soft limits is designed to only work when homing is enabled and your machine is homed. When homed, the machine coordinates should only exist in the negative space, i.e. 0 to -max_travel for each axis. It shouldn't matter where you limit switches are. It should account for them. Then, soft limits will check for any move that is either positive or less than the -max_travel, before actually moving the machine. If it finds one, it'll alarm out. The machine should come to an immediate stop, if in cycle, or not move at all, but still retain system position.
If you don't have homing enabled or your machine isn't homed, soft limits will not work correctly. It'll just allow you to move in negative space. I probably need to create another level of system checks to automatically disable soft limits when homing is.
Thanks for the response. Tomorrow I will test again after homing. The machine was indeed not homed.
Regarding testing v0.9 :I have just finished my machine and i've started with v0.9 (I know, edge version :-) ) So far everything works just fine. Max speed X and Y at 4000 mm/min, Z at 3000. X,Y,Z acc at 60. Homing, hard limits, G10, etc. Running at a self written gui (c# based on other examples).
I will give you an update on the test tomorrow
I've just tested the soft limits on my machine. Here's an extract of the findings (chronological)
Arduino power up
soft limits initial disabled.
send G1G91X50.000Y50.000Z-20.000F500 (gentle move to work zero 50, 50, -20 relative to machine zero)
response --Idle,MPos:-49.0000,1.0000,-21.0000,WPos:383.6000,59.9000,14.0000-- (current position)
send G10 L2 P1 X-049.000 Y001.000 Z-021.000 (set workzero in G54)
Now turning on Softlimits
00384: Response =>$0=320.0000 (x, step/mm)
now trying to move 50 mm over X
reset, kill alarm
maybe -20 over X?
reset kill alarm.
Now trying to home with soft limits already enabled and not setting work zero.
send G1G91X10.000Y10.000Z-10.000F500 (gentle move to fictive work zero 10,10,-10 relative to machine zero)
send G1G91X50.000Y0Z0F500 (move 50 over X without setting zero at G54!)
send G1G91X50.000Y0Z0F500 (again 50 mm over x, so total requested travel distance over x=100)
reset, kill alarm, get status
send G1G91X49.000Y0Z0F500 (instead of X50, now X49, so total travel distance should be 99)
Finally trying to home with soft limits enabled and setting work zero at 50,40,-15 relative to home-position (machine)
Send $22=1 (to make sure )
send G10 L2 P1 X-049.000 Y-009.000 Z-016.000 (set workzero in G54)
Now trying to move 50mm over X
response ALARM: Hard/soft limit. MPos? =>by design, because machine space would become positive, but not expected because total X limit is 100
reset, kill alarm,
try moving 10mm over X
another 10mm over X
another 10mm over x
another 10mm over x
another 10mm over x
reset, kill alarm, try moving another 5mm over X (so total of 45mm from Work zero and 95mm from home)
try moving another 4.9 mm over X (total 49.9 from work zero and 99.9 from home)
reset, kill alarm.
try moving 4 mm over X (total 49 from work and 99mm from home)
As you stated, the machine coordinates should only exists in the negative space so the soft limits works by design (not possible to move beyond Mx0),
EDIT => The next line is nonsense but I let it stand for completeness of the thread
"but homing on my machine is always in the lower left corner (as worldcoordinates in Autocad) and the parking place after finishing a job is nearby the lowerleft corner. After power-up the homingdistance is at a relative small distance, so there's little workspace left with softlimits enabled."
For me it's not a problem because I will use the hard limits instead of the softlimits, but maybe my findings are useful to you or others.
And again, maybe I'm missing something. Finally, I am still learning and testing...
@rverhag : Thanks for the very thorough results. It looks like it is working as expected.
One thing that you may not be aware of is that the homing cycle performs a pull-off maneuver right after it locates machine zero by your limit switches. In other words, machine zero is located exactly when your limit switches trigger. By default it pulls off 1mm off of the limit switches, not to accidentally trigger them. Your soft limits negative space is defined as the distance from the limit trigger to the axis max travel. So, right after homing, you should be able to move up to 1mm back toward your limit switches. This is probably the reason for some of the confusion in your results.
@chamnit : I was wondering why the machine is at -99, -49,-1 after homing with directionmask $25 = 96, so I just did another test but now with homing in 4 different corners.
$25 = 0 (home at upper right corner) after homing machinepos = -1,-1,-1
Could this be "the problem"? Only homing in the upper right corner gives the expected -1,-1,-1. For the other 3 corners the offset seems a little bit strange. (just for the record: dimensions of the machine are 500mm x 750mm x 125mm X,Y,Z)
@rverhag : I'm not certain what the problem is that you're pointing out. The $9-$11 max travel settings define the total length of travel for an axis. So when the homing axis gets inverted, it uses this max travel data to determine where "home" is such that the entire travel space of the machine is negative. If you're machine is 500mm x 750mm x 125mm, you'll need to set your max travel setting to correspond to this.
Sorry for the misunderstanding. You're absolutely right. It's quite logical (if you see the whole picture;-) )
white: total workingspace
Softlimits in both situations X and Y 300 mm max distance (Ignore Z in the picture).
Now the "problem" with the offset comes clear to me. There is of course no problem, but I did not see the reason for the "strange" machinecoordinates. I actually had to make a drawing immediately. Worth a thousand words.
Better to get a good night sleep....
Thanks for your time and patience
referenced this issue
Sep 14, 2013
Hola , tengo una pregunta, estoy utilizando este software , pero al momento de pulsar el boton de emergencia o un final de carrera físicos, me aparace en la pantalla de grbl alarma, me dice que con $x puedo dejar este estado de error alarma ; pero como hago esto si en la pantalla se me pone todos los botones como desabilitados?? gracias por su respuesta