Servo motor control method, servo motor control device, electronic equipment and storage medium

文档序号:1190299 发布日期:2020-08-28 浏览:23次 中文

阅读说明:本技术 伺服电机控制方法、装置、电子设备及存储介质 (Servo motor control method, servo motor control device, electronic equipment and storage medium ) 是由 卓国熙 于 2020-05-26 设计创作,主要内容包括:本申请提供了一种伺服电机控制方法、装置、电子设备及存储介质。该伺服电机控制方法,包括以下步骤:获取伺服电机在开环运行状态下的电流信息;获取伺服电机的角速度传感器检测得到的角速度检测值;将所述电流信息以及所述角速度检测值输入预先训练的目标神经网络模型,以计算所述伺服电机当前的实际角速度值;根据所述角速度检测值、所述实际角速度值以及所述电流信息计算所述伺服电机的角速度补偿值。本申请可以提高角速度调整的精确度。(The application provides a servo motor control method and device, electronic equipment and a storage medium. The servo motor control method comprises the following steps: acquiring current information of a servo motor in an open-loop operation state; acquiring an angular velocity detection value detected by an angular velocity sensor of a servo motor; inputting the current information and the angular speed detection value into a pre-trained target neural network model to calculate the current actual angular speed value of the servo motor; and calculating an angular velocity compensation value of the servo motor according to the angular velocity detection value, the actual angular velocity value and the current information. The method and the device can improve the accuracy of angular speed adjustment.)

1. A servo motor control method is characterized by comprising the following steps:

acquiring current information of a servo motor in an open-loop operation state;

acquiring an angular velocity detection value detected by an angular velocity sensor of a servo motor;

inputting the current information and the angular speed detection value into a pre-trained target neural network model to calculate the current actual angular speed value of the servo motor;

and calculating an angular velocity compensation value of the servo motor according to the angular velocity detection value, the actual angular velocity value and the current information.

2. The servo motor control method according to claim 1, further comprising the steps of:

acquiring detection samples and corresponding verification samples of the servo motor in multiple running states, wherein the detection sample information comprises detection current signal samples and corresponding angular velocity detection value samples, and the verification samples comprise actual angular velocity samples of the servo motor corresponding to the detection samples;

and training the detection sample and the actual angular velocity sample on a preset initial neural network model to obtain a trained target neural network model.

3. The servo motor control method according to claim 2, wherein the step of training the detection samples and the actual angular velocity samples to a preset initial neural network model to obtain a trained target neural network model comprises:

selecting untrained detection current signal samples and angular velocity detection samples from the detection samples, and inputting the detection current signal samples and the angular velocity detection samples into a preset initial neural network model to obtain corresponding angular velocity calculation values;

updating the weight parameters of the initial neural network model according to the angular velocity calculation value and the corresponding actual angular velocity sample to obtain an updated initial neural network model;

calculating a loss function of the initial neural network according to the angular velocity calculation value and a corresponding actual angular velocity sample, and judging an error range of the loss function;

if the error range is larger than a preset threshold value, returning to the step of selecting untrained detection current signal samples and angular velocity detection samples from the detection samples and inputting the detection current signal samples and the angular velocity detection samples into a preset initial neural network model;

and if the error range is smaller than a preset threshold value, taking the updated initial neural network model as a target neural network model.

4. The servo motor control method according to claim 1, wherein the step of calculating an angular velocity compensation value of the servo motor based on the angular velocity detection value, the actual angular velocity value, and the current information includes:

calculating an error value according to the angular velocity detection value and the actual angular velocity;

acquiring a corresponding compensation coefficient according to the current information;

and calculating an angular velocity compensation value of the servo motor according to the compensation coefficient and the error value.

5. The servo motor control method according to claim 1, wherein the step of acquiring the current information of the servo motor in the open loop operation state comprises:

acquiring a Q-axis current value of the servo motor in an open-loop operation state;

and acquiring the Z-axis current value of the servo motor in an open-loop operation state.

6. A servo motor control device characterized by comprising:

the first acquisition module is used for acquiring current information of the servo motor in an open-loop operation state;

the second acquisition module is used for acquiring an angular velocity detection value detected by an angular velocity sensor of the servo motor;

the first calculation module is used for inputting the current information and the angular speed detection value into a pre-trained target neural network model so as to calculate the current actual angular speed value of the servo motor;

and the second calculation module is used for calculating an angular velocity compensation value of the servo motor according to the angular velocity detection value, the actual angular velocity value and the current information.

