This is an existing KRC4 system which palletizes bags based on calculations of bag size. Works alright but varying bag size can produce crushing or dropping too high. I am trying to create a search function to find the layer height of a previously dropped layer. I've installed a laser sensor on the EOAT which provides a digital input bool when the robot is at a good drop position. My thought is to set the system up for the lowest bag height. On the first bag of a layer I'll move to the drop position from a much higher approach position. The drop position will be slightly too low. I'll move down until I see the sensor, read the robot tool position and create a "Laser Offset" to apply to that calculated drop position for the rest of the layer. Problem is I don't know how to accomplish that abandoning of a motion command based on an input.
I was recommended the STOP WHEN PATH function. But that looks basically like a "pause" function where it stops on an input and then waits until the input changes state to finish the spline move.
Could I nest the drop position motion command in a While loop conditional on the sensor state? Does a PTP nested in a while loop that loses its condition stop the motion or keep going and not start a repetition?
Any insight you good people could provide would be much appreciated.