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 apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application.
All other embodiments that can be obtained by a person skilled in the art without inventive step based on the embodiments in this application are within the scope of protection of this application.
Referring to fig. 1, an embodiment of the present disclosure provides a hardware structure of a motor control system 100, including a driver 10, a controller 20, a first motor 30 and a second motor 40, where the driver 10 may be a servo driver, and the servo motor is controlled by any one of a position, a speed and a torque, so as to achieve high-precision positioning of a transmission system; the controller 20 controls the driver to drive the first motor 30 and the second motor 40 or drive only a single motor by sending instructions; in some embodiments, the controller 20 is further configured to detect the operating status of the motor, and when the abnormality is detected, adjust the driver 10 to overcome the abnormality by performing an adjustment operation, sending a command again, and performing a feedback adjustment. The controller may be implemented as a combination of processing circuits or computational processing units (e.g., CPU, GPU, or a combination of both). Thus, for the purposes of this description, a controller may refer to a single-core processor; a single processor with software multi-threaded execution capability; a multi-core processor; a multi-core processor having software multi-thread execution capability; a multi-core processor having hardware multithreading; a parallel processing (or computing) platform; and a parallel computing platform with distributed shared memory.
Referring to fig. 2, another embodiment of the present disclosure provides another hardware structure of the motor control system 100, which includes a driver 10, a controller 20, a first motor 30, a second motor 40, a first encoder 50, a second encoder 60, and an upper computer 70.
The driver 10 controls the motor to operate according to the instruction of the upper computer 70, the first encoder 50 and the second encoder 60 acquire the position information of the first motor and the position information of the second motor, and the controller sends the position information of the first motor and the position information of the second motor to the driver.
Specifically, the driver 10 according to the embodiment of the present application is connected to the first motor 30 and the second motor 40. The driver 10 is used for controlling the first motor 30 and the second motor 40 to rotate. In the embodiments of the present invention, only two motors are described as an example, and in other embodiments, the number of motors may be more than two, and these motors may be attached to joints of a robot arm (for example, a six-axis robot arm). The driver controls the motion path of the mechanical arm by controlling the rotation of the motor. When the motor is attached with an encoder, the driver can communicate with the encoder to read the position of the motor, so as to check whether the motor rotates according to the command. However, the encoder includes a power line, a ground line, a positive differential signal line, and a negative differential signal line. Because the space in the mechanical arm also needs to accommodate a power line and a battery power line for controlling the motor, the problem of mechanism interference needs to be considered during wiring, and the reduction of the number of signal lines is beneficial to reducing the wiring difficulty.
Therefore, after adding one controller, only one set of encoders is needed, i.e. one controller controls two encoders and thus two motors. The time for signal processing will also be increased after adding the controller. Therefore, the technical scheme of the application can also effectively reduce the delay time.
In the embodiment of the present application, the controller 20 is connected to the driver 10. The controller 20 is configured to estimate the second time point to form a previous first time point.
Specifically, the controller may be able to predict the time when the driver will send the request information the next time, based on the historical time when the driver sent the driver. For example, if the driver has sent the request information in the 100 th ms, 150 th ms and 200 th ms during the history, and the controller determines that the time sequence is the equal difference sequence, it is estimated that the second time point when the driver sends the request information is the 250 th ms. The first time point is calculated according to the second time point and is calculated by a preset time, for example, the driver sends the request message when the controller estimates the 250 th ms, so that the first time point (or other more suitable time) is set at the 50 th ms of the first 50ms (or other preset more suitable time).
As used herein, the term "request information" refers to a command to the driver to instruct the controller to perform an operation, i.e., the command indicates or instructs the controller to request the encoder to feedback the position information of the motor at a certain time point.
In the embodiment of the present application, the controller 20 is further configured to obtain the first information and the second information. For example, the first information may include position information of the first motor 30 at the first time point. The second information may include position information of the second motor 40 at the first time point. Specifically, the position information is the number of turns of the motor. For example, the first information includes the number of rotations of the first motor 30 at the first time point, and the second information includes the number of rotations of the second motor 40 at the first time point.
Further, the controller 20 is also configured to receive the first request information from the driver 10 at a third point in time. The controller 20 will also form a first time difference between the second time point and the third time point according to the first request information, and determine whether the first time difference is within a confidence interval. For example, if the confidence interval is 0 to 50ms, if the controller estimates that the second time point when the driver sends the request message is 250ms, the controller receives the first request message from the driver 10 at 295ms (i.e., the third time point), that is, the controller sets the first time difference between the second time point and the third time point formed according to the first request message to 45ms, where the first time difference is within 0 to 50ms, that is, the first time difference is within the confidence interval. In other preferred embodiments, the interval value of the confidence interval may be other interval values. The interval value of the confidence interval can be adjusted according to specific requirements.
In the embodiment of the present application, when the first time difference is within the confidence interval, the controller 20 sends the first information and the second information to the driver 10. Specifically, the first information includes the number of rotations of the first motor 30 at the first time point, and the second information includes the number of rotations of the second motor 40 at the first time point. After acquiring the first information and the second information, the driver 10 will check whether the motor is rotating according to the instruction.
In the embodiment of the present application, the controller 20 is further configured to receive request information from the driver 10 at a fourth time point and a fifth time point.
Specifically, the fourth time point is before the fifth time point, and the controller 20 may estimate the second time point according to a difference between the fourth time point and the fifth time point. Wherein the second point in time is after the fifth point in time.
For example, if the controller receives the request information from the driver at 150ms (i.e., the fourth time point) and the controller also receives the request information from the driver at 200ms (i.e., the fifth time point), the controller determines that the time sequence is an arithmetic sequence, i.e., an interval of 50ms between the fourth time point and the fifth time point, and thus the controller estimates that the second time point at which the driver transmits the request information is 250 ms.
It is to be understood that, in the preferred embodiment of the present application, when the controller determines that the first time difference is outside the confidence interval, that is, when the difference between the second time point and the third time point at which the first request message is actually received is estimated to be too large (exceeds the confidence interval), a seventh time point is estimated according to the first time difference. Wherein the seventh time point is after the second time point and the third time point.
For example, if the confidence interval is 0 to 50ms, if the controller estimates that the second time point when the driver sends the request message is 250ms, the controller receives the first request message from the driver 10 at 305ms (i.e. the third time point), that is, the controller will form the first time difference between the second time point and the third time point according to the first request message as 55ms, where the first time difference is 55ms, and is outside the confidence interval, that is, the first time difference is outside the confidence interval. At this time, the controller estimates a seventh time point according to the first time difference, that is, the controller adjusts the seventh time point according to the first time difference. Wherein the seventh time point is after the second time point and the third time point.
In an embodiment of the application, the controller is further configured to form a sixth previous time point according to the seventh time point.
For example, if the controller estimates the second time point to be 250ms and the driver sends the request message in 305ms, the controller will adjust the estimated seventh time point to be 350 ms. The sixth time point is a time point calculated by a preset time in advance according to the seventh time point, for example, the driver transmits the request message when the controller predicts the 350ms (i.e., the seventh time point), and thus the sixth time point (or other more suitable time) is set at the 300ms of the first 50ms (or other preset more suitable time).
In an embodiment of the present invention, the controller receives third information and fourth information at the sixth time point, the third information including position information of the first motor at the sixth time point, and the fourth information including position information of the second motor at the sixth time point. Specifically, the position information is the number of turns of the motor. For example, the third information includes the number of rotations of the motor at the sixth time point of the first motor 30, and the fourth information includes the number of rotations of the motor at the sixth time point of the second motor 40.
In an embodiment of the application, the controller is configured to receive second request information from the driver at an eighth time point, and form a second time difference between the seventh time point and the eighth time point according to the second request information. And sending the third information and the fourth information to the driver when the second time difference is judged to be within the confidence interval.
For example, if the seventh time point estimated by the controller is 350ms, the driver sends a second request message to the controller at 395ms (i.e., an eighth time point), and at this time, a second time difference between the seventh time point and the eighth time point is 45ms, i.e., the second time difference 45ms is within a confidence interval of 0 to 50 ms. The controller thus sends third and fourth information to the drive. That is, the third information includes the number of rotations of the first motor 30 at the sixth time point, and the fourth information includes the number of rotations of the second motor 40 at the sixth time point. After acquiring the third information and the fourth information, the driver 10 will check whether the motor is rotating according to the instruction.
In a preferred embodiment, the motor control system 100 may further include a first encoder 50 and a second encoder 60.
Specifically, the first encoder 50 is connected between the first motor 30 and the controller 20. The first encoder 50 is configured to receive a first control instruction sent by the controller 20, acquire the first information according to the first control instruction, and further send the first information to the controller 20.
The second encoder 60 is connected between the second motor 40 and the controller 20. The second encoder 60 is configured to receive a second control instruction sent by the controller 20, and obtain the second information according to the second control instruction, so as to send the second information to the controller 20.
In the embodiments of the present application, the encoder includes a power line, a ground line, a positive differential signal line, and a negative differential signal line. Because the space in the mechanical arm needs to accommodate a power line and a battery power line for controlling the motor, the problem of mechanism interference needs to be considered during wiring, and the number of signal lines is reduced, which is beneficial to reducing the wiring difficulty, therefore, after one controller is added, only one group of encoders is needed, namely, one controller controls two encoders, and then two motors are controlled. Wherein the controller is provided with screw holes, thereby being locked on the motor.
Thus, the controller 20 may acquire the position information of the first motor 30 through the first encoder 50. The controller 20 may also acquire the position information of the second motor 40 through the second encoder 60.
In a preferred embodiment, the motor control system 10 may further include an upper computer 70.
Specifically, the upper computer 70 is connected to the driver 10, and is configured to send a motion command to the driver 10, and the driver 10 may control the first motor 30 and the second motor 40 to rotate according to the motion command. The motion command is a pulse signal sent to the driver by the upper computer 70. The upper computer sends a pulse train to the driver, namely the frequency and the pulse number of the pulse signal, and the driver can operate the first motor and the second motor to operate according to the corresponding rotating speed and the rotating quantity according to the input pulse frequency and the input pulse number so as to correctly execute the pulse command signal sent by the upper computer.
In an embodiment of the present application, the controller 20 may include first to third interfaces (not shown). The first interface is connected to the first encoder 50, the second interface is connected to the second encoder 60, and the third interface is connected to the driver 10.
In an embodiment of the present application, the first interface, the second interface, and the third interface include, but are not limited to, an RS485 interface.
Referring to fig. 3, the controller 20 estimates a second time point when the driver transmits the first request message, and transmits a request signal to the first encoder 50 and the second encoder 60 at a first time point (e.g., time point 1 in fig. 3) before the estimated second time point, the first encoder 50 and the second encoder 60 transmit the position information of the motor back at time point 2, and then the driver transmits the first request message to the controller 20 at a third time point (e.g., time point 3 in fig. 3), so that the controller transmits the position information of the motor to the driver at time point 4 if the estimated first time difference between the second time point and the third time point is within a confidence interval.
That is, the controller predicts the command sending time of the driver in advance, and collects the encoder information in advance before sending the command, so that the driver can effectively reduce the waiting time and improve the timeliness of the system.
Fig. 4 is a flowchart of a motor control method according to an embodiment of the present application, the motor control method including the steps of:
step S41: the second time point is estimated to form a previous first time point.
Specifically, the controller may be able to predict the next time the driver sends the request information based on the historical time the driver sent the driver. For example, if the driver has sent the request information in the 100 th ms, 150 th ms and 200 th ms during the history, and the controller determines that the time sequence is the equal difference sequence, it is estimated that the second time point when the driver sends the request information is the 250 th ms. The first time point is calculated according to the second time point and is calculated by a preset time, for example, the driver sends the request message when the controller estimates the 250 th ms, so that the first time point (or other more suitable time) is set at the 50 th ms of the first 50ms (or other preset more suitable time).
In the preferred embodiment of the present application, the controller 20 will receive the request information from the driver 10 at the fourth time point and the fifth time point. In particular, the fourth point in time is before the fifth point in time. That is, the controller 20 may estimate the second time point according to a difference between the fourth time point and the fifth time point. Wherein the second point in time is after the fifth point in time.
For example, if the controller receives the request information from the driver at 150ms (i.e., the fourth time point) and the controller also receives the request information from the driver at 200ms (i.e., the fifth time point), the controller determines that the time sequence is an arithmetic sequence, i.e., an interval of 50ms between the fourth time point and the fifth time point, and thus the controller estimates that the second time point at which the driver transmits the request information is 250 ms.
Step S42: first information and second information are obtained.
In the embodiment of the application, the controller obtains the first information and the second information. Specifically, the first information includes position information of a first motor at a first time point, and the second information includes position information of a second motor at the first time point. Specifically, the controller will send a first control instruction to the first encoder to obtain the first information. The controller will also send a second control instruction to the second encoder to obtain the second information.
Specifically, the position information is the number of turns of the motor. For example, the first information includes the number of rotations of the first motor 30 at the first time point, and the second information includes the number of rotations of the second motor 40 at the first time point.
Step S43: the request information is received at a third point in time.
In an embodiment of the present application, the driver transmits the first request information to the controller at the third time point, and the controller receives the first request information of the driver. As used herein, the term "request information" refers to a command to the driver to instruct the controller to perform an operation, i.e., the command indicates or instructs the controller to request the encoder to feedback the position information of the motor at a certain time point.
Step S44: forming a first time difference between the second point in time and the third point in time according to the first request information.
If the controller estimates that the second time point when the driver sends the request message is 250ms, the controller receives the first request message from the driver 10 at 295ms (i.e., the third time point), that is, the controller will form the first time difference between the second time point and the third time point according to the first request message as 45 ms.
Step S45: and sending the first information and the second information to a driver when the first time difference is judged to be within a confidence interval.
For example, if the confidence interval is 0 to 50ms, that is, the first time difference between the second time point and the third time point formed according to the first request message by the controller is 45ms, the first time difference at this time is 45ms within 0 to 50ms, that is, the first time difference is within the confidence interval. In other preferred embodiments, the interval value of the confidence interval may be other interval values. The interval value of the confidence interval can be adjusted according to specific requirements.
Referring to fig. 5, in another preferred embodiment, the motor control method further includes the following steps:
step S51: and judging that the first time difference is outside the confidence interval, and estimating a seventh time point according to the first time difference to form a prior sixth time point.
In an embodiment of the present invention, the seventh time point is after the second time point and the third time point.
For example, if the confidence interval is 0 to 50ms, if the controller estimates that the second time point when the driver sends the request message is 250ms, the controller receives the first request message from the driver 10 at 305ms (i.e., the third time point), that is, the controller will form the first time difference between the second time point and the third time point according to the first request message as 55ms, and the first time difference at this time is 55ms, that is, the first time difference is outside the confidence interval, and is 0 to 50 ms. At this time, the controller estimates a seventh time point according to the first time difference, that is, the controller adjusts the seventh time point according to the first time difference.
Further, the controller estimates the second time point to be 250ms, the driver sends the request message in 305ms, and the controller adjusts the estimated seventh time point to be 350 ms. The sixth time point is a time point calculated by a preset time in advance according to the seventh time point, for example, the driver transmits the request message when the controller predicts the 350ms (i.e., the seventh time point), and thus the sixth time point (or other more suitable time) is set at the 300ms of the first 50ms (or other preset more suitable time).
Step S52: and receiving third information and fourth information at the sixth time point.
In an embodiment of the present invention, the controller receives third information and fourth information at the sixth time point, the third information including position information of the first motor at the sixth time point, and the fourth information including position information of the second motor at the sixth time point. Specifically, the position information is the number of turns of the motor. For example, the third information includes the number of rotations of the motor at the sixth time point of the first motor 30, and the fourth information includes the number of rotations of the motor at the sixth time point of the second motor 40.
Step S53: receiving second request information from the driver at an eighth point in time.
In an embodiment of the present application, the controller is configured to receive second request information from the driver at an eighth time point.
Step S54: and forming a second time difference between the seventh time point and the eighth time point according to the second request information.
Specifically, if the seventh time point estimated by the controller is 350ms, the driver sends the second request message to the controller at 395ms (i.e., an eighth time point), where a second time difference between the seventh time point and the eighth time point is 45 ms.
Step S55: and sending the third information and the fourth information to the driver when the second time difference is judged to be within the confidence interval.
And if the second time difference between the seventh time point and the eighth time point is 45ms, that is, the second time difference 45ms is within a confidence interval of 0-50 ms. Thereby, the controller sends the third information and the fourth information to the driver. That is, the third information includes the number of rotations of the first motor 30 at the sixth time point, and the fourth information includes the number of rotations of the second motor 40 at the sixth time point. After acquiring the third information and the fourth information, the driver 10 will check whether the motor is rotating according to the instruction.
Therefore, according to the motor control system and the motor control method provided by the embodiment of the application, the controller integrates the encoder information, so that the internal part of the multi-axis joint manipulator is easier to wire, the situations of interference, winding and the like are reduced, the delay is reduced, and the system efficiency is improved.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The embodiments described above are therefore to be considered in all respects as illustrative and not restrictive.