A control method, apparatus, device, and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JIANGSU COWAIN AUTOMATION TECH
- Filing Date
- 2023-02-27
- Publication Date
- 2026-07-03
AI Technical Summary
Existing motion control methods, which rely on polling, result in excessively long program code that is difficult to read and understand. The nested recursive logic is complex, making it difficult to modify when actions change and easily leading to bugs and incomplete actions.
By employing a multi-threaded parallel approach, the system acquires a set of motion commands from the target device, iteratively obtains the triggering conditions and current state of each motion command, and controls the target device according to the control parameters to ensure the integrity of the action execution and avoid duplicate or missed triggers.
In a multi-threaded parallel environment, the integrity of device actions is achieved, avoiding repeated or missed triggering of motion commands, simplifying program writing and understanding, and improving the maintainability of the action flow.
Smart Images

Figure CN116149730B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a control method, apparatus, device, and storage medium. Background Technology
[0002] Existing motion control methods typically use a polling approach to control the device's motion flow. This involves defining the device's motion relationships, and after completing one motion, jumping to the processing flow of the next. If an error or exception occurs during the execution of the previous motion, the system jumps to a pre-defined error handling flow (such as a pop-up window) based on the result. Then, based on the user's selection in the pop-up window, it jumps back to the corresponding motion flow, repeating this process continuously to complete the entire device's motion flow.
[0003] However, the action logic of the polling scheme is deeply embedded in the entire polling jump code segment. The polling program code can easily reach thousands of lines in length, and the constant jumps make the program difficult to read and understand. Furthermore, the nested recursive logic exacerbates the scope of the program jumps. When action changes occur, a large number of jumps need to be modified, which can easily lead to difficulties in understanding and cause bugs and incomplete actions in the program. Summary of the Invention
[0004] This invention provides a control method, apparatus, device, and storage medium to ensure the integrity of device action execution in a multi-threaded parallel environment, and to avoid repeated or missed triggering of motion commands.
[0005] According to one aspect of the present invention, a control method is provided, the method comprising:
[0006] Obtain the motion instruction set corresponding to the target device, wherein the motion instruction set includes motion instructions configured in a uniform format, with each target component in the target device as a unit of basic motion, and all of the motion instructions constitute the motion instruction set;
[0007] The motion command includes the triggering condition, control parameters and current state of the basic action, wherein each triggering condition and control parameter is pre-written into a preset program template corresponding to each motion command according to the preset action flow corresponding to the target device.
[0008] The triggering condition and current state of each motion instruction in the set of motion instructions are obtained in a loop.
[0009] If the current state of the target device is detected to meet the triggering conditions corresponding to the motion command, then the target device is controlled according to the control parameters corresponding to the motion command.
[0010] According to another aspect of the present invention, a control device is provided, the device comprising:
[0011] The first acquisition module is used to acquire a set of motion instructions corresponding to the target device. The set of motion instructions includes motion instructions configured in a uniform format, with each target component in the target device as a unit for the basic actions. All of the motion instructions constitute the set of motion instructions.
[0012] The motion command includes the triggering condition, control parameters and current state of the basic action, wherein each triggering condition and control parameter is pre-written into a preset program template corresponding to each motion command according to the preset action flow corresponding to the target device.
[0013] The second acquisition module is used to cyclically acquire the triggering condition and current state of each motion instruction in the motion instruction set;
[0014] The control module is used to control the target device according to the control parameters corresponding to the motion command if it is detected that the current state of the target device meets the triggering condition corresponding to the motion command.
[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0016] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the control method described in any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the control method described in any embodiment of the present invention.
[0018] The technical solution of this invention obtains a set of motion commands corresponding to the target device, and cyclically obtains the triggering condition and current state of each motion command in the set of motion commands. If the current state of the target device is detected to meet the triggering condition of the motion command, the target device is controlled according to the control parameters corresponding to the motion command. This achieves the goal of ensuring the integrity of device action execution in the case of multi-threaded parallelism and avoids repeated or missed triggering of motion commands.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart of a control method provided according to Embodiment 1 of the present invention;
[0022] Figure 2 This is a schematic diagram of a control method provided according to Embodiment 1 of the present invention;
[0023] Figure 3 This is a flowchart illustrating a control method according to Embodiment 1 of the present invention;
[0024] Figure 4 This is a schematic diagram of the structure of a control device according to Embodiment 2 of the present invention;
[0025] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the control method of the present invention. Detailed Implementation
[0026] To enable those skilled in the art to better understand the present invention, 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. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first," "target," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0028] Example 1
[0029] Figure 1 This is a flowchart of a control method according to Embodiment 1 of the present invention. This embodiment is applicable to control situations. The method can be executed by a control device, which can be implemented in hardware and / or software. The control device can be integrated into any electronic device that provides control functions. Figure 1 As shown, the method includes:
[0030] S101. Obtain the set of motion commands corresponding to the target device.
[0031] In this embodiment, the target device can be a device to be motion controlled, and the target device includes at least one target component.
[0032] The motion instruction set includes motion instructions configured in a uniform format, with each target component in the target device as a unit for its basic actions. All of these motion instructions constitute the motion instruction set.
[0033] Among them, motion commands can be commands that control the target device to move.
[0034] In this embodiment, the basic action is the smallest indivisible single action, such as the extension and retraction of the cylinder, which each have their corresponding functions. In this case, the basic action includes the actions corresponding to the extension command and the retraction command.
[0035] Motion commands include the triggering conditions for basic movements, control parameters, and the current state.
[0036] Each trigger condition and control parameter is pre-written into a preset program template corresponding to each motion command based on the preset action flow corresponding to the target device.
[0037] It should be noted that the triggering condition can be the condition that triggers the execution of a motion command. When the triggering condition is met, the motion command is executed; when the triggering condition is not met, the motion command is not executed.
[0038] It should be explained that control parameters can be understood as the parameters corresponding to the control target device executing specific content (such as cylinder movement or shaft movement) when the triggering conditions of the motion command are met. For example, control parameters can be: the moving distance of the cylinder, the moving speed of the cylinder, the rotation speed of the motor, or the number of rotations of the motor, etc.
[0039] The preset action flow corresponding to the target device can be a pre-set motion control action flow diagram for the target device. Each motion command corresponding to the target device has a preset program template, and the motion commands corresponding to each target component can be configured to a uniform format.
[0040] In actual operation, first obtain the motion control action flowchart corresponding to the target device, and then write the program for each motion instruction according to the action flowchart. The program is a unified template, and you only need to fill in the corresponding trigger conditions and control parameters (these two are the necessary elements to form a motion unit). It is very convenient for program execution and problem finding.
[0041] It should be noted that the current state can be a set of states that maintain the execution of this motion command. The current state of the target device can be mainly divided into the ready state, the running state, and the finished state. In actual operation, the execution of each motion command is switched based on the current state of the target device.
[0042] Specifically, the motion instruction set corresponding to the target device is obtained. The motion instruction set includes motion instructions configured in a unified format, with each target component in the target device as a unit for the basic action. All motion instructions constitute the motion instruction set. The motion instruction includes the triggering conditions, control parameters and current state of the basic action. Each triggering condition and control parameter is written into the preset program template corresponding to each motion instruction in advance according to the preset action flow corresponding to the target device.
[0043] S102. Loop through the set of motion instructions to obtain the triggering condition and current state of each motion instruction.
[0044] In actual operation, the program obtains the triggering conditions and current state of each motion instruction in the motion instruction set by looping through the program (which is very fast, checking many times per second).
[0045] S103. If the current state of the target device is detected to meet the triggering conditions corresponding to the motion command, then the target device is controlled according to the control parameters corresponding to the motion command.
[0046] Specifically, during program execution, the program compares the trigger conditions of all motion commands with the current state of the target device by looping through the system (it checks very quickly, many times per second). If the current state of the target device meets the trigger conditions of the motion command, the program triggers the action and controls the target device according to the control parameters corresponding to the motion command.
[0047] In actual operation, collision avoidance detection is performed before each motion is executed. When a motion command executes a certain action, the collision avoidance conditions are detected and then corresponding processing is carried out.
[0048] The technical solution of this invention obtains a set of motion commands corresponding to the target device, and cyclically obtains the triggering condition and current state of each motion command in the set of motion commands. If the current state of the target device is detected to meet the triggering condition of the motion command, the target device is controlled according to the control parameters corresponding to the motion command. This achieves the goal of ensuring the integrity of device action execution in the case of multi-threaded parallelism and avoids repeated or missed triggering of motion commands.
[0049] Optionally, the triggering conditions and control parameters of at least one motion command corresponding to the target device are obtained, including:
[0050] Obtain the identification information of at least one motion command corresponding to the target device.
[0051] In this embodiment, the identification information can be information used to identify each movement command. Specifically, the identification information can be preset by the user according to the actual situation. For example, the identification information can be a numerical code, such as movement command 1, movement command 2, etc., or it can be an alphabetical code, such as movement command A, movement command B, etc. This embodiment does not limit this.
[0052] Specifically, it obtains the identification information of each motion command corresponding to the target device.
[0053] The target database is queried based on the identification information of at least one motion command to obtain the correspondence and control parameters between each motion command.
[0054] In this embodiment, the target library can be a database used to store the control parameters of each motion command corresponding to the target device, as well as the correspondence between each motion command. The correspondence between each motion command can be a dependency relationship between them. Since most motion control actions are executed sequentially, the correspondence between each motion command can be, for example, whether a certain motion command can be executed depends on whether its preceding motion commands have been completed, or whether the execution logic between motion commands is serial or parallel.
[0055] Specifically, users can determine the correspondence and control parameters between each motion command based on the motion control flowchart corresponding to the target device, and store the correspondence and control parameters between each motion command in the target library. Then, they can query the target library based on the identification information of at least one motion command to obtain the correspondence and control parameters between each motion command.
[0056] The triggering condition for at least one motion command corresponding to the target device is determined based on the correspondence between each motion command.
[0057] Specifically, the triggering condition for at least one motion command corresponding to the target device is determined based on the correspondence between each motion command.
[0058] For example, if motion instruction B is defined as dependent on the ending state of motion instruction A (i.e., motion instruction B only starts executing after motion instruction A has finished executing), motion instruction B starts executing when motion instruction A is in the ending state. Due to multithreading, when motion instruction B is triggered to start executing, motion instruction A needs to maintain the ending state until motion instruction B starts. Only then can motion instruction A transition from the ending state to the ready state to wait for the next round of triggering. This mechanism ensures that motion instructions are not triggered multiple times or repeatedly, thus guaranteeing the correctness of the motion.
[0059] Optionally, the target device includes at least one target component.
[0060] In this embodiment, the target device may include many target components, such as cylinder A, cylinder B, and motor A.
[0061] Accordingly, the current state of the target device is obtained, including:
[0062] Obtain the current state of at least one target component corresponding to the target device.
[0063] Specifically, it obtains the current state of all target components included in the target device.
[0064] Optionally, if the current state of the target device is detected to meet the triggering condition corresponding to the motion command, the target device is controlled according to the control parameters corresponding to the motion command, including:
[0065] If the current state of at least one target component corresponding to the target device is detected to meet the triggering condition corresponding to the motion command, then the at least one target component corresponding to the target device is controlled according to the control parameters corresponding to the motion command.
[0066] Specifically, during program execution, the program repeatedly checks (very quickly, many times per second) the trigger conditions of all motion commands and compares them with the current states of all target components included in the target device. If the current state of any target component in the target device meets the trigger condition corresponding to the motion command, the trigger action is performed, and the target component in the target device is controlled according to the control parameters corresponding to the motion command. For example, if the current state of cylinder A in the target device meets the trigger condition corresponding to the motion command, then cylinder A in the target device is controlled according to the control parameters corresponding to the motion command.
[0067] Optionally, after controlling at least one target component corresponding to the target device according to the control parameters corresponding to the motion command, the method further includes:
[0068] Get the current state of the target component.
[0069] Specifically, it obtains the current state of the target components included in the target device.
[0070] If at least one target component corresponding to the target device is detected to respond to a motion command and execute a target operation within a preset time, the current state of the target component is updated.
[0071] The preset time can be a time set by the user according to the actual situation. In this embodiment, the specific duration of the preset time is not limited.
[0072] It should be noted that the target operation can be the action corresponding to a motion command. For example, the target operation could be the extension of a cylinder, the repositioning of a cylinder, or the rotation of a motor.
[0073] Specifically, if at least one target component corresponding to the target device is detected to respond to a motion command and execute the target operation corresponding to the motion command within a preset time, the current state of the target component is updated.
[0074] Otherwise, generate and display an error pop-up.
[0075] Error pop-ups can be pop-ups used to remind users that the program has encountered an error.
[0076] Specifically, if at least one target component corresponding to the target device fails to respond to the motion command or execute the target operation corresponding to the motion command within the preset time, it indicates that the motion command is faulty. Generally, there are two types of errors: command error and execution error. A command error means the motion command was not successfully sent, while an execution error means the target component failed to execute. Both types can generally be handled using timeout detection. Error handling typically includes pop-up windows and alarms. For equipment control, manual intervention is usually required after an error occurs, so the above two methods are generally used for error handling.
[0077] In actual operation, timeout monitoring and error handling can be performed on each action command, which can prompt the user of the error location and handling method to the greatest extent. The program provides a unified processing interface for error handling and timeout handling. Users only need to define the corresponding processing method in the corresponding interface function, and the corresponding processing method will be automatically called when the command fails or execution fails.
[0078] Optionally, the current state of the target component includes: ready state, running state, and finished state.
[0079] In this embodiment, the preparation state can be the state in which the target component is preparing to move, the running state can be the state in which the target component is moving, and the ending state can be the state in which the target component has completed its movement.
[0080] Optionally, the motion command status is set to ready.
[0081] If the triggering conditions on which the target device depends are met, the target device is controlled to take action and its state is changed to running. When scanning again, the control of the target device is skipped.
[0082] Parallel operation: When it is detected that all motion commands that the target device depends on are in the running state, the state of the target device is changed to the ready state.
[0083] Optionally, the target components include: a first power element, a second power element, and a third power element.
[0084] Accordingly, if the current state of at least one target component corresponding to the target device is detected to meet the triggering condition corresponding to the motion command, then the at least one target component corresponding to the target device is controlled according to the control parameters corresponding to the motion command, including:
[0085] If the current state of the first power element is the end state, then the first power element is controlled according to the control parameters corresponding to the motion command.
[0086] If the current state of the first power element is ready, the second power element is controlled according to the control parameters corresponding to the motion command.
[0087] If the current state of the second power element is the end state, then the third power element and the first power element are controlled according to the control parameters corresponding to the motion command.
[0088] As an exemplary description of an embodiment of the present invention Figure 2 This is a schematic diagram of a control method provided according to Embodiment 1 of the present invention. Figure 2 As shown, a target device includes target components: a first power element, a second power element, and a third power element. For example, the first power element can be denoted as cylinder A, the second power element as cylinder B, and the third power element as motor A. Assume the target device needs to perform the following actions: after initialization, cylinder A extends (to a preset length; specifically, the preset length can be pre-set by the user according to actual conditions; this embodiment does not specifically limit the specific value of the preset length) and then cylinder B extends (to the end of its stroke). After cylinder B extends, motor A rotates to drive a certain mechanism to rotate, while cylinder A resets.
[0089] Although both cylinder A and cylinder B extend in the above process, there are three differences: cylinder A takes longer to extend, while cylinder B can be executed as soon as it starts moving, without relying on cylinder A; the extension length of cylinder A needs to be controlled, and cylinder B can only be triggered when it extends to a preset length; the extension and resetting of cylinder A need to be controlled separately to handle different steps, while cylinder B only extends simply, and its resetting does not need to be controlled independently, for example, cylinder B is a self-resetting cylinder.
[0090] In actual operation, motion commands are independent. When writing the program, you only need to define the trigger conditions and control parameters for each motion command. Unlike polling methods, it does not require writing the program according to a flow and writing out various jumps in sequential logic.
[0091] Specifically, Figure 3 This is a flowchart illustrating a control method according to Embodiment 1 of the present invention, as shown below. Figure 3 As shown, the complete action flow of the entire control method program can be described as follows:
[0092] First, the current states of all motion commands and target components are initialized. This involves checking the trigger conditions and control parameters of each motion command, resetting the current state of each target component (i.e., initialization; after initialization, all target components are in a finished state, and all motion commands await execution), and establishing relationships—that is, establishing the correspondence between each motion command and a mechanism of mutual dependence. A dependency list can be created to associate serial and parallel motion commands. In this dependency mechanism, a single trigger occurs when a condition for a motion command is met, and the target device is controlled according to the control parameters corresponding to that motion command. For example, after initialization, cylinder A performs the target operation (i.e., extends to a preset length). After execution, the current state of cylinder A is changed to the ready state to prevent duplicate triggering. During execution, cylinder A's state changes to the running state. During this time, because cylinder A is in the running state, the trigger scan of the motion command corresponding to cylinder A is skipped.
[0093] After initialization, cylinder A is in the "final" state, satisfying the triggering conditions corresponding to the motion command for cylinder A. Cylinder A is then controlled according to the control parameters corresponding to the motion command, extending to a preset length. During the extension process, cylinder A is in the "running" state. Once cylinder A has extended to the preset length, its current state is updated to the "ready" state.
[0094] After cylinder A extends to the preset length, its current state is the ready state, satisfying the triggering conditions corresponding to the motion command of cylinder B. Cylinder B is then controlled to extend according to the control parameters corresponding to the motion command. During the extension process, cylinder B's current state is the running state. After the extension is complete, cylinder B's current state is updated to the finished state.
[0095] Once cylinder B's current state is updated to the finished state, the trigger conditions for cylinder A's reset and motor A's action are met. Both motor A's action and cylinder A's reset are triggered by cylinder B's finished state. This raises a problem: if motor A and cylinder A's actions occur sequentially, triggering will fail. That is, if motor A acts first, and (according to a single triggering logic) cylinder B's state switches to the ready state, cylinder A will not trigger. Therefore, due to parallel dependencies, cylinder B has two dependencies. Only when both its associated motor A and cylinder A are in the running state will cylinder B change its state to the ready state. Furthermore, if motor A executes first, and its dependent cylinder B is still in the finished state, to prevent duplicate triggering, cylinder B needs to mark the already executed motion command as complete, indicating that a target component (motor A or cylinder A) has already been executed and does not need to be triggered again.
[0096] The technical solution of this invention constructs a novel motion control method. It utilizes a unified format of motion instructions to form various serial or parallel motion actions. Only the program for each motion instruction needs to be written according to the motion flowchart, and the program uses a unified template. Only the corresponding trigger conditions and control parameters (both essential elements of a motion unit) need to be filled in. This makes program execution and troubleshooting very convenient. The mechanism of interdependence between motion instructions allows for the formation of serial action groups by registering the motion instructions that depend on them. This mechanism can ensure the integrity of the target device's motion execution in multi-threaded parallel environments, avoiding duplicate or missed triggering of motion instructions.
[0097] Example 2
[0098] Figure 4 This is a schematic diagram of a control device according to Embodiment 2 of the present invention. Figure 4 As shown, the device includes: a first acquisition module 201, a second acquisition module 202, and a control module 204.
[0099] The second acquisition module 201 is used to acquire a set of motion instructions corresponding to the target device. The set of motion instructions includes motion instructions configured in a uniform format, with each target component in the target device as a unit for the basic actions. All of the motion instructions constitute the set of motion instructions.
[0100] The motion command includes the triggering condition, control parameters and current state of the basic action, wherein each triggering condition and control parameter is pre-written into a preset program template corresponding to each motion command according to the preset action flow corresponding to the target device.
[0101] The second acquisition module 202 is used to cyclically acquire the triggering condition and current state of each motion instruction in the motion instruction set;
[0102] The control module 204 is used to control the target device according to the control parameters corresponding to the motion command if it is detected that the current state of the target device meets the triggering condition corresponding to the motion command.
[0103] Optionally, the second acquisition module 202 includes:
[0104] The first acquisition unit is used to acquire the identification information of at least one motion command corresponding to the target device;
[0105] The query unit is used to query the target library based on the identification information of at least one motion command to obtain the correspondence and control parameters between each motion command;
[0106] The determining unit is used to determine the triggering condition of at least one motion command corresponding to the target device based on the correspondence between each motion command.
[0107] Optionally, the target device includes at least one target component;
[0108] Accordingly, the third acquisition module 203 includes:
[0109] The second acquisition unit is used to acquire the current state of at least one target component corresponding to the target device.
[0110] Optionally, the control module 204 includes:
[0111] The control unit is configured to control at least one target component corresponding to the target device according to the control parameters corresponding to the motion command if it is detected that the current state of at least one target component corresponding to the target device meets the triggering condition corresponding to the motion command.
[0112] Optionally, the control module 204 further includes:
[0113] The third acquisition unit is used to acquire the current state of the target component after controlling at least one target component corresponding to the target device according to the control parameters corresponding to the motion command.
[0114] The update unit is configured to update the current state of the target component if, after controlling at least one target component corresponding to the target device according to the control parameters corresponding to the motion command, it is detected within a preset time that at least one target component corresponding to the target device responds to the motion command and performs a target operation.
[0115] The generation and display unit is used to generate and display an error pop-up window after controlling at least one target component corresponding to the target device according to the control parameters corresponding to the motion command; otherwise, it generates an error pop-up window.
[0116] Optionally, the current state of the target component includes: a ready state, a running state, and an ended state.
[0117] Optionally, the motion command is set to a ready state;
[0118] If the triggering condition on which the target device depends is detected to be met, the target device is controlled to act and its state is changed to running state. When scanning again, the control of the target device is skipped.
[0119] When it is detected that all motion commands relied upon by the target device are in a running state, the state of the target device is changed to a ready state.
[0120] The control device provided in the embodiments of the present invention can execute the control method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0121] Example 3
[0122] Figure 5 A schematic diagram of an electronic device 30 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0123] like Figure 5As shown, the electronic device 30 includes at least one processor 31 and a memory, such as a read-only memory (ROM) 32 or a random access memory (RAM) 33, communicatively connected to the at least one processor 31. The memory stores computer programs executable by the at least one processor. The processor 31 can perform various appropriate actions and processes based on the computer program stored in the ROM 32 or loaded from storage unit 38 into the RAM 33. The RAM 33 can also store various programs and data required for the operation of the electronic device 30. The processor 31, ROM 32, and RAM 33 are interconnected via a bus 34. An input / output (I / O) interface 35 is also connected to the bus 34.
[0124] Multiple components in electronic device 30 are connected to I / O interface 35, including: input unit 36, such as keyboard, mouse, etc.; output unit 37, such as various types of monitors, speakers, etc.; storage unit 38, such as disk, optical disk, etc.; and communication unit 39, such as network card, modem, wireless transceiver, etc. Communication unit 39 allows electronic device 30 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0125] Processor 31 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 31 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 31 performs the various methods and processes described above, such as control methods:
[0126] Obtain the motion instruction set corresponding to the target device, wherein the motion instruction set includes motion instructions configured in a uniform format, with each target component in the target device as a unit of basic motion, and all of the motion instructions constitute the motion instruction set;
[0127] The motion command includes the triggering condition, control parameters and current state of the basic action, wherein each triggering condition and control parameter is pre-written into a preset program template corresponding to each motion command according to the preset action flow corresponding to the target device.
[0128] The triggering condition and current state of each motion instruction in the set of motion instructions are obtained in a loop.
[0129] If the current state of the target device is detected to meet the triggering conditions corresponding to the motion command, then the target device is controlled according to the control parameters corresponding to the motion command.
[0130] In some embodiments, the control method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 38. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 30 via ROM 32 and / or communication unit 39. When the computer program is loaded into RAM 33 and executed by processor 31, one or more steps of the control method described above may be performed. Alternatively, in other embodiments, processor 31 may be configured to execute the control method by any other suitable means (e.g., by means of firmware).
[0131] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0132] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0133] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0134] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0135] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0136] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0137] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0138] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A control method, characterized in that, include: Obtain the motion instruction set corresponding to the target device, wherein the motion instruction set includes motion instructions configured in a uniform format, with each target component in the target device as a unit for the basic action; all of the motion instructions constitute the motion instruction set. The motion command includes the triggering condition, control parameters and current state of the basic action, wherein each triggering condition and control parameter is pre-written into a preset program template corresponding to each motion command according to the preset action flow corresponding to the target device. The triggering condition and current state of each motion instruction in the set of motion instructions are obtained in a loop. If the current state of the target device is detected to meet the triggering condition corresponding to the motion command, then the target device is controlled according to the control parameters corresponding to the motion command; The current state of the target component includes: preparation state, running state, and end state; When the motion command is in a ready state and the triggering condition on which the target device depends is met, the target device is controlled to move and its state is changed to running state. When scanning again, the control of the target device is skipped. When it is detected that all motion commands relied upon by the target device are in a running state, the state of the target device is changed to a ready state.
2. The method according to claim 1, characterized in that, Obtain the triggering conditions and control parameters for at least one motion command corresponding to the target device, including: Obtain the identification information of at least one motion command corresponding to the target device; The target library is queried based on the identification information of at least one motion command to obtain the correspondence and control parameters between each motion command; The triggering condition for at least one motion command corresponding to the target device is determined based on the correspondence between each motion command.
3. The method according to claim 1, characterized in that, The target device includes at least one target component; Accordingly, obtaining the current state of the target device includes: Obtain the current state of at least one target component corresponding to the target device.
4. The method according to claim 3, characterized in that, If the current state of the target device is detected to meet the triggering condition corresponding to the motion command, then the target device is controlled according to the control parameters corresponding to the motion command, including: If the current state of at least one target component corresponding to the target device is detected to meet the triggering condition corresponding to the motion command, then the at least one target component corresponding to the target device is controlled according to the control parameters corresponding to the motion command.
5. The method according to claim 4, characterized in that, After controlling at least one target component corresponding to the target device according to the control parameters corresponding to the motion command, the method further includes: Obtain the current state corresponding to the target component; If at least one target component corresponding to the target device is detected to respond to the motion command and perform the target operation within a preset time, then the current state corresponding to the target component is updated; Otherwise, generate and display an error pop-up.
6. A control device, characterized in that, include: The first acquisition module is used to acquire a set of motion instructions corresponding to the target device, wherein the set of motion instructions includes motion instructions configured in a uniform format, with the basic actions of each target component in the target device as the unit, and all the motion instructions constitute the set of motion instructions; The motion command includes the triggering condition, control parameters and current state of the basic action, wherein each triggering condition and control parameter is pre-written into a preset program template corresponding to each motion command according to the preset action flow corresponding to the target device. The second acquisition module is used to cyclically acquire the triggering condition and current state of each motion instruction in the motion instruction set; The control module is used to control the target device according to the control parameters corresponding to the motion command if it is detected that the current state of the target device meets the triggering condition corresponding to the motion command. The current state of the target component includes: preparation state, running state, and end state; When the motion command is in a ready state and the triggering condition on which the target device depends is met, the target device is controlled to move and its state is changed to running state. When scanning again, the control of the target device is skipped. When it is detected that all motion commands relied upon by the target device are in a running state, the state of the target device is changed to a ready state.
7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the control method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that are used to cause a processor to execute the control method according to any one of claims 1-5.