GPT-Code

So today I had this idea - maybe I should let AI control my CNC plasma cutter!

To back up, a CNC plasma cutter is an industrial robot that cuts sheets of steel like they are butter.  The AI is GPT-4, which is not specifically trained to do this - it is just a large language model that might have seen some examples on the internet.  The AI is also known to be confidently wrong and hallucinate outputs.  


No harm in giving control of an industrial robot to a language model, right?  I mean, that gif above shows what it does to 10 Gauge steel.


The typical workflow is to design your part in drafting software (CAD) and then use different software (CAM) to make the tool paths (G-Code).  The plasma cutter then just follows the instructions in that G-Code.


So I asked GPT to skip all that and directly make some G-Code for a sign:

Thankfully GPT has some guard rails, and was unwilling to entertain this request.

But reading between the lines, it seemed like the objection wasn't that the request was insane, but rather that the sign was too detailed.  After rewording my requests a few times, I got it to generate some G-Code:

Probably the right next step would be to do some validation work, but I ran up to the shop and started setting up the machine!  Surprisingly, the code loaded on the first try:

If the code is syntactically valid then it must be safe, right?  Let's hit go!

It was liberal with the interpretation of "GPT", but I kind of love it.  

One reason it is off is that GPT-4 has no vision system - it doesn't know the shape of things - and it works entirely by predicting what word is most likely to follow other words.  It also did have a few technical errors - not setting the initial height at each pierce caused the "T" to be kinda messed up, and there was a weird 30 second pause in the middle of the cut path for no reason.  But nobody got hurt, so I am going to call it a win!