7. The servo motor control device according to claim 6, further comprising:

the third acquisition module is used for acquiring detection samples and corresponding verification samples of the servo motor in multiple running states, wherein the detection sample information comprises detection current signal samples and corresponding angular velocity detection value samples, and the verification samples comprise actual angular velocity samples of the servo motor corresponding to the detection samples;

and the training module is used for training the detection sample and the actual angular velocity sample to a preset initial neural network model so as to obtain a trained target neural network model.

8. The servo motor control method of claim 6, wherein the second calculation module comprises:

a first calculation unit configured to calculate an error value based on the angular velocity detection value and the actual angular velocity;

the first acquisition unit is used for acquiring a corresponding compensation coefficient according to the current information;

and the second calculation unit is used for calculating an angular velocity compensation value of the servo motor according to the compensation coefficient and the error value.

9. An electronic device comprising a processor and a memory, said memory storing computer readable instructions which, when executed by said processor, perform the steps of the method of any of claims 1-5.

10. A storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the steps of the method according to any one of claims 1-5.

Technical Field

The present disclosure relates to the field of servo motor control technologies, and in particular, to a servo motor control method and apparatus, an electronic device, and a storage medium.

Background

Servo motors, that is, permanent magnet synchronous motors are widely used in various fields as power sources for power output, for example, in the fields of automobiles, intelligent robots, and transmission mechanisms. Compared with other motors, the servo motor has the following advantages: the servo motor is provided with a sensor for detecting an angle, and can provide a required feedback value for realizing high-precision closed-loop control in practical engineering application. However, errors due to sensors: such as manufacturing error, installation error, etc., so that the motor cannot obtain high control accuracy.

Therefore, there is a need in the art for a servo motor that can improve detection errors and thus improve control accuracy.

Disclosure of Invention

An object of the embodiments of the present application is to provide a servo motor control method, a servo motor control apparatus, an electronic device, and a storage medium, which can improve accuracy of angular velocity adjustment.

In a first aspect, an embodiment of the present application provides a servo motor control method, including the following steps:

acquiring current information of a servo motor in an open-loop operation state;

acquiring an angular velocity detection value detected by an angular velocity sensor of a servo motor;

inputting the current information and the angular speed detection value into a pre-trained target neural network model to calculate the current actual angular speed value of the servo motor;

and calculating an angular velocity compensation value of the servo motor according to the angular velocity detection value, the actual angular velocity value and the current information.

Optionally, in the servo motor control method provided in the embodiment of the present application, the method further includes the following steps:

acquiring detection samples and corresponding verification samples of the servo motor in multiple running states, wherein the detection sample information comprises detection current signal samples and corresponding angular velocity detection value samples, and the verification samples comprise actual angular velocity samples of the servo motor corresponding to the detection samples;

and training the detection sample and the actual angular velocity sample on a preset initial neural network model to obtain a trained target neural network model.

Optionally, in the servo motor control method provided in the embodiment of the present application, the step of training the detection sample and the actual angular velocity sample on a preset initial neural network model to obtain a trained target neural network model includes:

selecting untrained detection current signal samples and angular velocity detection samples from the detection samples, and inputting the detection current signal samples and the angular velocity detection samples into a preset initial neural network model to obtain corresponding angular velocity calculation values;

updating the weight parameters of the initial neural network model according to the angular velocity calculation value and the corresponding actual angular velocity sample to obtain an updated initial neural network model;

calculating a loss function of the initial neural network according to the angular velocity calculation value and a corresponding actual angular velocity sample, and judging an error range of the loss function;

if the error range is larger than a preset threshold value, returning to the step of selecting untrained detection current signal samples and angular velocity detection samples from the detection samples and inputting the detection current signal samples and the angular velocity detection samples into a preset initial neural network model;

and if the error range is smaller than a preset threshold value, taking the updated initial neural network model as a target neural network model.

Optionally, in the servo motor control method provided in the embodiment of the present application, the step of calculating an angular velocity compensation value of the servo motor according to the detected angular velocity value, the actual angular velocity value, and the current information includes:

calculating an error value according to the angular velocity detection value and the actual angular velocity;

acquiring a corresponding compensation coefficient according to the current information;

and calculating an angular velocity compensation value of the servo motor according to the compensation coefficient and the error value.

Optionally, in the servo motor control method provided in the embodiment of the present application, the step of obtaining current information of the servo motor in an open-loop operating state includes:

