So I'd like to probe for ideas and sanity checks here on my project.
Pre-TLDR/LastParagraphFirst: So the question is if faced with a dynamic limit switch distance problem, how would you implement it? Is there a clean way to implement it in the G-code where the limit switch can simply trigger a *pause*, and proceed to the next line to resume in the reverse direction after an elapsed time? Is this possible in the G-code where a limit switch can cause a break-to-next-line or through a system of subroutines? Would I need to roll a Lua script? Opinions are appreciated!So I've got a robot with an X and Y axis in a gin that needs to push that probe shown on the end of the X axis into each cotton bale when it arrives at the weigh table. The robot is built from OpenBuilds parts, and last year we used this PlanetCNC controller that proved to be an unreliable PITA and didn't have a few G code commands implemented that I wanted. In the PlanetCNC software, limit switches could only cause E-Stops or could not resume to a next line-- so if I paused with the limit switch it'd just keep driving forward when resumed. I was able to band-aid it to work by using an Arduino to interrupt pulses to the drivers when it sensed the limit switch at the bale was pressed, and send keystrokes via AutoHotKey to the software to resume.
The problem I'll face when implementing it again with (planning on using but not yet purchased) Mach4 and a PMDX-416 SmartBOB is the same as last year, albeit I'm hoping the more robust software/hardware will allow me to more elegantly implement it.
I realize G Code does not allow if/for/while conditionals by default, or jumps on conditionals, or any of that... The thing is, I have a limit switch that is dynamically placed because the cotton bales arrive on the weigh table with about a 1ft margin of distance. I need to have the robot drive out, hit the limit switch (thus also pushing the probe into the bale), come back out, and repeat 4 times. See the video:
https://www.youtube.com/watch?v=XbuhTXTsVVkThis year it will go faster due to a belt drive conversion, and it will hopefully be more reliable and not need janky band-aids due to Mach4/SmartBOB..hopefully.
Thanks.