System and method for controlling movement of mechanical arm based on JS programming
Control the movement of the robot arm through JavaScript programming, reduce programming instructions using JS calculation modules and interpolation methods, and encapsulate G instructions in the CNC programming language, solving the problems of cumbersome programming and dynamic adjustment in the robot arm control system, improving implementation efficiency and system Functional.
Patent Information
- Application Number
- CN202410989893.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-15
AI Technical Summary
The existing robotic arm control system has cumbersome programming process when processing a large number of points, and cannot dynamically adjust the points, which affects efficiency.
JavaScript programming is used to control the movement of the robotic arm, calculate points through the JS calculation module, reduce the number of programming instructions, control the movement of the robotic arm using interpolation, and encapsulate the G instructions of the CNC programming language to achieve higher-level abstract and complex operations.
Dynamic calculation and optimization of the movement points of the robotic arm are realized, the number of instructions in the programming process is reduced, the convenience and efficiency of on-site implementation is improved, and the flexibility and functionality of the system are enhanced.
Smart Images

Figure CN118952254A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of robot arm control, and in particular relates to a system and method for controlling the movement of a robot arm based on JS programming. Background Art
[0002] With the continuous development of industrial technology, there have been great breakthroughs in the control system of robotic arms. Robotic arm control is one of the key technologies to achieve robot automation and intelligence. It involves how to accurately control the movement, force, perception, and feedback of the robotic arm. Through in-depth research on robotic arm control, the robot's operating ability and accuracy can be improved, and the application of robots in industry, medicine, aerospace and other fields can be further expanded.
[0003] Path planning is an important technology for robot control, which focuses on how to plan the optimal path from the starting position to the target position of the robot. Commonly used path planning algorithms include rule-based planning, visibility graph method, free space method, etc. Path planning can ensure that the robot will not collide with obstacles during movement and complete the work task efficiently. Usually this method requires pre-programming of points in the robot control system so that the robot moves according to the predetermined point path.
[0004] However, when the number of points is very large, the existing programming process becomes very cumbersome, increasing the debugging time of on-site implementation personnel, or when some scenarios require dynamic adjustment of points, the pre-set points cannot be applied, affecting actual efficiency. Summary of the invention
[0005] Purpose of the invention: The purpose of the present invention is to address the deficiencies in the prior art and to provide a system and method for controlling the movement of a robotic arm based on JS programming. By calculating the points through JS, the number of instructions in the programming process in the robotic arm control system can be reduced, making on-site implementation more convenient and easy.
[0006] Technical solution: The system for controlling the movement of a robotic arm based on JS programming of the present invention comprises: The JS calculation module saves the point calculation method in the form of JS code, and uses the point calculation method to calculate the feedback point or the preset value to obtain a new point; The instruction module has a variable table, which stores the IO of all lower computers and the point variables required by the JS calculation module. The parameter values of the point variables are input from the point data calculated by the JS calculation module; The control module obtains the point data by reading the variable table of the instruction module and sends a control instruction to the lower computer, and controls the movement of the robot arm by interpolating the point data between the current point and the target point. The interpolation method makes the movement of the robot arm smoother and more reliable.
[0007] To further improve the above technical solution, the variable table is created when the program starts and can be directly accessed through high-level instructions.
[0008] Furthermore, the high-level instructions are encapsulations of G instructions, which use numerical control programming languages to control the movement and operation of the robot arm. The control instructions can perform operations including point adjustment, IO judgment, signal detection, and variable storage and modification.
[0009] Furthermore, the JS calculation module is integrated in the instruction module, and the pre-edited JS code is run through the JS runtime engine to calculate the new point and transmit the result back to the control module.
[0010] Furthermore, the point calculation method compiles several movement instructions of the same type but different positions into one instruction through JS code. The same type of high-level instructions belonging to movement, such as MOVEJ, MOVEL, MOVEC, etc., but with different positions (i.e., the parameters behind these high-level movement instructions are different) are compiled into one instruction using JS code.
[0011] The method for controlling the movement of a robotic arm using the system for controlling the movement of a robotic arm using JS programming comprises the following steps: Save the point calculation method in the form of JS code into the JS calculation module; During the operation of the robot arm, the position is continuously calculated and updated, and the position variables are updated; The feedback point of the robot arm is passed to the JS calculation module in the form of JS variables through the instruction module; Run the pre-edited JS code through Qt's built-in JS runtime engine to calculate new points; The calculated position is transmitted back to the control module through the command module, and the robot arm is controlled to run according to the new position.
[0012] Furthermore, the JS calculation module is integrated in the instruction module, and the pre-edited JS code is run through the JS runtime engine provided by Qt to calculate the new point and transmit the result back to the control module.
[0013] Furthermore, the instructions include G instructions and advanced instructions, and the advanced instructions are encapsulations of G instructions and can execute operations including point adjustment, IO judgment, signal detection, and variable storage and modification.
[0014] Furthermore, the point calculation method compiles several movement instructions of the same type but with different points into one instruction through JS code.
[0015] Furthermore, the variable table in the instruction module stores the point variables required by the IO and JS calculation modules of all lower computers. The variable table is created at the beginning of the program and can be directly accessed through high-level instructions.
[0016] Beneficial effects: Compared with the prior art, the advantages of the present invention are: the present invention uses JavaScript to write a point calculation method, allowing dynamic calculation of feedback points or preset values to generate new robot arm movement points. This flexibility allows the system to adjust and optimize points according to real-time feedback or preset conditions; it encapsulates the G instructions in the CNC programming language, and provides a higher level of abstraction for robot arm movement and operation. These instructions are not limited to simple point adjustments, but can also perform complex operations such as IO judgment, signal detection, and variable storage and modification, thereby enhancing the functionality and flexibility of the system; through Js code points, the same type of movement instructions but different points are written into one instruction, thereby reducing the number of instructions in the programming process of the robot arm control system. It is only necessary to process the existing points or measured points according to a certain formula (some point adjustment schemes are summarized according to the operation trajectory of the robot arm, which are usually point addition, subtraction, multiplication and division) or rules (such as point accumulation or subtraction) during the programming process to obtain subsequent points, thereby reducing the number of repeated instructions and making on-site implementation more convenient and easy. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a structural schematic diagram of the present invention. DETAILED DESCRIPTION
[0018] The technical solution of the present invention is described in detail below with reference to the accompanying drawings, but the protection scope of the present invention is not limited to the embodiments.
[0019] Example 1: Figure 1 The method of controlling the motion flow of the robot arm based on JS (JavaScript) programming shown in the figure reduces the number of instructions in the programming process of the robot arm control system by calculating the points by JS. It only needs to process the existing points or measured points according to a certain formula or rule to obtain the subsequent points during the programming process, thereby reducing the number of repeated instructions and making on-site implementation more convenient and easy.
[0020] The present invention is developed based on the existing robot arm control software and is divided into three modules: a control module instruction module that sends data to the lower position, and a JS calculation module. Among them, the control module and the instruction module are mainly provided by the Robot software, and the JS calculation module is a part of the instruction module. There is a variable table in the instruction module, which stores the IO of all lower machines and the point variables required by the JS calculation module. The variable table is created at the beginning of the program, and its parameters are changed by inserting the variable name and value into the variable table through high-level instructions. Some high-level instructions that need to use the variables in the variable table can directly access the variable table, and then obtain or modify the corresponding values in the variable table. The JS high-level instruction will access the variable table, obtain the feedback point and modify the value of the next point variable.
[0021] Instruction module: After writing instructions, the robot can run according to the path specified by the instructions. Instructions are divided into G instructions and advanced instructions. G instructions are a widely used CNC programming language. G instructions can be used to control the movement and operation of the robot, but it is difficult for people who do not have a basic understanding of G instructions to understand the meaning of each G instruction. Advanced instructions are encapsulation of G instructions. Compared with G instructions, advanced instructions are easier to understand. Usually, the operator uses advanced instructions to control the robot. For example, to move the robot to coordinates (100, 200, 300): G command: G01 X100 Y200 Z300 The high-level command is: MoveL X=100 Y=200 Z=300 At the same time, high-level instructions can also realize other operations, such as IO judgment, signal detection, variable storage and modification, etc. JS programming to control the position of the robot arm is an advanced instruction. The high-level instructions for operating the robot arm will eventually be translated into corresponding G instructions and sent to the robot arm, and the robot arm will move to the corresponding position according to the G instructions.
[0022] Control module: mainly controls the path planning task of the robot. The control module is mainly based on the robot path planning algorithm, and the main content is to make the movement of the robot smoother and more reliable by interpolation based on the current point and the target point.
[0023] JS calculation module: calculate the next point through the existing point or preset value. First, write the JS code to be executed, pass the position feedback by the robot arm to the built-in JS engine in the form of variables, execute the JS code, and finally pass the point data after the JS code is executed to a global variable table in the form of variables, waiting for the program to be called.
[0024] The control module is mainly responsible for sending instructions to the lower computer, and the JS calculation module is responsible for sending point data to the control module. The JS calculation module is integrated in the instruction module. The original multiple movement instructions of the same type and different points are written into one instruction, and the value calculated by JS is sent to the robot arm through the control system. It can reduce the implementation personnel from repeatedly writing the same instructions and improve the efficiency of on-site implementation.
[0025] Example 2: Through the description of Example 2, it can be seen that the present invention improves the implementation efficiency.
[0026] For a continuously moving robotic arm, the position may need to be temporarily adjusted in different situations. At this time, it is necessary to judge many situations and use high-level instructions to continuously adjust the operating position of the robotic arm. This will result in too many high-level instructions, and the difficulty of maintenance and implementation will increase. However, using JS to calculate the position only requires writing a piece of JS code to replace the original multiple high-level instructions.
[0027] For example, four instructions are required: IF X>100 MoveL X=50 IF X<100 MoveL X=150 Using JS only requires two instructions, and variable is the output variable of the JS instruction: ExecJS MoveL X=variable The logic of actual application scenarios will be more complicated, and it is difficult to implement the logic only with high-level instructions. However, it will be easier to implement in JS code, and more instructions can be reduced.
[0028] Implementation steps: 1. Save a certain point calculation method in the form of JS code into the instruction system; 2. Run the robot arm according to the edited instructions; 3. During the operation of the robot arm, the position is continuously calculated and updated and the position variables are updated. The process is as follows: 1) The feedback point of the robot arm is transmitted to the JS calculation module in the form of JS variables through the control module.
[0029] 2) Use Qt's built-in JS runtime engine to run the pre-edited JS code to calculate the new point.
[0030] 3) The calculated points are transmitted back to the control module through the command system.
[0031] 4) The control module controls the robot arm to run according to the new position.
[0032] JS is a scripting language that is simpler to learn than other languages, which can lower the threshold for implementation personnel; JS only requires a JS engine to execute, while languages such as C, C++, and Java need to be compiled into executable files before they can run.
[0033] As described above, although the present invention has been shown and described with reference to specific preferred embodiments, it should not be construed as limiting the present invention itself. Various changes in form and details may be made without departing from the spirit and scope of the present invention as defined in the appended claims.
Claims
1. A system for controlling the movement of a robotic arm based on JS programming. It is characterized in that include: The JS calculation module saves the point calculation method in the form of JS code, and uses the point calculation method to calculate the feedback point or the preset value to obtain a new point; The instruction module has a variable table, which stores the IO of all lower computers and the point variables required by the JS calculation module. The parameter values of the point variables are input from the point data calculated by the JS calculation module; The control module obtains the point data and sends a control instruction to the lower computer by reading the variable table of the instruction module, and controls the movement of the robot arm by interpolating the point data between the current point and the target point.
2. According to the system for controlling the movement of the robotic arm based on JS programming according to claim 1, Features: The variable table is created at the beginning of the program and can be directly accessed by high-level instructions.
3. According to claim 2, the system for controlling the movement of the robotic arm based on JS programming, Features: The high-level instructions are encapsulations of G instructions, which use numerical control programming language to control the movement and operation of the robot arm. The control instructions can perform operations including point adjustment, IO judgment, signal detection, and variable storage and modification.
4. A system for controlling the movement of a robotic arm based on JS programming according to any one of claims 1 to 3, Features: The JS calculation module is integrated in the instruction module, and runs the pre-edited JS code through the JS runtime engine to calculate the new point and transmit the result back to the control module.
5. The system according to any one of claims 1 to 3, It is characterized in that The point calculation method compiles several movement instructions of the same type but with different points into one instruction through JS code.
6. A method for controlling the movement of a robotic arm based on JS programming. It is characterized in that The following steps are involved: Save the point calculation method in the form of JS code into the JS calculation module; During the operation of the robot arm, the position is continuously calculated and updated, and the position variables are updated; The feedback point of the robot arm is passed to the JS calculation module in the form of JS variables through the instruction module; Run the pre-edited JS code through Qt's built-in JS runtime engine to calculate new points; The calculated position is transmitted back to the control module through the command module, and the robot arm is controlled to run according to the new position.
7. The method according to claim 6, It is characterized in that The JS calculation module is integrated in the instruction module, and runs the pre-edited JS code through the JS runtime engine provided by Qt, calculates the new point and transmits the result back to the control module.
8. The method according to claim 6, It is characterized in that The instructions include G instructions and advanced instructions. The advanced instructions are encapsulation of G instructions and can execute operations including point adjustment, IO judgment, signal detection, and variable storage and modification.
9. The method according to claim 6, It is characterized in that The point calculation method compiles several movement instructions of the same type but with different points into one instruction through JS code.
10. The method according to claim 6, It is characterized in that The variable table in the instruction module stores the point variables required by the IO and JS calculation modules of all lower computers. The variable table is created at the beginning of the program and can be directly accessed through high-level instructions.