acquiring a Q-axis current value of the servo motor in an open-loop operation state;

and acquiring the Z-axis current value of the servo motor in an open-loop operation state.

In a second aspect, an embodiment of the present application further provides a servo motor control device, including:

the first acquisition module is used for acquiring current information of the servo motor in an open-loop operation state;

the second acquisition module is used for acquiring an angular velocity detection value detected by an angular velocity sensor of the servo motor;

the first calculation module is used for inputting the current information and the angular speed detection value into a pre-trained target neural network model so as to calculate the current actual angular speed value of the servo motor;

and the second calculation module is used for calculating an angular velocity compensation value of the servo motor according to the angular velocity detection value, the actual angular velocity value and the current information.

Optionally, the servo motor control device according to the present application further includes:

the third acquisition module is used for acquiring detection samples and corresponding verification samples of the servo motor in multiple running states, wherein the detection sample information comprises detection current signal samples and corresponding angular velocity detection value samples, and the verification samples comprise actual angular velocity samples of the servo motor corresponding to the detection samples;

and the training module is used for training the detection sample and the actual angular velocity sample to a preset initial neural network model so as to obtain a trained target neural network model.

Optionally, in the servo motor control apparatus of the present application, the second calculation module includes:

a first calculation unit configured to calculate an error value based on the angular velocity detection value and the actual angular velocity;

the first acquisition unit is used for acquiring a corresponding compensation coefficient according to the current information;

and the second calculation unit is used for calculating an angular velocity compensation value of the servo motor according to the compensation coefficient and the error value.

In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, where the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method as provided in the first aspect are executed.

In a fourth aspect, embodiments of the present application provide a storage medium, on which a computer program is stored, where the computer program, when executed by a processor, performs the steps in the method as provided in the first aspect.

According to the method, the current information of the servo motor in the open-loop operation state is obtained; acquiring an angular velocity detection value detected by an angular velocity sensor of a servo motor; inputting the current information and the angular speed detection value into a pre-trained target neural network model to calculate the current actual angular speed value of the servo motor; calculating an angular velocity compensation value of the servo motor according to the angular velocity detection value, the actual angular velocity value and the current information; therefore, the angular velocity is compensated, and the accuracy of angular velocity adjustment can be improved.

Additional features and advantages of the present application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the present application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.

Drawings

In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.

Fig. 1 is a flowchart of a servo motor control method according to an embodiment of the present disclosure.

Fig. 2 is a schematic structural diagram of a servo motor control device according to an embodiment of the present disclosure.

Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.

Detailed Description

The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.

It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.

Referring to fig. 1, fig. 1 is a flowchart of a servo motor control method according to some embodiments of the present disclosure, the servo motor control method includes the following steps:

s101, current information of the servo motor in an open-loop operation state is obtained.

S102, angular velocity detection values detected by an angular velocity sensor of the servo motor are obtained.

S103, inputting the current information and the angular speed detection value into a pre-trained target neural network model to calculate the current actual angular speed value of the servo motor.

And S104, calculating an angular velocity compensation value of the servo motor according to the angular velocity detection value, the actual angular velocity value and the current information.

In step S101, an open-loop operating equation of the servo motor is obtained according to an equivalent equation of the servo motor. And then, operating according to the open-loop operating equation, and measuring the Q-axis current and the D-axis current of the servo motor. Wherein the current information includes the Q-axis current and the D-axis current.

In step S102, the angular velocity sensor uploads a detected angular velocity value every preset time period, for example, 1 second, and the detected angular velocity value may have an error caused by installation of the angular velocity sensor or an error of itself, and thus, the detected angular velocity value has a certain difference from an actual value.

In step S103, the pre-trained target neural network is obtained by training detection samples and corresponding verification samples in multiple operating states. Specifically, in some embodiments, before the step S103, the following steps are further included:

and S1, obtaining detection samples and corresponding verification samples of the servo motor in various running states, wherein the detection sample information comprises detection current signal samples and corresponding angular velocity detection value samples, and the verification samples comprise actual angular velocity samples of the servo motor corresponding to the detection samples. S2, training the detection sample and the actual angular velocity sample on a preset initial neural network model to obtain a trained target neural network model.

In step S1, the detection samples include a plurality of sample pairs, each sample pair includes a detection current sample and a detection angular velocity value sample, the verification samples include a plurality of corresponding detection angular velocity value samples, and the plurality of detection angular velocity value samples are in one-to-one correspondence with the plurality of sample pairs. Wherein the initial neural network model can adopt the existing model in the prior art, and then set the weight parameter thereof to a random value. In step S2, the initial neural network model may be trained using a plurality of test samples.

