A robot software development code automatic generation method
Patent Information
- Application Number
- CN202610948296.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-29
- Publication Date
- 2026-09-18
AI Technical Summary
[0004]本发明的目的是为了解决现有技术中存在的在根据机器人任务描述自动生成控制代码时,容易将任务动词直接绑定为单一控制原语或少量接口调用,导致任务动词隐含的感知确认、坐标绑定、运动过渡、执行反馈和完成判定等控制阶段缺失,使生成代码在真实机器人部署运行中出现动作缺段、接口调用不完整和任务结果偏离预期的缺点,而提出的一种机器人软件开发代码自动生成方法
1、本发明通过获取机器人任务描述和机器人能力接口信息,先从机器人任务描述中识别任务动词集合,并结合机器人能力接口集合将任务动词展开为由多个连续执行阶段组成的执行粒度链,使“抓取”“放置”“搬运”“巡检”等高层任务动词不再被直接等同为单一控制原语或者单一接口调用,而是被拆解为感知确认、坐标绑定、路径生成、动作执行、状态反馈和结果确认等与机器人真实执行过程对应的控制阶段;能够针对任务动词隐含控制语义未被充分展开的问题,在代码生成前形成明确的阶段化控制依据,减少因动作阶段缺失导致的接口调用不完整、运动过程断裂和任务执行偏差,提高机器人控制代码与真实作业流程之间的一致性。
Smart Images

