Manual generation of G-code is important for learning the operation of CNC machines. Prior work in G-code verification uses Large-Language Models (LLMs), which primarily examine errors in the written programming. However, CNC machining requires extensive use and knowledge of the Human-Machine Interface (HMI), which displays machine status and errors. LLMs currently lack the capability to leverage knowledge of HMIs due to their inability to access the vision modality. This paper proposes a few-shot VLM-based verification approach that simultaneously evaluates the G-code and the HMI display for errors and safety status. The input dataset includes paired G-code text and associated HMI screenshots from a 15-slant-PRO lathe, including both correct and error-prone cases. To enable few-shot learning, the VLM is provided with a structured JSON schema based on prior heuristic knowledge. After determining the prompts, instances of G-code and HMI that either contain errors or are error free are used as few-shot examples to guide the VLM. The model was then evaluated in comparison to a zero-shot VLM through multiple scenarios of incorrect G-code and HMI errors with respect to per-slot accuracy. The VLM showed that few-shot prompting led to overall enhancement of detecting HMI errors and discrepancies with the G-code for more comprehensive debugging. Therefore, the proposed framework was demonstrated to be suitable for verification of manually generated G-code that is typically developed in CNC training.
翻译:手动生成G代码对于学习数控机床操作至关重要。先前关于G代码验证的研究主要使用大型语言模型(LLMs),这些模型主要检查编程书写中的错误。然而,数控加工需要广泛使用并了解人机界面(HMI),该界面显示机器状态和错误信息。由于无法访问视觉模态,当前LLMs缺乏利用HMI知识的能力。本文提出一种基于少样本视觉语言模型(VLM)的验证方法,能够同时评估G代码和HMI显示界面中的错误与安全状态。输入数据集包含来自15-slant-PRO车床的成对G代码文本及相关HMI截图,涵盖正确案例和易出错案例。为实现少样本学习,VLM被提供了基于先验启发式知识的结构化JSON模式。确定提示模板后,将包含错误或无错误的G代码和HMI实例作为少样本示例来引导VLM。随后,通过多组错误G代码和HMI异常场景,以每槽位准确率为指标,将该模型与零样本VLM进行对比评估。实验表明,少样本提示策略整体提升了HMI错误检测及G代码不一致性识别的能力,从而实现更全面的调试。因此,所提框架被证明适用于验证数控培训中通常需要手动生成的G代码。