Specifically, in some embodiments, this step S2 includes:

s21, selecting untrained detection current signal samples and angular velocity detection samples from the detection samples, and inputting the detection current signal samples and the angular velocity detection samples into a preset initial neural network model to obtain corresponding angular velocity calculation values; s22, updating the weight parameters of the initial neural network model according to the angular velocity calculation value and the corresponding actual angular velocity sample to obtain an updated initial neural network model; s23, calculating a loss function of the initial neural network according to the angular velocity calculation value and the corresponding actual angular velocity sample, and judging the error range of the loss function; s24, if the error range is larger than a preset threshold value, returning to the step of selecting untrained detection current signal samples and angular velocity detection samples from the detection samples and inputting the detection current signal samples and the angular velocity detection samples into a preset initial neural network model; and S25, if the error range is smaller than a preset threshold value, taking the updated initial neural network model as a target neural network model.

Wherein the preset threshold is set according to the error range. Of course, other empirical values may be used.

In step S104, when the angular velocity compensation value is set, the calculation may be performed directly according to the error value between the angular velocity detection value and the actual angular velocity, and the two are the same. In other embodiments, current information may be combined. Since the error of the angular velocity sensor is related to the magnitude of the current when the angular velocity sensor detects the angular velocity detection value, the larger the current of the servo motor is, the larger the error is, and therefore, the corresponding compensation coefficient can be set according to the current information obtained by current detection. Specifically, the step S104 includes: s1041, calculating an error value according to the angular velocity detection value and the actual angular velocity; s1042, acquiring a corresponding compensation coefficient according to the current information; and S1043, calculating an angular velocity compensation value of the servo motor according to the compensation coefficient and the error value.

The compensation coefficient can be summarized by adopting a limited number of tests, and different current intervals correspond to different compensation coefficients.

Therefore, the method provided by the embodiment of the application obtains the current information of the servo motor in the open-loop operation state; acquiring an angular velocity detection value detected by an angular velocity sensor of a servo motor; inputting the current information and the angular speed detection value into a pre-trained target neural network model to calculate the current actual angular speed value of the servo motor; calculating an angular velocity compensation value of the servo motor according to the angular velocity detection value, the actual angular velocity value and the current information; therefore, the angular velocity is compensated, and the accuracy of angular velocity adjustment can be improved.

Referring to fig. 2, fig. 2 is a servo motor control device in some embodiments of the present application, including: a first obtaining module 201, a second obtaining module 202, a first calculating module 203, and a second calculating module 204.

The first obtaining module 201 is configured to obtain current information of the servo motor in an open-loop operating state; and acquiring an open-loop operating equation of the servo motor according to the equivalent equation of the servo motor. And then, operating according to the open-loop operating equation, and measuring the Q-axis current and the D-axis current of the servo motor. Wherein the current information includes the Q-axis current and the D-axis current.

The second obtaining module 202 is configured to obtain an angular velocity detection value detected by an angular velocity sensor of the servo motor; the angular velocity sensor uploads a detected angular velocity value, which may have an error due to installation of the angular velocity sensor or an error itself, every a preset time period, for example, 1 second, and thus, the detected angular velocity value is different from an actual value.

The first calculating module 203 is configured to input the current information and the angular velocity detection value into a pre-trained target neural network model to calculate a current actual angular velocity value of the servo motor; the pre-trained target neural network is obtained by training detection samples and corresponding verification samples under various running states. Specifically, in some embodiments, the apparatus further comprises a training module; the training module is used for obtaining detection samples and corresponding verification samples of the servo motor in multiple running states, the detection sample information comprises detection current signal samples and corresponding angular velocity detection value samples, the verification samples comprise actual angular velocity samples of the servo motor corresponding to the detection samples, and the detection samples and the actual angular velocity samples are used for training a preset initial neural network model to obtain a trained target neural network model.

The detection samples comprise a plurality of sample pairs, each sample pair comprises a detection current sample and an angular velocity detection value sample, the verification samples comprise a plurality of corresponding angular velocity detection value samples, and the angular velocity detection value samples correspond to the sample pairs one to one. Wherein the initial neural network model can adopt the existing model in the prior art, and then set the weight parameter thereof to a random value. The initial neural network model can be obtained by training a plurality of detection samples.