Figure CN122777098A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software development technology, and in particular to a method for automatically generating robot software development code. Background Technology
[0002] With the increasing application of industrial robots, mobile robots, collaborative robots, and service robots in scenarios such as intelligent manufacturing, warehousing and logistics, industrial inspection and maintenance, and flexible assembly, robot software development is gradually shifting from writing single control instructions to developing task-oriented applications. In actual development, developers typically need to write various types of code based on task requirements such as "grasping," "carrying," "placing," "inspecting," and "moving," including code for acquiring perception data, confirming object pose, coordinate transformation, path generation, motion control, end effector control, status feedback monitoring, and task completion determination. Because robot control programs are closely related to the robot's capabilities, sensor interfaces, actuator interfaces, communication interface types, and the actual operation process, a single task description often needs to be broken down into multiple consecutive execution stages before deployable robot control code can be formed.
[0003] Existing automatic code generation methods for robot software development mostly focus on directly converting natural language task descriptions, process configurations, or low-code modules into function calls, interface calls, or flow control statements. While this can reduce the workload of manual coding to some extent, in real robot control scenarios, high-level task verbs in the task description are not equivalent to single control primitives. For example, "grasp" is not just a call to the grasp interface, but involves multiple stages such as object perception confirmation, object pose binding, proximity path generation, end effector presetting, grasp action execution, grasp status feedback, and grasp result confirmation. If the automatic generation method directly binds task verbs to a single interface call or a few interface calls, it can easily cause the execution granularity of the task verbs to collapse during the binding process of control primitives. This means that although the generated code may pass at the syntax level or in a simple simulation process, problems such as missing action segments, incomplete interface calls, misjudgment of execution status, and deviation of task results from expectations may occur when the robot is deployed and run. Summary of the Invention
[0004] The purpose of this invention is to address the shortcomings of existing technologies that, when automatically generating control code based on robot task descriptions, tend to directly bind task verbs to a single control primitive or a small number of interface calls. This results in the absence of control stages implicit in the task verbs, such as perception confirmation, coordinate binding, motion transition, execution feedback, and completion judgment. Consequently, the generated code exhibits shortcomings in actual robot deployment and operation, including missing action segments, incomplete interface calls, and deviations from expected task results. Therefore, this invention proposes an automatic robot software development code generation method.
[0005] To address the problems existing in the prior art, the present invention adopts the following technical solution: A method for automatically generating robot software development code includes: Obtain robot task description and robot capability interface information, identify the set of task verbs from the robot task description, and form a set of robot capability interfaces from the robot capability interface information; Based on the task verb set and the robot capability interface set, the task verbs are expanded into an execution granularity chain consisting of consecutive execution stages, and a mapping relationship between the task verbs and the execution granularity chain is established. Perform an execution granularity collapse check on the mapping relationship between task verbs and execution granularity chains, and generate a corrected execution granularity chain; Based on the revised execution granularity chain, the control interface type and interface instance are determined for each execution stage, forming an interface binding relationship; Generate robot control code files based on interface binding relationships, and generate execution phase index information; Granular consistency verification is performed based on the robot control code file and execution phase index information. If the verification passes, deployable robot control code is output; if the verification fails, a verification failure report is output.
[0006] Preferably, the robot task description and robot capability interface information are obtained; a set of task verbs is identified from the robot task description; and a set of robot capability interfaces is formed from the robot capability interface information, including: Obtain a robot task description that includes at least one of natural language task description and structured task configuration; Acquire robot capability interface information, including perception interface, motion control interface, end effector interface, status feedback interface, and task result confirmation interface; Semantic parsing is performed on the robot task description to obtain task verbs, execution objects, target locations, and task completion intentions. The task verbs are then combined into a task verb set, and the robot capability interface information is combined into a robot capability interface set.
[0007] Preferably, establishing a mapping relationship between task verbs and execution granularity chains includes: Taking each task verb in the task verb set as the processing object, and combining the execution object, target position, task completion intention and robot capability interface set corresponding to the task verb, the task verb is expanded into an execution granularity chain containing multiple consecutive execution stages, and each task verb is associated with its execution granularity chain to obtain the mapping relationship between task verbs and execution granularity chains.
[0008] Preferably, the execution granularity chain includes: When the task verb is a grasping task verb, the execution granularity chain includes object perception confirmation, object pose binding, proximity path generation, end effector presetting, grasping action execution, grasping status feedback, and grasping result confirmation. When the task verb is a placement-type task verb, the execution granularity chain includes target location confirmation, placement posture generation, transportation path generation, arrival status feedback, release action execution, and release result confirmation. When the task verb is an inspection-type task verb, the execution granularity chain includes inspection point confirmation, movement path generation, movement execution, sensor data acquisition, abnormal status identification, and inspection result confirmation.
[0009] Preferably, the mapping relationship between task verbs and execution granularity chains is checked for execution granularity collapse to generate a corrected execution granularity chain, including: Check if the execution granularity chain corresponding to each task verb contains a task verb that is directly bound to a single control primitive, a single interface call, or a combination of interface calls that does not cover the execution stage in the execution granularity chain corresponding to that task verb; When the binding or interface call combination results in the absence of any of the required stages in the execution granularity chain corresponding to the task verb, such as the perception confirmation stage, coordinate binding stage, motion transition stage, execution process feedback stage, and task completion determination stage, the missing execution stage is filled in according to the robot capability interface set to generate a corrected execution granularity chain.
[0010] Preferably, when the added execution stage cannot be matched with a control interface type or interface instance in the robot capability interface set, the execution stage is marked as an unbindable stage, and the unbindable stage is retained in the corrected execution granularity chain.
[0011] Preferably, based on the revised execution granularity chain, control interface types and interface instances are determined for each execution stage to form interface binding relationships, including: Bind the continuous state acquisition phase or the sensor data input phase to a subscription interface; Bind the one-time query phase, configuration phase, or coordinate transformation phase to a request-response interface; Bind long-cycle, feedback-enabled, and cancelable motion or operation phases to action-type interfaces; Bind the immediate triggering phase of the end-point tool to the driver control interface; The unbindable stage where an interface instance cannot be bound is recorded as an unbound state, thus forming an interface binding relationship.
[0012] Preferably, robot control code files are generated based on the interface binding relationship, and execution phase index information is generated, including: Based on the interface binding relationship, task orchestration layer code and interface adaptation layer code are generated. The task orchestration layer code organizes the order of the bound execution stages according to the modified execution granularity chain, and generates entry conditions, interface calls, feedback processing, completion conditions and exception exits for the bound execution stages. The interface adaptation layer code calls the control interface type and interface instance corresponding to the bound interface instance according to the interface binding relationship; For execution phases that are in an unbound state in the interface binding relationship, no interface call code is generated, and the unbound state of that execution phase is written into the execution phase index information.
[0013] Preferably, the execution stage index information includes the association between each task verb, the execution stage corresponding to the task verb, the interface binding relationship corresponding to the execution stage, the code snippet corresponding to the bound execution stage, and the unbound state corresponding to the unbound execution stage.
[0014] Preferably, granular consistency verification is performed based on the robot control code file and execution phase index information, including: Based on the robot control code file and execution phase index information, the robot control code file is subjected to interface existence verification, interface input and output data type consistency verification, execution phase integrity verification, phase sequence consistency verification, and completion judgment integrity verification. When all the above verifications pass, deployable robot control code is output. When any verification fails, a verification failure report is output, which includes the task verb that failed the verification, the corresponding execution phase, and the reason for the failure.
[0015] Compared with the prior art, the beneficial effects of the present invention are: 1. This invention obtains robot task descriptions and robot capability interface information, first identifying a set of task verbs from the robot task description, and then expanding the task verbs into an execution granularity chain composed of multiple consecutive execution stages, in conjunction with the robot capability interface set. This prevents high-level task verbs such as "grab," "place," "transport," and "inspect" from being directly equated as single control primitives or single interface calls, but instead decomposes them into control stages corresponding to the robot's actual execution process, such as perception confirmation, coordinate binding, path generation, action execution, status feedback, and result confirmation. This addresses the problem of insufficient expansion of the implicit control semantics of task verbs, forming clear staged control basis before code generation, reducing incomplete interface calls, broken motion processes, and task execution deviations caused by missing action stages, and improving the consistency between robot control code and the actual work process.
[0016] 2. This invention further performs an execution granularity collapse check on the mapping relationship between task verbs and execution granularity chains, generates a corrected execution granularity chain, and determines the control interface type and interface instance based on the corrected execution granularity chain to form an interface binding relationship. Based on this, robot control code files and execution stage index information are generated. Before code output, the existence of interfaces, consistency of interface input and output data types, completeness of execution stages, consistency of stage order, and completeness of completion judgment are verified to confirm whether the generated code meets the deployment requirements of the target robot software environment. This can avoid the problem of generated code passing only at the syntax level or in a simple simulation process, resulting in misjudgment of state, missing feedback, and deviation of task results from expectations when the real robot is deployed, thus improving the traceability, verifiability, and deployment reliability of automatically generated robot control code. Attached Figure Description
[0017] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings: Figure 1 A flowchart illustrating an automatic code generation method for robot software development provided by the present invention; Figure 2 This is a schematic diagram of the task verb execution granularity collapse provided by the present invention; Figure 3 This is a schematic diagram illustrating the relationship between the execution granularity chain and the interface binding provided by the present invention. Detailed Implementation
[0018] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0019] Example 1, as Figure 1 As shown, this embodiment provides a method for automatically generating robot software development code; the method is used to generate robot control code files based on robot task description and robot capability interface information, and before outputting deployable robot control code, to perform granularity consistency verification on the generated robot control code files to avoid execution granularity collapse of task verbs during the binding process of control primitives; The automatic generation method for robot software development code provided in this embodiment includes the following steps; S1. Obtain robot task description and robot capability interface information, identify the set of task verbs from the robot task description, and form a set of robot capability interfaces from the robot capability interface information. In this step, the robot task description refers to the input information used to express the task to be performed by the robot. The robot task description includes at least one of natural language task description and structured task configuration. The natural language task description is used to express the task to be performed by the robot in natural language, such as "grab the red part on the table and put it into the material box", "inspect the equipment status along the specified route", and "transfer the workpiece from the loading position to the inspection position". The structured task configuration is used to express the task to be performed by the robot in the form of fields. The structured task configuration includes task verb field, execution object field, target position field and task completion intention field. In this step, robot capability interface information refers to the interface information that can be called or read in the target robot's software environment, including perception interfaces, motion control interfaces, end effector interfaces, status feedback interfaces, and task result confirmation interfaces. Perception interfaces are used to acquire target recognition results, target pose results, environmental status results, or sensor data. Motion control interfaces are used to execute robotic arm movements, mobile chassis navigation, trajectory tracking, or path execution. End effector interfaces are used to control the gripper, suction cup, tool head, or detection end to perform actions. Status feedback interfaces are used to acquire motion feedback, gripping feedback, positioning feedback, or anomaly feedback. Task result confirmation interfaces are used to confirm whether the task has achieved the expected completion status. In this step, task verbs refer to terms or configuration items in the robot task description used to express the robot's operation actions. The task verbs include at least one of grasping, placing, transporting, inspecting, approaching, moving, and releasing. The task verb set is formed by the task verbs identified in the robot task description. The robot capability interface set is formed by organizing the robot capability interface information. The robot capability interface set is used to record the interface name, control interface type, interface input data type, interface output data type, robot component to which the interface belongs, and the execution stage that the interface can support. In this step, the system automatically generates a robot task description input by the user and reads the robot capability interface information from the target robot software environment; the target robot software environment can be the runtime environment of a robotic arm control system, a mobile robot control system, a collaborative robot control system, a robot middleware system, or a robot low-code development platform. When a robot task description is a natural language task description, the automatic generation system performs word segmentation, part-of-speech tagging, and action semantic recognition on the natural language task description. It identifies the task verbs used to express the work actions and identifies the execution object, target location, and task completion intention corresponding to the task verbs. For example, for the natural language task description "grab the red part on the table and put it into the material box", the automatic generation system identifies the task verbs "grab" and "put in", identifies the execution object as "red part", identifies the target location as "material box", and identifies the task completion intention as "the red part is in the material box and is released". During the natural language task description parsing process, the automatic generation system uses a task parsing rule table to parse the robot task description. The task parsing rule table includes task verb items, execution object trigger items, target location trigger items, and task completion intention trigger items. The task verb items are used to record at least one operation action word among grasping, placing, transporting, inspecting, moving, releasing, and approaching. The execution object trigger items are used to identify object words that are located after the task verb or have an interaction relationship with the task verb. The target location trigger items are used to identify the target location introduced by "to", "arrive", "place", "move to", and "inspection route". The task completion intention trigger items are used to identify the task completion state corresponding to "released", "arrived", "completed collection", "formed result", and "stable holding".
[0020] The automatic generation system scans the robot task description in a priority manner based on task verbs. It first identifies the task verbs, and then determines the execution object, target location, and task completion intention within the scope of the statement containing the task verbs. In the case of multiple task verbs in the same robot task description, the automatic generation system establishes the sequential relationship between the task verbs according to their order of appearance in the robot task description, and records the execution object, target location, and task completion intention corresponding to each task verb. When the robot task description is a structured task configuration, the automatic generation system reads the task verb field, execution object field, target position field, and task completion intention field from the structured task configuration. For example, if the task verb field in the structured task configuration is "grab, place", the execution object field is "red part", the target position field is "material box", and the task completion intention field is "release part into material box", then the automatic generation system directly generates the task verb, execution object, target position, and task completion intention based on the above fields. When both natural language task description and structured task configuration exist, the automatic generation system uses the task verb field, execution object field, target location field, and task completion intention field in the structured task configuration as the first source, and the information parsed from the natural language task description as the second source. When the first source and the second source are inconsistent in the execution object, target location, or task completion intention corresponding to the same task verb, in one implementation, the automatic generation system retains the data from the first source and writes the inconsistent content as a parsing inconsistency item into the execution stage index information, so that subsequent granular consistency verification can output a verification failure report based on the parsing inconsistency item.
[0021] While acquiring the robot task description, the system automatically generates robot capability interface information from the target robot software environment. Each interface in the robot capability interface information includes at least the interface name, control interface type, interface input data type, interface output data type, robot component to which the interface belongs, and the execution stage that the interface can support. For example, robot capability interface information may include the following: a vision detection interface, whose control interface type is a subscription interface, supporting the object perception and confirmation stage, with the interface output data type being target category, target position, and target confidence state; a coordinate transformation interface, whose control interface type is a request-response interface, supporting the object pose binding stage, with the interface input data type being the target pose in the camera coordinate system and the interface output data type being the target pose in the robot base coordinate system; and a robotic arm motion interface, whose control interface type is an action interface, supporting the proximity path generation, grasping action execution, and transport path generation stages, with the interface input data type being the target pose or... The interface includes a path point interface, whose output data type is motion feedback and motion result; a gripper drive interface, whose control interface type is drive control interface, which can support the end effector preset, gripping action execution, and release action execution stages, and whose input data type is gripper opening and closing command; a gripper status feedback interface, whose control interface type is subscription interface or request-response interface, which can support the gripping status feedback and gripping result confirmation stages, and whose output data type is gripper opening and closing status, gripping status, or gripping force status; and a target status confirmation interface, whose control interface type is request-response interface or subscription interface, which can support the release result confirmation and task completion determination stages. The automatic generation system will form a set of task verbs from the identified task verbs and organize the read robot capability interface information into a set of robot capability interfaces. The set of task verbs is used in S2 to establish an execution granularity chain, and the set of robot capability interfaces is used in S2 to constrain whether the execution stage in the execution granularity chain can be actually supported by the target robot.
[0022] S2. Based on the task verb set and the robot capability interface set, expand the task verbs into an execution granularity chain composed of consecutive execution stages, and establish a mapping relationship between the task verbs and the execution granularity chain. In this step, the execution granularity chain refers to an ordered set of multiple consecutive execution stages formed by expanding a task verb from a single action at the language level; each execution stage has a clear control meaning and corresponds to a control link that needs to be completed in the actual execution process of the robot; the execution granularity chain is used to avoid directly binding task verbs to a single control primitive, a single interface call, or a small number of interface calls; The continuous execution phase refers to the control links arranged according to the actual execution sequence of the robot. The output of the previous execution phase serves as the input or start condition for the next execution phase. For example, the object perception and confirmation phase outputs the recognition result and initial pose of the execution object, and the object pose binding phase uses the recognition result and initial pose as input. The object pose binding phase outputs the target pose in the robot control coordinate system, and the approach path generation phase uses the target pose as input. In this step, the automatic generation system takes each task verb in the task verb set as the processing object, and combines the execution object, target position, task completion intention and robot capability interface set corresponding to the task verb to expand the task verb into an execution granularity chain containing multiple consecutive execution stages. The establishment of the execution granularity chain does not use a single control primitive as the direct output, but rather the continuous execution stages in the actual robot execution process as the output; each execution stage has clear inputs, stage processing actions, and stage outputs; the inputs of the execution stage come from the robot task description, the output of the previous execution stage, or the robot capability interface set; the processing actions of the execution stage are the control links that need to be completed before calling the target robot interface; the outputs of the execution stage are directly used for subsequent execution stages, interface binding relationship establishment, or granularity consistency verification.
[0023] The execution granularity chain is established based on the correspondence between task verb categories and stage types. The automatic generation system categorizes task verbs into grasping, placing, transporting, inspecting, moving, and releasing tasks based on the task verbs in the task verb set. Grasping task verbs at least correspond to object perception confirmation, object pose binding, approach path generation, end effector presetting, grasping action execution, grasping status feedback, and grasping result confirmation. Placing task verbs at least correspond to target location confirmation, placement posture generation, transport path generation, arrival status feedback, release action execution, and release result. Confirmation: Verbs for handling tasks should at least correspond to object perception confirmation, object pose binding, approach path generation, grasping action execution, grasping result confirmation, target position confirmation, handling path generation, arrival status feedback, release action execution, and release result confirmation; verbs for inspection tasks should at least correspond to inspection point confirmation, movement path generation, movement execution, sensor data acquisition, abnormal status identification, and inspection result confirmation; verbs for movement tasks should at least correspond to target position confirmation, movement path generation, movement execution, arrival status feedback, and movement result confirmation; verbs for release tasks should at least correspond to release position confirmation, release action execution, release status feedback, and release result confirmation. When the task verb is a grasping task verb, the execution granularity chain automatically generated by the system includes object perception confirmation, object pose binding, approach path generation, end effector preset, grasping action execution, grasping status feedback, and grasping result confirmation. Specifically, the object perception confirmation stage confirms whether the object to be grasped has been identified by the perception interface; the object pose binding stage binds the object pose output by the perception interface to the coordinate system required for robot control; the approach path generation stage generates the motion path for the robot to reach the pre-grasping pose; the end effector preset stage sets the execution preparation state of the gripper, suction cup, or tool head; the grasping action execution stage executes the end-effector contact or gripping action; the grasping status feedback stage reads the gripping, suction, or tool execution status; and the grasping result confirmation stage confirms whether the object has been stably held by the robot. When the task verb is a placement-type task verb, the execution granularity chain automatically generated by the system includes target position confirmation, placement posture generation, transport path generation, arrival status feedback, release action execution, and release result confirmation. Specifically, the target position confirmation stage confirms whether the target position in the task description can be recognized or accessed by the robot; the placement posture generation stage generates the placement posture of the end effector based on the target position; the transport path generation stage generates the motion path from the current position to the placement position; the arrival status feedback stage confirms that the robot or end effector has reached the placement position; the release action execution stage controls the gripper, suction cup, or tool head to release the object; and the release result confirmation stage confirms that the object is at the target position and separated from the end effector. When the task verb is a handling task verb, the execution granularity chain automatically generated by the system includes object perception confirmation, object pose binding, proximity path generation, grasping action execution, grasping result confirmation, target position confirmation, handling path generation, arrival status feedback, release action execution, and release result confirmation. Among these, object perception confirmation, object pose binding, proximity path generation, grasping action execution, and grasping result confirmation are used to confirm that the object has been stably held by the robot; target position confirmation, handling path generation, arrival status feedback, release action execution, and release result confirmation are used to confirm that the object has been moved to the target position and released. When the task verb is an inspection-type task verb, the automatically generated execution granularity chain includes inspection point confirmation, movement path generation, movement execution, sensor data acquisition, abnormal state identification, and inspection result confirmation. Specifically, the inspection point confirmation stage confirms the location to be inspected; the movement path generation stage generates the movement path to the inspection point; the movement execution stage controls the robot's movement; the sensor data acquisition stage collects the sensor data required for inspection; the abnormal state identification stage determines whether an abnormality exists based on the collected data; and the inspection result confirmation stage generates the inspection result and confirms whether the inspection task is completed. When the task verb is a movement-related task verb, the execution granularity chain automatically generated by the system includes target position confirmation, movement path generation, movement execution, arrival status feedback, and movement result confirmation. Specifically, the target position confirmation stage confirms the location the robot needs to reach; the movement path generation stage generates the movement path; the movement execution stage controls the robot to move along the movement path; the arrival status feedback stage reads the robot's current position or arrival status; and the movement result confirmation stage confirms that the robot has reached the target position. When the task verb is a release-type task verb, the automatically generated execution granularity chain established by the system includes release location confirmation, release action execution, release status feedback, and release result confirmation. Among them, the release location confirmation stage is used to confirm the location where the execution object needs to be released; the release action execution stage is used to control the end effector to release the execution object; the release status feedback stage is used to read the release status of the end effector; and the release result confirmation stage is used to confirm that the execution object has been separated from the end effector and is located at the release position.
[0024] For task verbs that cannot be directly categorized into the above categories, the automatic generation system establishes a basic execution granularity chain based on the task completion intent corresponding to the task verb. The basic execution granularity chain is formed in the order of pre-confirmation stage, motion or operation stage, execution process feedback stage, and task completion determination stage. The pre-confirmation stage is used to confirm the execution object or target position, the motion or operation stage is used to execute robot motion or end effector operation, the execution process feedback stage is used to read robot status feedback or interface return results, and the task completion determination stage is used to confirm whether the task completion intent corresponding to the task verb is satisfied. When establishing the execution granularity chain, the automatic generation system determines the execution stage order according to the input-output relationship between adjacent execution stages; the output of the previous execution stage should be used as the input of the next execution stage, or as the start condition of the next execution stage; for example, the object perception and confirmation stage outputs the object recognition result and initial pose, and the object pose binding stage uses the recognition result and initial pose as input; the object pose binding stage outputs the target pose in the robot control coordinate system, and the approach path generation stage uses the target pose as input; the grasping state feedback stage outputs the gripping state, and the grasping result confirmation stage uses the gripping state as input; The automatic generation system associates each task verb with its execution granularity chain to obtain a mapping relationship between task verbs and execution granularity chains; this mapping relationship is used in S3 to perform execution granularity collapse checks.
[0025] S3. Perform an execution granularity collapse check on the mapping relationship between task verbs and execution granularity chains, and generate a corrected execution granularity chain. In this step, execution granularity collapse refers to the situation where a task verb is directly bound to a single control primitive, a single interface call, or a combination of interface calls that does not cover the execution stage in the execution granularity chain corresponding to the task verb before generating robot control code. This results in the absence of the necessary stages in perception confirmation, coordinate binding, motion transition, execution process feedback, and task completion determination implicit in the task verb. In this step, the corrected execution granularity chain refers to the execution granularity chain obtained after execution granularity collapse check and missing execution stages are added; when the added execution stage cannot match the control interface type or interface instance in the robot capability interface set, the execution stage is marked as an unbindable stage and is retained in the corrected execution granularity chain. In this step, the required stage refers to the execution stage necessary for the task verb to complete real robot control, determined based on the execution object, target position, task completion intention, and robot capability interface set corresponding to the task verb. If the output of an execution stage is used as input or initiation condition for a subsequent execution stage, then that execution stage is determined as a required stage. If an execution stage is used to determine whether the task completion intention is met, then that execution stage is determined as a required stage. If an execution stage has a corresponding interface in the robot capability interface set, and that execution stage belongs to the stage in the execution granularity chain determined according to the task verb category in S2, then that execution stage is determined as a required stage. In this step, the automatic generation system performs an execution granularity collapse check on the execution granularity chain corresponding to each task verb based on the mapping relationship between the task verbs and the execution granularity chain obtained in S2. The execution granularity collapse check includes the following: checking whether the task verb is directly bound to a single control primitive; checking whether the task verb is directly bound to a single interface call; checking whether the task verb is bound to a combination of interface calls that does not cover the execution phase in the execution granularity chain corresponding to the task verb; and checking whether the execution granularity chain corresponding to the task verb is missing any of the required phases, including the perception confirmation phase, coordinate binding phase, motion transition phase, execution process feedback phase, and task completion determination phase. For grasping tasks, the perception confirmation stage, coordinate binding stage, motion transition stage, execution process feedback stage, and task completion judgment stage are generally required stages. For placement tasks, the target position confirmation stage, motion transition stage, arrival feedback stage, release action stage, and release result confirmation stage are required stages. For transport tasks, the object perception confirmation stage, object pose binding stage, grasping action execution stage, grasping result confirmation stage, target position confirmation stage, transport path generation stage, arrival status feedback stage, release action execution stage, and release result confirmation stage are required stages. For inspection tasks, the inspection point confirmation stage, movement path generation stage, movement execution stage, sensor data acquisition stage, abnormal status identification stage, and inspection result confirmation stage are required stages. When the automatic generation system performs execution granularity collapse checks, it compares the current execution granularity chain corresponding to the task verb with the required stages corresponding to the task verb. If a required stage is missing from the current execution granularity chain, or if the required stage exists but lacks the input-output connection between the required stage and the preceding or subsequent execution stages, then the task verb is determined to have execution granularity collapse. For task verbs with execution granularity collapse, the automatic generation system adds the missing required stages to the current execution granularity chain and adjusts the position of the added stages in the execution granularity chain according to the input-output connection, forming a corrected execution granularity chain. For example, for grasping tasks, if the current execution granularity chain includes grasping action execution and grasping result confirmation, but not object pose binding, then since the grasping action execution stage requires the target pose in the robot control coordinate system as input, and the output of the object pose binding stage is directly used by the grasping action execution stage, the object pose binding stage is a necessary stage, and the automatic generation system adds the object pose binding stage before the grasping action execution stage. If the current execution granularity chain includes grasping action execution but not grasping status feedback, then since the grasping result confirmation stage requires the gripping state as the judgment basis, the grasping status feedback stage is a necessary stage, and the automatic generation system adds the grasping status feedback stage after the grasping action execution stage and before the grasping result confirmation stage.
[0026] When the automatic generation system detects a missing stage in the execution granularity chain corresponding to a task verb, it fills in the missing execution stage based on the robot's capability interface set. For example, for the task verb "grab the red part," if the initial execution granularity chain only includes the grasping action execution stage, the automatic generation system determines that there is execution granularity collapse and adds the stages of object perception confirmation, object pose binding, proximity path generation, end effector presetting, grasping status feedback, and grasping result confirmation, forming a corrected execution granularity chain. Figure 2 As shown, the left side represents the collapsed generation path. In this path, the task verb "grab" is directly mapped to a single control primitive or a grasping interface call. The control stages implicit in the grasping task, such as object perception confirmation, object pose binding, proximity path generation, end effector presetting, grasping action execution, grasping status feedback, and grasping result confirmation, are not expanded. This can easily lead to the generated code lacking necessary execution steps. The right side represents the generation path of this invention. In this path, the task verb "grab" is first expanded into an execution granularity chain composed of consecutive execution stages. Then, subsequent interface binding and code generation are performed based on the execution granularity chain. This avoids the task verb being directly compressed into a single interface call, improving the stage integrity and real deployment reliability of the robot control code. When an added execution phase can be matched with a control interface type and interface instance in the robot capability interface set, the automatic generation system records the execution phase as a bindable execution phase; when an added execution phase cannot be matched with a control interface type or interface instance in the robot capability interface set, the automatic generation system marks the execution phase as an unbindable phase and retains the unbindable phase in the corrected execution granularity chain; for example, if there is no gripper status feedback interface in the target robot capability interface set, the "grip status feedback" phase is marked as an unbindable phase; if there is no target status confirmation interface in the target robot capability interface set, the "release result confirmation" phase is marked as an unbindable phase. After performing the above checks and corrections on each task verb, the automatic generation system outputs the corrected execution granularity chain; the corrected execution granularity chain is used in S4 to determine the control interface type and interface instance of each execution stage.
[0027] S4. Based on the revised execution granularity chain, determine the control interface type and interface instance for each execution stage, and form an interface binding relationship; In this step, the interface binding relationship refers to the association formed between the execution phase, control interface type, and interface instance. Control interface types include subscription interfaces, request-response interfaces, action interfaces, and drive control interfaces. Subscription interfaces are used in the continuous status acquisition phase or the sensor data input phase. Request-response interfaces are used in the one-time query phase, configuration phase, or coordinate transformation phase. Action interfaces are used in long-cycle, feedback-enabled, and cancelable motion or operation phases. Drive control interfaces are used in the immediate triggering phase of the end-point tool. For unbindable phases that cannot be bound to interface instances, they are recorded as unbound in the interface binding relationship. Based on the corrected execution granularity chain output by S3, the control interface type and interface instance are determined for each execution stage, forming an interface binding relationship; The automatic generation system first reads each execution stage in the corrected execution granularity chain and determines the control interface type based on the stage meaning. For continuous state acquisition stages or sensor data input stages, the control interface type is determined to be a subscription interface. For one-time query stages, configuration stages, or coordinate transformation stages, the control interface type is determined to be a request-response interface. For long-cycle, feedback-enabled, and cancelable motion or operation stages, the control interface type is determined to be an action interface. For end-tool instant triggering stages, the control interface type is determined to be a drive control interface. The automatic generation system then searches the robot capability interface set for an interface instance that matches the control interface type and execution stage. The matching of interface instances is based on three conditions: interface stage matching, interface input matching, and interface output matching. Interface stage matching means that the interface instance in the robot capability interface set can support an execution stage that includes the current execution stage. Interface input matching means that the output of the preceding execution stage of the current execution stage can provide the interface input data type required by the interface instance. Interface output matching means that the interface output data type of the interface instance can meet the input requirements of the subsequent execution stages of the current execution stage or the completion condition judgment requirements. When an interface instance simultaneously satisfies interface phase matching, interface input matching, and interface output matching, the automatic generation system identifies this interface instance as the bound interface instance for the current execution phase and records the current execution phase, control interface type, and bound interface instance in the interface binding relationship. When multiple interface instances simultaneously satisfy the above conditions, the automatic generation system selects the interface instance whose execution phase is completely consistent with the current execution phase. If multiple interface instances still exist, the system selects the interface instance whose interface input data type is consistent with the output data type of the previous execution phase. If multiple interface instances still exist, the system selects the interface instance whose interface output data type can directly meet the input requirements of the subsequent execution phase. When there is no interface instance that simultaneously satisfies interface stage matching, interface input matching, and interface output matching, the automatic generation system does not generate a replacement interface call. Instead, it records the current execution stage as unbound and records the current execution stage, the required control interface type, and the reason for unbinding in the interface binding relationship. Reasons for unbinding include mismatch in the execution stage supported by the interface, mismatch in the interface input data type, mismatch in the interface output data type, or the absence of a corresponding interface instance in the robot's capability interface set. For example, in the modified execution granularity chain corresponding to the verbs of grasping tasks, the object perception confirmation stage is bound to the visual detection subscription interface; the object pose binding stage is bound to the coordinate transformation request and response interface; the proximity path generation stage and the grasping action execution stage are bound to the robotic arm motion action interface; the end effector preset stage is bound to the gripper drive control interface; the grasping status feedback stage is bound to the gripper status feedback interface; and the grasping result confirmation stage is bound to the gripping result confirmation interface. In the revised execution granularity chain corresponding to the placement task verbs, the target position confirmation stage is bound to the target position query interface or the target perception subscription interface; the placement posture generation stage is bound to the posture calculation interface or the target posture query interface; the transport path generation stage is bound to the robotic arm motion action interface or the movement path action interface; the position status feedback stage is bound to the motion status feedback interface; the release action execution stage is bound to the end effector drive control interface; and the release result confirmation stage is bound to the target status confirmation interface.
[0028] For execution stages marked as unbindable in the corrected execution granularity chain, the automatic generation system does not bind interface instances to them. Instead, it records the corresponding task verb, control interface type requirements, and unbound state in the interface binding relationship. This way, subsequent code generation steps will not generate fake interface call code; instead, the unbound state will be written into the execution stage index information and verified by the granularity consistency verification step. Figure 3 As shown, the left side represents the execution granularity chain formed using a grasping task as an example. This chain includes execution stages such as object perception confirmation, object pose binding, proximity path generation, end effector presetting, grasping action execution, grasping status feedback, and grasping result confirmation. The right side represents the robot capability interface set, categorized by control interface type into subscription interfaces, request-response interfaces, action interfaces, and drive control interfaces. The automatic generation system binds each execution stage to its corresponding control interface type and interface instance based on the stage meaning, output of the preceding stage, and input requirements of the subsequent stage. For example, object perception confirmation is bound to the subscription interface, object pose binding and path calculation stages are bound to the request-response interface, motion execution stages are bound to the action interface, and end effector control stages are bound to the drive control interface. Execution stages that cannot find a suitable interface instance are recorded as unbound and used as verification criteria in subsequent execution stage index information and granularity consistency verification.
[0029] S5. Generate robot control code files based on interface binding relationships, and generate execution phase index information; In this step, the robot control code file includes task orchestration layer code and interface adaptation layer code; the task orchestration layer code organizes the order of the bound execution stages according to the revised execution granularity chain, and generates entry conditions, interface calls, feedback processing, completion conditions and exception exits for the bound execution stages; the interface adaptation layer code calls the control interface type and interface instance corresponding to the bound interface instance according to the interface binding relationship; In this step, the execution phase index information is used to record the correspondence between task verbs, execution phases, interface binding relationships, and code snippets; the execution phase index information includes the association between each task verb, the execution phase corresponding to the task verb, the interface binding relationship corresponding to the execution phase, the code snippet corresponding to the bound execution phase, and the unbound state corresponding to the unbound execution phase; Generate robot control code files based on interface binding relationships, and simultaneously generate execution phase index information; The task orchestration layer code is generated according to the stage code template; the stage code template includes a stage identifier field, an entry condition field, an interface call field, a feedback processing field, a completion condition field, and an exception exit field; the stage identifier field is filled by the task verb and the execution stage in the execution stage index information; the entry condition field is filled by the output of the preceding execution stage or the task start condition corresponding to the task verb; the interface call field is filled by the bound interface instances in the interface binding relationship; the feedback processing field is filled by the interface output data type and the input requirements of the subsequent execution stage in the interface binding relationship; the completion condition field is filled by the task completion intention corresponding to the execution stage or the start condition of the subsequent execution stage; the exception exit field is filled by situations such as interface call failure, interface output data type mismatch, execution stage exceeding the execution chain order, or completion condition not being met; The task orchestration layer code organizes the bound execution phases according to the revised execution granularity chain, and generates entry conditions, interface calls, feedback handling, completion conditions, and exception exits for the bound execution phases based on the phase code template. Among them, the entry conditions are determined by the output of the preceding execution phase or the task start condition; the interface calls are determined by the bound interface instances in the interface binding relationship; the feedback handling is determined by the data type of the interface output and the input requirements of the subsequent execution phase; the completion conditions are determined by the task completion intention or the start condition of the subsequent execution phase; and the exception exit is determined by the case of interface call failure, interface output data type mismatch, or failure to meet the completion condition. The interface adaptation layer code is generated according to the control interface type. For subscription-type interfaces, the interface adaptation layer code generates code for data reception, data validity judgment, and output data encapsulation. For request-response-type interfaces, the interface adaptation layer code generates code for request data construction, request sending, response reception, and response data parsing. For action-type interfaces, the interface adaptation layer code generates code for target sending, process feedback listening, result reception, and cancellation handling. For driver control interfaces, the interface adaptation layer code generates code for control command construction, control command issuance, and execution status reading. The generation of robot control code files does not directly generate a single control function based on the task verb name. Instead, it uses the modified execution granularity chain and interface binding relationship as the basis for code generation. For bound execution stages, the automatic generation system generates corresponding code snippets based on the stage code template and control interface type corresponding to that execution stage. For unbound execution stages, the automatic generation system does not generate interface call code, but only writes the unbound state, the required control interface type, and the reason for unbound in the execution stage index information. As a result, the code snippets in the generated robot control code files can all be traced back to the task verb, execution stage, and interface binding relationship.
[0030] For execution phases that are in an unbound state in the interface binding relationship, the automatic generation system does not generate interface call code and writes the unbound state of the execution phase into the execution phase index information. The unbound state includes at least the task verb, execution phase, required control interface type, and reason for unbinding. The reason for unbinding may be that the corresponding interface instance does not exist in the robot capability interface set, the interface input data type does not match, the interface output data type cannot meet the input requirements of the subsequent execution phase, or the interface required by the execution phase is not declared in the robot capability interface information. The execution phase index information includes the association between each task verb, the execution phase corresponding to the task verb, the interface binding relationship corresponding to the execution phase, the code segment corresponding to the bound execution phase, and the unbound state corresponding to the unbound execution phase. For a bound execution phase, the execution phase index information records the position or identifier of the code segment corresponding to the execution phase. For an unbound execution phase, the execution phase index information records that no interface call code was generated in the execution phase and records the corresponding unbound state. In one embodiment, when a parsing inconsistency item is formed in S1, the execution phase index information also records the task verb, first source data, second source data, and inconsistency content corresponding to the parsing inconsistency item. For example, for a robot task description of "grabbing a red part and placing it in a material box", the automatic generation system can generate the following task orchestration layer code logic: First, enter the object perception confirmation stage, read the red part recognition result output by the vision detection subscription interface; when the recognition result is valid, enter the object pose binding stage, call the coordinate transformation request response interface to obtain the target pose in the robot base coordinate system; then enter the approach path generation stage and the grasping action execution stage, call the robotic arm motion action interface to execute the approach and grasping; next, enter the end effector preset and grasping status feedback stage, call the gripper drive control interface and the gripper status feedback interface; after the grasping result is confirmed, enter the target position confirmation, placement posture generation, transport path generation, position status feedback, release action execution, and release result confirmation stages.
[0031] S6. Perform granular consistency verification based on the robot control code file and execution phase index information. If the verification passes, output deployable robot control code; if the verification fails, output a verification failure report. In this step, granular consistency verification refers to verifying the existence of interfaces, the consistency of input and output data types, the integrity of execution phases, the consistency of phase sequence, and the integrity of completion judgments in the robot control code file based on the robot control code file and execution phase index information. When the verification passes, deployable robot control code is output; when the verification fails, a verification failure report is output. The verification failure report includes the task verb that failed verification, the corresponding execution phase, and the reason for the failure. In this step, deployable robot control code refers to robot control code files that, after granularity consistency verification, meet the requirements of the target robot software environment in terms of interface existence, consistency of interface input and output data types, completeness of execution phases, consistency of phase sequence, and completeness of completion determination. Based on the robot control code file and execution phase index information, perform granular consistency verification on the robot control code file; Granularity consistency verification uses the robot capability interface set, the corrected execution granularity chain, interface binding relationships, robot control code files, and execution phase index information as data sources; interface existence verification uses the robot capability interface set and interface binding relationships as data sources, checking whether each interface instance called in the robot control code file exists in the robot capability interface set, and checking whether there is an unbound state in the execution phase index information; when the called interface instance does not exist or there is an unbound state in the execution phase index information, the interface existence verification fails. The interface input / output data type consistency verification uses interface binding relationships, robot control code files, and execution phase index information as data sources. It checks whether the interface input data type of an already bound execution phase is provided by the output of the preceding execution phase, and whether the interface output data type of an already bound execution phase meets the input requirements or completion condition judgment requirements of the subsequent execution phase. If the interface input data type of any already bound execution phase cannot be provided by the output of the preceding execution phase, or if the interface output data type cannot meet the input requirements or completion condition judgment requirements of the subsequent execution phase, the interface input / output data type consistency verification fails. The execution phase integrity verification uses the revised execution granularity chain and execution phase index information as data sources. It checks whether the execution phase recorded in the execution phase index information for each task verb covers all execution phases in the revised execution granularity chain corresponding to that task verb. If any task verb has an execution phase in the revised execution granularity chain that is not recorded in the execution phase index information, the execution phase integrity verification fails. The stage sequence consistency verification uses the corrected execution granularity chain, robot control code file, and execution stage index information as data sources. It checks whether the order of the code segments corresponding to the execution stages bound in the robot control code file is consistent with the execution stage order in the corrected execution granularity chain. If the order of any code segment is inconsistent with the execution stage order in the corrected execution granularity chain, the stage sequence consistency verification fails. The completion integrity verification uses task completion intent, robot control code files, and execution phase index information as data sources to check whether the final execution phase corresponding to each task verb has completion conditions or result confirmation codes; if the final execution phase corresponding to any task verb lacks completion conditions or result confirmation codes, the completion integrity verification fails.
[0032] In one implementation, when a parsing inconsistency item is formed and written into the execution phase index information in S1, the automatic generation system checks whether the parsing inconsistency item affects the execution object, target location, or task completion intention corresponding to the task verb in the granularity consistency verification. When the parsing inconsistency item affects the establishment of the corrected execution granularity chain, the formation of interface binding relationship, or the determination of task completion, the granularity consistency verification fails, and the corresponding task verb, parsing inconsistency item, and reason for failure are recorded in the verification failure report. The execution phase integrity verification also checks based on the task verb category; for grasping task verbs, it verifies whether they include object perception confirmation, object pose binding, proximity path generation, end effector presetting, grasping action execution, grasping status feedback, and grasping result confirmation; for placement task verbs, it verifies whether they include target position confirmation, placement posture generation, transport path generation, arrival status feedback, release action execution, and release result confirmation; for transport task verbs, it verifies whether they include object perception confirmation, object pose binding, proximity path generation, grasping action execution, grasping result confirmation, target position confirmation, transport path generation, arrival status feedback, release action execution, and release result confirmation; for inspection task verbs, it verifies whether they include inspection point confirmation, movement path generation, movement execution, sensor data acquisition, abnormal status identification, and inspection result confirmation; for other task verbs, it verifies whether they include all execution phases in the corrected execution granularity chain determined by S2 and S3. The stage sequence consistency verification is also used to confirm that the order of code snippets in the robot control code file is consistent with the order of execution stages in the corrected execution granularity chain. For grasping task verbs, object perception confirmation should be performed first, followed by object pose binding, then approach path generation, end effector presetting, grasping action execution, grasping status feedback, and grasping result confirmation. If the order of code snippets is inconsistent with the corrected execution granularity chain, for example, if the grasping action is performed before object pose binding, then the stage sequence consistency verification fails. The completion integrity verification is also used to confirm that each task verb has a clear task completion status; for grasping task verbs, the completion status includes that the object has been stably held by the robot; for placement task verbs, the completion status includes that the object has been located at the target position and released; for transport task verbs, the completion status includes that the object has been moved to the target position and released; for inspection task verbs, the completion status includes that sensor data acquisition has been completed and inspection results have been generated; if the robot control code file only contains interface calls without corresponding completion conditions or result confirmation code, the completion integrity verification fails. When the interface existence verification, interface input and output data type consistency verification, execution phase integrity verification, phase sequence consistency verification, and completion judgment integrity verification all pass, the system output deployable robot control code is automatically generated. The deployable robot control code is a robot control code file that has passed the above verifications and can be loaded, compiled, or executed by the target robot software environment. When any verification fails, a verification failure report is automatically generated. The verification failure report includes the task verb that failed the verification, the corresponding execution stage, and the reason for failure. For example, if the grasping status feedback stage in the "grab" task verb is not bound to the gripper status feedback interface, the verification failure report records the task verb as "grab", the corresponding execution stage as "grab status feedback", and the reason for failure as "there is no bindable status feedback interface instance in the robot capability interface set". If the release result confirmation stage in the "place" task verb does not generate completion condition code, the verification failure report records the task verb as "place", the corresponding execution stage as "release result confirmation", and the reason for failure as "missing task completion judgment code".
[0033] Through the above steps, this embodiment adjusts the automatic generation process of robot software development code from directly binding task verbs to control primitives to expanding task verbs into execution granularity chains, forming corrected execution granularity chains after collapse checks, forming interface binding relationships in the corrected execution granularity chains, generating phased robot control code through interface binding relationships, and outputting the robot control code after granularity consistency verification. This avoids high-level task verbs being prematurely compressed into single control primitives or a small number of interface calls, improving the completeness of the execution phase of the generated robot control code, the authenticity of interface calls, and the feasibility of real deployment.
[0034] Example 2: This example describes the robot task as picking up a red part on a table and placing it into a material box. The target robot is a robot system with a vision inspection device, a robotic arm, and a gripper. The automatic generation system obtains the robot task description and robot capability interface information in S1. The robot capability interface information includes the vision detection interface, coordinate transformation interface, robotic arm motion interface, gripper drive interface, gripper status feedback interface, and target status confirmation interface. The automatic generation system identifies the task verb set from the robot task description, which includes "grab" and "place". It identifies the execution object as "red part", the target location as "material box", and the task completion intention as "red part is released into the material box". In S2, the automatic generation system establishes an execution granularity chain based on the task verb set and the robot capability interface set. For the task verb "grasp", an execution granularity chain is established that includes object perception confirmation, object pose binding, approach path generation, end effector preset, grasping action execution, grasping status feedback, and grasping result confirmation. For the task verb "place", since it belongs to the placement type task verb in this application embodiment, an execution granularity chain is established that includes target position confirmation, placement posture generation, transport path generation, arrival status feedback, release action execution, and release result confirmation. In S3, the automatic generation system performs an execution granularity collapse check on the above execution granularity chain. If "grab" in the initial parsing result is only identified as a grab function call, the automatic generation system adds the object perception confirmation, object pose binding, approach path generation, end effector preset, grab status feedback, and grab result confirmation stages. If "place" is only identified as a place function call, the system adds the target position confirmation, placement posture generation, transport path generation, arrival status feedback, and release result confirmation stages. After the addition is completed, a corrected execution granularity chain is formed. The automatic generation system establishes interface binding relationships in S4; the object perception confirmation stage is bound to the vision detection interface; the object pose binding stage is bound to the coordinate transformation interface; the approach path generation, gripping action execution, and transport path generation stages are bound to the robotic arm motion interface; the end effector preset and release action execution stages are bound to the gripper drive interface; the gripping status feedback stage is bound to the gripper status feedback interface; and the gripping result confirmation and release result confirmation stages are bound to the target status confirmation interface or the gripper status feedback interface. The automatic generation system generates robot control code files in S5 based on interface binding relationships. The robot control code files include task orchestration layer code and interface adaptation layer code. The task orchestration layer code is organized in the following order: "object perception confirmation - object pose binding - approach path generation - end effector preset - grasping action execution - grasping status feedback - grasping result confirmation - target position confirmation - placement posture generation - transport path generation - arrival status feedback - release action execution - release result confirmation". The interface adaptation layer code calls the vision detection interface, coordinate transformation interface, robotic arm motion interface, gripper drive interface, gripper status feedback interface, and target status confirmation interface respectively. The automatic generation system simultaneously generates execution phase index information; the execution phase index information associates "grabbing" with object perception confirmation, object pose binding, proximity path generation, end effector preset, grabbing action execution, grabbing status feedback, and grabbing result confirmation, and records the interface binding relationship and code snippets corresponding to each execution phase; it also associates "placing" with target position confirmation, placement posture generation, transport path generation, arrival status feedback, release action execution, and release result confirmation, and records the interface binding relationship and code snippets corresponding to each execution phase; The automatic generation system performs granular consistency verification in S6. When all interfaces exist, the input and output data types of the interfaces are consistent, each task verb corresponds to a complete execution stage, the code snippet order is consistent with the corrected execution granularity chain, and each task verb has a completion judgment, the system outputs deployable robot control code. If the gripper status feedback interface is missing, the gripping status feedback stage is in an unbound state, the interface existence verification fails, and the automatic generation system outputs a verification failure report. The report records the task verb "grip", the execution stage "grip status feedback", and the reason for failure "missing gripper status feedback interface".
[0035] Example 3: This example describes the robot task as inspecting the status of the power distribution cabinet along the No. 1 inspection route. The target robot is an inspection robot with a mobile chassis, positioning and navigation interface, image acquisition interface and anomaly recognition interface. The automatic generation system obtains the robot task description and robot capability interface information in S1. The robot capability interface information includes the inspection point reading interface, navigation action interface, positioning status feedback interface, image acquisition interface, anomaly recognition interface, and inspection result confirmation interface. The automatic generation system identifies the task verb "inspection" from the robot task description, identifies the execution object as "power distribution cabinet status", identifies the target location as "inspection point in inspection route number one", and identifies the task completion intention as "to complete the data collection of each inspection point in inspection route number one and form inspection results". The automatic generation system establishes an execution granularity chain for the "inspection" task verb in S2, including inspection point confirmation, movement path generation, movement execution, sensor data acquisition, abnormal status identification, and inspection result confirmation. The automatic generation system performs execution granularity collapse checks in S3; if "inspection" in the initial parsing result is only bound to an inspection function call, the automatic generation system adds the inspection point confirmation, movement path generation, movement execution, sensor data acquisition, abnormal state identification, and inspection result confirmation stages; if there is no abnormal identification interface in the robot capability interface set, the abnormal state identification stage is marked as an unbindable stage and retained in the corrected execution granularity chain; The automatic generation system establishes interface binding relationships in S4; the inspection point confirmation stage is bound to the inspection point reading interface; the movement path generation and movement execution stages are bound to the navigation action interface; the positioning feedback during the movement execution process is bound to the positioning status feedback interface; the sensor data acquisition stage is bound to the image acquisition interface; the abnormal status identification stage is bound to the abnormal identification interface if an abnormal identification interface exists, and recorded as unbound if no abnormal identification interface exists; the inspection result confirmation stage is bound to the inspection result confirmation interface. The automatic generation system generates robot control code files in S5; for the bound execution phase, it generates the corresponding task orchestration layer code and interface adaptation layer code; for the case where the abnormal state identification phase is in an unbound state, it does not generate abnormal identification interface call code, and writes the unbound state into the execution phase index information. The automatic generation system performs granular consistency verification in S6. When the execution phase index information record is in an unbound state during the abnormal state identification phase, the interface existence verification fails, and the automatic generation system outputs a verification failure report. This report includes the task verb "inspection", the corresponding execution phase "abnormal state identification", and the reason for failure "missing abnormal identification interface instance". When the abnormal identification interface exists and all other verifications pass, the automatic generation system outputs deployable robot control code.
[0036] Example 4: In this example, the user inputs a natural language task description, "Move the workpiece from the loading position to the detection position," and simultaneously inputs a structured task configuration. In the structured task configuration, the task verb field is "move," the execution object field is "workpiece," the target position field is "detection position," and the task completion intention field is "the workpiece reaches the detection position and the end effector releases." The automatic generation system simultaneously parses the natural language task description and the structured task configuration in S1. Since the structured task configuration already provides the task verbs, execution objects, target locations, and task completion intentions, the automatic generation system uses the structured task configuration as the primary source and uses the natural language task description to confirm the semantic consistency of the task, forming a set of task verbs and a set of robot capability interfaces. In S2, the automatic generation system expands the "transportation" task verb into a continuous execution phase. Since the transportation task involves grasping objects, moving objects, and releasing objects at the target location, the automatic generation system determines the execution granularity chain corresponding to this task verb as: object perception confirmation, object pose binding, proximity path generation, end effector preset, grasping action execution, grasping status feedback, grasping result confirmation, target location confirmation, transportation path generation, arrival status feedback, release action execution, and release result confirmation. In S3, the automatic generation system checks whether the "transfer" task verb is directly bound to a single transfer interface call. If the initial generation result only includes the transfer interface call and lacks grab status feedback, target location confirmation, or release result confirmation, the automatic generation system fills in the missing execution stage and generates a corrected execution granularity chain. In S4, the automatic generation system establishes interface binding relationships for the corrected execution granularity chain. In S5, it generates robot control code files and execution stage index information based on the interface binding relationships. In S6, it performs granularity consistency verification based on the robot control code files and execution stage index information. When the verification passes, it outputs deployable robot control code. When the verification fails, it outputs a verification failure report containing the task verbs that failed the verification, the corresponding execution stage, and the reason for the failure.
[0037] As can be seen from the above embodiments, the present invention is applicable not only to natural language task description, but also to structured task configuration, and to the automatic generation of robot software development code based on a combination of both inputs.
[0038] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for automatically generating robot software development code, characterized in that, Includes the following steps: Obtain robot task description and robot capability interface information, identify the set of task verbs from the robot task description, and form a set of robot capability interfaces from the robot capability interface information; Based on the task verb set and the robot capability interface set, the task verbs are expanded into an execution granularity chain consisting of consecutive execution stages, and a mapping relationship between the task verbs and the execution granularity chain is established. Perform an execution granularity collapse check on the mapping relationship between task verbs and execution granularity chains, and generate a corrected execution granularity chain; Based on the revised execution granularity chain, the control interface type and interface instance are determined for each execution stage, forming an interface binding relationship; Generate robot control code files based on interface binding relationships, and generate execution phase index information; Granular consistency verification is performed based on the robot control code file and execution phase index information. If the verification passes, deployable robot control code is output; if the verification fails, a verification failure report is output.
2. The method for automatically generating robot software development code according to claim 1, characterized in that, Obtain the robot task description and robot capability interface information; identify the set of task verbs from the robot task description; and form a set of robot capability interfaces from the robot capability interface information, including: Obtain a robot task description that includes at least one of natural language task description and structured task configuration; Acquire robot capability interface information, including perception interface, motion control interface, end effector interface, status feedback interface, and task result confirmation interface; Semantic parsing is performed on the robot task description to obtain task verbs, execution objects, target locations, and task completion intentions. The task verbs are then combined into a task verb set, and the robot capability interface information is combined into a robot capability interface set.
3. The method for automatically generating robot software development code according to claim 2, characterized in that, Establish a mapping relationship between task verbs and execution granularity chains, including: Taking each task verb in the task verb set as the processing object, and combining the execution object, target position, task completion intention and robot capability interface set corresponding to the task verb, the task verb is expanded into an execution granularity chain containing multiple consecutive execution stages, and each task verb is associated with its execution granularity chain to obtain the mapping relationship between task verbs and execution granularity chains.
4. The method for automatically generating robot software development code according to claim 3, characterized in that, The execution granularity chain includes: When the task verb is a grasping task verb, the execution granularity chain includes object perception confirmation, object pose binding, proximity path generation, end effector presetting, grasping action execution, grasping status feedback, and grasping result confirmation. When the task verb is a placement-type task verb, the execution granularity chain includes target location confirmation, placement posture generation, transportation path generation, arrival status feedback, release action execution, and release result confirmation. When the task verb is an inspection-type task verb, the execution granularity chain includes inspection point confirmation, movement path generation, movement execution, sensor data acquisition, abnormal status identification, and inspection result confirmation.
5. The method for automatically generating robot software development code according to claim 3, characterized in that, Perform an execution granularity collapse check on the mapping relationship between task verbs and the execution granularity chain, and generate a corrected execution granularity chain, including: Check if the execution granularity chain corresponding to each task verb contains a task verb that is directly bound to a single control primitive, a single interface call, or a combination of interface calls that does not cover the execution stage in the execution granularity chain corresponding to that task verb; When the binding or interface call combination results in the absence of any of the required stages in the execution granularity chain corresponding to the task verb, such as the perception confirmation stage, coordinate binding stage, motion transition stage, execution process feedback stage, and task completion determination stage, the missing execution stage is filled in according to the robot capability interface set to generate a corrected execution granularity chain.
6. The method for automatically generating robot software development code according to claim 5, characterized in that, When the added execution phase cannot be matched with a control interface type or interface instance in the robot capability interface set, the execution phase is marked as an unbindable phase and retained in the corrected execution granularity chain.
7. The method for automatically generating robot software development code according to claim 6, characterized in that, Based on the revised execution granularity chain, control interface types and interface instances are determined for each execution stage, forming interface binding relationships, including: Bind the continuous state acquisition phase or the sensor data input phase to a subscription interface; Bind the one-time query phase, configuration phase, or coordinate transformation phase to a request-response interface; Bind long-cycle, feedback-enabled, and cancelable motion or operation phases to action-type interfaces; Bind the immediate triggering phase of the end-point tool to the driver control interface; The unbindable stage where an interface instance cannot be bound is recorded as an unbound state, thus forming an interface binding relationship.
8. The method for automatically generating robot software development code according to claim 7, characterized in that, Generate robot control code files based on the interface binding relationship, and generate execution phase index information, including: Based on the interface binding relationship, task orchestration layer code and interface adaptation layer code are generated. The task orchestration layer code organizes the order of the bound execution stages according to the modified execution granularity chain, and generates entry conditions, interface calls, feedback processing, completion conditions and exception exits for the bound execution stages. The interface adaptation layer code calls the control interface type and interface instance corresponding to the bound interface instance according to the interface binding relationship; For execution phases that are in an unbound state in the interface binding relationship, no interface call code is generated, and the unbound state of that execution phase is written into the execution phase index information.
9. The method for automatically generating robot software development code according to claim 8, characterized in that, The execution phase index information includes the association between each task verb, the execution phase corresponding to the task verb, the interface binding relationship corresponding to the execution phase, the code snippet corresponding to the bound execution phase, and the unbound state corresponding to the unbound execution phase.
10. The method for automatically generating robot software development code according to claim 9, characterized in that, Granular consistency verification is performed based on the robot control code file and execution phase index information, including: Based on the robot control code file and execution phase index information, the robot control code file is subjected to interface existence verification, interface input and output data type consistency verification, execution phase integrity verification, phase sequence consistency verification, and completion judgment integrity verification. When all the above verifications pass, deployable robot control code is output. When any verification fails, a verification failure report is output, which includes the task verb that failed the verification, the corresponding execution phase, and the reason for the failure.