Specifically, in some embodiments, untrained detection current signal samples and angular velocity detection samples are selected from the detection samples and input into a preset initial neural network model to obtain corresponding angular velocity calculation values; updating the weight parameters of the initial neural network model according to the angular velocity calculation value and the corresponding actual angular velocity sample to obtain an updated initial neural network model; calculating a loss function of the initial neural network according to the angular velocity calculation value and a corresponding actual angular velocity sample, and judging an error range of the loss function; if the error range is larger than a preset threshold value, returning to the step of selecting untrained detection current signal samples and angular velocity detection samples from the detection samples and inputting the detection current signal samples and the angular velocity detection samples into a preset initial neural network model; and if the error range is smaller than a preset threshold value, taking the updated initial neural network model as a target neural network model.

Wherein the preset threshold is set according to the error range. Of course, other empirical values may be used.

The second calculating module 204 is configured to calculate an angular velocity compensation value of the servo motor according to the angular velocity detection value, the actual angular velocity value, and the current information. When setting the angular velocity compensation value, the calculation may be performed directly according to the error value between the angular velocity detection value and the actual angular velocity, which are the same. In other embodiments, current information may be combined. Since the error of the angular velocity sensor is related to the magnitude of the current when the angular velocity sensor detects the angular velocity detection value, the larger the current of the servo motor is, the larger the error is, and therefore, the corresponding compensation coefficient can be set according to the current information obtained by current detection. Specifically, the second calculation module 204 is configured to: calculating an error value according to the angular velocity detection value and the actual angular velocity; acquiring a corresponding compensation coefficient according to the current information; and calculating an angular velocity compensation value of the servo motor according to the compensation coefficient and the error value.

The compensation coefficient can be summarized by adopting a limited number of tests, and different current intervals correspond to different compensation coefficients.

The servo motor control device according to the present application further includes: the third acquisition module is used for acquiring detection samples and corresponding verification samples of the servo motor in multiple running states, wherein the detection sample information comprises detection current signal samples and corresponding angular velocity detection value samples, and the verification samples comprise actual angular velocity samples of the servo motor corresponding to the detection samples; and the training module is used for training the detection sample and the actual angular velocity sample to a preset initial neural network model so as to obtain a trained target neural network model.

The second calculation module 204 includes: a first calculation unit configured to calculate an error value based on the angular velocity detection value and the actual angular velocity; the first acquisition unit is used for acquiring a corresponding compensation coefficient according to the current information; and the second calculation unit is used for calculating an angular velocity compensation value of the servo motor according to the compensation coefficient and the error value.

Therefore, the device provided by the embodiment of the application acquires the current information of the servo motor in the open-loop operation state; acquiring an angular velocity detection value detected by an angular velocity sensor of a servo motor; inputting the current information and the angular speed detection value into a pre-trained target neural network model to calculate the current actual angular speed value of the servo motor; calculating an angular velocity compensation value of the servo motor according to the angular velocity detection value, the actual angular velocity value and the current information; therefore, the angular velocity is compensated, and the accuracy of angular velocity adjustment can be improved.

Referring to fig. 3, fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure, where the present disclosure provides an electronic device 3, including: the processor 301 and the memory 302, the processor 301 and the memory 302 being interconnected and communicating with each other via a communication bus 303 and/or other form of connection mechanism (not shown), the memory 302 storing a computer program executable by the processor 301, the computer program being executable by the processor 301 when the computing device is running to perform the method in any of the alternative implementations of the above embodiments when the processor 301 executes the computer program to perform the following functions: acquiring current information of a servo motor in an open-loop operation state; acquiring an angular velocity detection value detected by an angular velocity sensor of a servo motor; inputting the current information and the angular speed detection value into a pre-trained target neural network model to calculate the current actual angular speed value of the servo motor; and calculating an angular velocity compensation value of the servo motor according to the angular velocity detection value, the actual angular velocity value and the current information.

The embodiment of the present application provides a storage medium, and when being executed by a processor, the computer program performs the method in any optional implementation manner of the above embodiment. The storage medium may be implemented by any type of volatile or nonvolatile storage device or combination thereof, such as a Static Random Access Memory (SRAM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), an Erasable Programmable Read-Only Memory (EPROM), a Programmable Read-Only Memory (PROM), a Read-Only Memory (ROM), a magnetic Memory, a flash Memory, a magnetic disk, or an optical disk.

In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.

In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.

Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.

The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

11页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种电机控制系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!