Motor-based robot head control method, device and storage medium
By setting up a direct drive motor and a motion encoder on the robot head, the problem of manual control of the rotation speed and angle of the robot head is solved, and high-precision rotation control and extended service life are achieved.
Patent Information
- Application Number
- CN202411480936.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-10-23
AI Technical Summary
In the prior art, when manually controlling the rotation of the robot's head, the speed and angle control are inaccurate.
The first motor and the second motor are respectively arranged on both sides of the robot head, and the rotation of the robot head is controlled by direct drive, combining a motion encoder and a motion controller to separate the rotation angle to achieve high-precision control.
Accurate control of the rotation angle and speed of the robot head is achieved, extending the service life of the product and improving control accuracy.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of automatic control technology, and in particular relates to a motor-based robot head control method, device and storage medium. Background Art
[0002] With the development of automation and network technology, the application fields of robots are becoming more and more extensive. For example, by installing a camera on the head of the robot and then remotely controlling the rotation of the robot's head to obtain the images taken by the robot's head, some dangerous monitoring tasks can be completed without leaving home.
[0003] For example, Chinese patent document CN109799760A discloses a control system and control method for a bird-repelling robot in the power industry, which includes real-time shooting and obtaining the captured images through a camera in the robot and transmitting them to a server; the captured images are stored in real time in the memory of the server; the central processor identifies the dynamic targets and motion trajectories in the captured images according to a preset background suppression algorithm; the central processor determines whether the dynamic target is a bird through the motion trajectory; when the central processor determines that the dynamic target is a bird, the central processor calculates the deflection angle according to the motion trajectory; the central processor controls the camera and the bird-repelling device to deflect synchronously according to the deflection angle, so that the camera and the bird-repelling device can move synchronously following the motion trajectory of the bird. For another example, Chinese patent document CN106843002A discloses a control system based on the head of an intelligent robot, which includes a control module and a visual processing module, wherein the visual processing module is used to perform human posture recognition and face recognition on the video information collected by the camera, and sends corresponding recognition data to the control module, and the control module outputs control instructions based on the recognition data to activate and control the motor speed and sensor of the head of the intelligent robot, control the movement of the robot head, and realize the visual and voice interaction of the robot head.
[0004] Then, both of the above methods use image recognition to automatically control the robot head. In actual usage scenarios, there will also be situations where the robot head is rotated by manual control. Currently, there are still problems with inaccurate control of speed and angle when rotating the robot head by manual control. Summary of the invention
[0005] To solve the above problems, the present invention provides a motor-based robot head control method, device and storage medium to solve the problem of inaccurate speed and angle control in manual control of the robot head in the prior art.
[0006] In order to achieve the above-mentioned object of the invention, the present invention proposes a motor-based robot head control method, comprising:
[0007] A first motor and a second motor are respectively arranged on the first side and the second side of the robot head, the first motor controls the robot head to rotate in the horizontal direction in a direct drive manner, and the second motor controls the robot head to rotate in the vertical direction in a direct drive manner;
[0008] A first encoder and a first motion controller are arranged inside the first motor, and a second encoder and a second motion controller are arranged inside the second motor, and the first encoder and the second encoder are arranged with a first unit number and a second unit number, and the first unit number and the second unit number are both multiples of 2;
[0009] The first encoder divides the rotation angle of the first motor into first control precision based on the first unit number, and the second encoder divides the rotation angle of the first motor into second control precision based on the second unit number;
[0010] After receiving a first target angle and a second target angle, the first encoder calculates a first pulse value based on the first control accuracy and the first target angle, and the second encoder calculates a second pulse value based on the second control accuracy and the second target angle;
[0011] The first motion controller drives the first motor to rotate the first target angle based on the first pulse value, and the second motion controller drives the first motor to rotate the second target angle based on the second pulse value;
[0012] During the rotation of the first motor and the second motor, the first encoder and the second encoder record the pulse values of the first motion controller and the second motion controller to record the rotation angles of the first motor and the second motor.
[0013] Furthermore, the rotation speed of the first motor and the second motor is greater than or equal to 120 r / min.
[0014] Furthermore, during the actual rotation of the robot head, the actual rotation speed of the first motor is obtained based on the following steps:
[0015] Acquire a first signal and a second signal of the first motor, transmit the first signal to a first analysis module, and input the first signal and the second signal to a second analysis module;
[0016] Setting a limit speed, obtaining a target speed of the first motor, and if the target speed is less than the limit speed, the first analysis module analyzes the first signal to obtain a first rotation speed of the first motor, and uses the first rotation speed as a current first actual rotation speed of the motor;
[0017] If the target speed is greater than or equal to the limit speed, a corresponding first motor acceleration is set for each target speed, and an ideal operation process of the first motor is generated based on the acceleration, the target angle and the target angle, wherein the ideal operation process includes an acceleration process, a uniform speed process and a deceleration process, and the ideal operation process is divided into a plurality of process speeds, and the process speed closest to the limit speed in the acceleration process is defined as a first critical speed, and the process speed closest to the limit speed in the deceleration process is defined as a second critical speed, and the time points corresponding to the first critical speed and the second critical speed are defined as a first time point and a second time point, respectively, and a third time point and a fourth time point are located between the first time point and the second time point;
[0018] After the second time point and before the third time point, the first analysis module obtains the first speed of the first motor, and uses the first speed as the current second actual speed of the motor. Between the third time point and the second time point, the second analysis module analyzes the first signal or the second signal to obtain the second speed of the first motor, and uses the second speed as the current third actual speed of the motor.
[0019] Further, the control instruction for driving the first motor to rotate includes a continuous instruction, the continuous instruction includes a target angle and a target speed, the continuous instruction received for the first time is defined as a first instruction, the robot head is rotated according to the target angle and the target speed in the first instruction, and if the continuous instruction is received again within a preset time, the robot head continues to be rotated based on the continuous instruction until the continuous instruction is not received within the preset time;
[0020] defining the continuous instruction received for the last time as the last instruction, and storing the first instruction, the last instruction, all the continuous instructions therebetween, and the network delay record when the first instruction is issued as historical data;
[0021] After the continuous instruction is sent again, a rotation instruction is generated and sent by combining the continuous instruction and the historical data;
[0022] After the robot head completes the rotation of the first angle based on the continuous instruction, it rotates to a second angle based on the rotation instruction, and the second angle is smaller than the first angle.
[0023] Further, generating the rotation instruction based on the historical data comprises the following steps:
[0024] Merging all target angles included in each piece of the historical data into a positive rotation angle and a negative rotation angle, wherein the positive rotation angle is greater than the negative rotation angle, defining the merged historical data as preprocessed data, and classifying the preprocessed data based on the network delay and the positive rotation angle to obtain multiple classification results;
[0025] After the robot head continuously receives multiple continuous instructions including target angles in the same direction and fails to receive the continuous instructions within the detection time, the target angles included in the continuous instructions are merged into a total angle, and the network delay when the continuous instructions are issued is obtained. The corresponding classification result is matched based on the total angle and the network delay, and one piece of historical data is extracted from the classification result as representative data, and the rotation instruction is generated based on the negative rotation angle in the representative data.
[0026] Furthermore, a graphical interface is provided in the command module for controlling the motor, the graphical interface comprising a first area, a second area and a third area, the first area displays the orientation of the robot head in a vertical plane, the second area displays the orientation of the robot head in a horizontal plane, and the third area is used to display a real-life image captured by the robot head in real time;
[0027] A first button and a second button are respectively provided on one side of the first area and the second area. After the user drags the first button or the second button and keeps it still, the instruction module generates a third angle according to the moving distance of the first button this time, and generates a fourth angle according to the moving distance of the second button this time, and sends the third angle and the fourth angle as a single instruction.
[0028] Further, a first combination key and a second combination key are respectively provided on one side of the first area and the second area, and the first combination key or the second combination key is pressed once to generate a fifth angle or a sixth angle, and when the user continues to press the first combination key or the second combination key, the fifth angle or the sixth angle is generated based on a preset interval, and is sent as a continuous instruction based on the fifth angle and the sixth angle. Further, the preprocessed data is classified using a K-means algorithm.
[0029] Furthermore, the preprocessed data is classified using a K-means algorithm.
[0030] The present invention also provides a motor-based robot head control device, which is used to implement the motor-based robot head control method described above, and the device includes:
[0031] A first motor is arranged on the head of the robot, and the first motor controls the robot head to rotate in a horizontal direction in a direct drive manner;
[0032] A second motor is provided at the head of the robot, and the second motor controls the robot head to rotate in a vertical direction in a direct drive manner;
[0033] a first motion encoder, arranged in the first motor, the first motion encoder being provided with a first number of units, the first number of units being a multiple of 2, the first motion encoder splitting the rotation angle of the first motor into a first control precision based on the first number of units, after receiving a first target angle, the first motion encoder calculating a first pulse value based on the first control precision and the first target angle, and in the process of rotation of the first motor, the first motion encoder recording a pulse value of a first motion controller to record the rotation angle of the first motor;
[0034] a second motion encoder, arranged in the second motor, the second motion encoder being provided with a second number of units, the second number of units being a multiple of 2, the second motion encoder splitting the rotation angle of the second motor into a second control precision based on the second number of units, after receiving the second target angle, the second motion encoder calculating a second pulse value based on the second control precision and the second target angle, and during the rotation of the second motor, the second motion encoder recording a pulse value of a second motion controller to record the rotation angle of the second motor;
[0035] A first motion controller is disposed in the first motor, and the first motion controller drives the first motor to rotate the first target angle based on the first pulse value;
[0036] A second motion controller is disposed in the second motor, and the second motion controller drives the second motor to rotate the second target angle based on the second electrical pulse value.
[0037] The present invention also discloses a computer storage medium, wherein the computer storage medium stores program instructions, wherein when the program instructions are executed, the device where the computer storage medium is located is controlled to execute the above-mentioned method.
[0038] Compared with the prior art, the beneficial effects of the present invention are at least as follows:
[0039] The present invention realizes the control of the rotation of the head in the horizontal direction and the vertical direction by respectively arranging the first motor and the second motor on both sides of the robot head. In the process of controlling the rotation of the robot head by the motor, the belt loosening or the gear wear of the traditional belt drive and gear drive will occur after long-term use, which will affect the service life of the product on the one hand and the speed of the robot head rotation on the other hand. The present invention adopts direct drive control. Since the motor is directly connected to the robot head, it not only greatly increases the service life of the product, but also can realize the precise control of the rotation speed of the robot head.
[0040] The present invention also provides a motion encoder and a drive controller in the motor. The motion encoder divides the rotatable angle of the motor into more precise control precision according to the number of units preset inside the motion encoder. Compared with the traditional control method that directly uses the motor rotation angle, the method adopted by the present invention can control the motor rotation angle to be lower than 1 degree or even higher. In addition, the motor is connected to the robot head in a direct drive manner, so as to achieve precise control of the rotation angle of the robot head. In addition, during the rotation of the robot head, the motion encoder can accurately record the real-time rotation angle of the motor by detecting the number of pulses sent. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is a schematic diagram of the structure of the motor-based robot head control device of the present invention;
[0042] Figure 2 It is a schematic diagram of the principle of the motor-based robot head control device of the present invention;
[0043] Figure 3 It is a schematic diagram of the graphical interface in the present invention.
[0044] In the figure, 1, the first motor; 2, the second motor; 3, the first motion encoder; 4, the second motion encoder; 5, the first motion controller; 6, the second motion controller. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0046] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but unless otherwise specified, these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first xx script may be referred to as a second xx script, and similarly, a second xx script may be referred to as a first xx script.
[0047] Example 1
[0048] like Figure 1 and Figure 2 As shown, a motor-based robot head control method includes:
[0049] A first motor 1 and a second motor 2 are respectively arranged on the first side and the second side of the robot head. The first motor 1 controls the robot head to rotate in the horizontal direction in a direct drive manner, and the second motor 2 controls the robot head to rotate in the vertical direction in a direct drive manner.
[0050] A first motion encoder 3 and a first motion controller 5 are arranged inside the first motor 1, and a second motion encoder 4 and a second motion controller 6 are arranged inside the second motor 2. Since the motion encoder and the motion controller are arranged inside the motor, Figure 2 The first motion encoder 3 and the second motion encoder 4 are set with a first unit number and a second unit number, and the first unit number and the second unit number are both multiples of 2.
[0051] Specifically, the first motor 1 and the second motor 2 can be stepper motors or brushless motors. The first unit number and the second unit number can be the same value or different values. The first unit number and the second unit number can be, for example, 16392, 32782, 65566, etc., and the requirement is that they need to be multiples of 2.
[0052] The first motion encoder 3 divides the rotation angle of the first motor 1 into first control precision based on the first unit number, and the second motion encoder 4 divides the rotation angle of the first motor 1 into second control precision based on the second unit number.
[0053] For example, the first unit number is 65566, and the first motor 1 can rotate 360 degrees. Then the corresponding first control accuracy is 360 / 65566≈0.005 degrees, and the robot head can be controlled to rotate 0.005 degrees each time.
[0054] After receiving the first target angle and the second target angle, the first motion encoder 3 calculates the first pulse value based on the first control accuracy and the first target angle, and the second motion encoder 4 calculates the second pulse value based on the second control accuracy and the second target angle.
[0055] The first motion controller 5 drives the first motor 1 to rotate by a first target angle based on the first pulse value, and the second motion controller 6 drives the first motor 1 to rotate by a second target angle based on the second pulse value.
[0056] The first target angle and the second target angle are the angles that the robot head needs to rotate this time. For example, if the first target angle is 0.1 degree, then the converted first pulse value is 0.1 / 0.005=20. The first motion controller 5 sends 20 first pulses, and each pulse controls the robot head to rotate 0.005 degrees, thereby achieving precise control of the rotation angle of the robot head.
[0057] During the rotation of the first motor 1 and the second motor 2 , the first motion encoder 3 and the second motion encoder 4 record the pulse values of the first motion controller 5 and the second motion controller 6 to record the rotation angles of the first motor 1 and the second motor 2 .
[0058] The present invention realizes the control of the rotation of the head in the horizontal direction and the vertical direction by respectively arranging the first motor and the second motor on both sides of the robot head. In the process of controlling the rotation of the robot head by the motor, the belt loosening or the gear wear of the traditional belt drive and gear drive will occur after long-term use, which will affect the service life of the product on the one hand and the speed of the robot head rotation on the other hand. The present invention adopts direct drive control. Since the motor is directly connected to the robot head, it not only greatly increases the service life of the product, but also can realize the precise control of the rotation speed of the robot head.
[0059] The present invention also provides a motion encoder and a drive controller in the motor. The motion encoder divides the rotatable angle of the motor into more precise control precision according to the number of units preset inside the motion encoder. Compared with the traditional control method that directly uses the motor rotation angle, the method adopted by the present invention can control the motor rotation angle to be lower than 1 degree or even higher. In addition, the motor is connected to the robot head in a direct drive manner, so as to achieve precise control of the rotation angle of the robot head. In addition, during the rotation of the robot head, the motion encoder can accurately record the real-time rotation angle of the motor by detecting the number of pulses sent.
[0060] The rotation speed of the first motor and the second motor is greater than or equal to 120r / min.
[0061] Example 2
[0062] In order to meet the diversified needs of users, in the actual rotation process of the robot head, the actual rotation speed of the first motor 1 is obtained based on the following steps:
[0063] Acquire a first signal and a second signal of the first motor 1, transmit the first signal to a first analysis module, and input the first signal and the second signal to a second analysis module;
[0064] A limit speed is set to obtain a target speed of the first motor 1. If the target speed is less than the limit speed, the first analysis module analyzes the first signal to obtain a first rotation speed of the first motor 1, and uses the first rotation speed as the current first actual rotation speed of the motor.
[0065] If the target speed is greater than or equal to the limit speed, the corresponding acceleration of the first motor 1 is set for each target speed, and an ideal operation process of the first motor 1 is generated based on the acceleration, the target angle and the target angle. The ideal operation process includes an acceleration process, a uniform speed process and a deceleration process. The ideal operation process is divided into multiple process speeds, and the process speed closest to the limit speed in the acceleration process is defined as a first critical speed, and the process speed closest to the limit speed in the deceleration process is defined as a second critical speed. The time points corresponding to the first critical speed and the second critical speed are defined as a first time point and a second time point, respectively, and a third time point and a fourth time point are located between the first time point and the second time point.
[0066] After the second time point and between the third time point, the first analysis module obtains the first speed of the first motor 1, and the first speed is used as the current second actual speed of the motor. Between the third time point and the second time point, the second analysis module analyzes the first signal or the second signal to obtain the second speed of the first motor 1, and the second speed is used as the current third actual speed of the motor.
[0067] The first signal and the second signal of the motor are obtained through the first motion encoder 3. There are channels A and B in the first motion encoder 3. The first signal is output through channel A, and the second signal is output through channel B. In addition, the first analysis module obtains the actual speed of the motor through the first signal and the period measurement method. The second analysis module obtains the actual speed of the first motor 1 through the first signal or the second signal and the frequency measurement method. The reason for inputting the first signal and the second signal into the second analysis module here is that the first signal and the second signal have a phase difference, so the motor speed and rotation direction can be obtained by analyzing the first signal and the second signal.
[0068] When the speed of the first motor 1 is low, the period measurement method is more accurate in obtaining the speed of the first motor 1. When the speed of the first motor 1 is high, the frequency measurement method is more accurate in obtaining the speed of the first motor 1. Therefore, a limit speed is set here, and the target speed is the rotation speed that the motor needs to achieve. If the target speed is less than the limit speed, it indicates that the maximum speed of the first motor 1 will also be relatively small, so only the period measurement method is used to measure the click speed. In particular, in this embodiment, when the target speed is less than the limit speed, the second analysis module is still used to obtain the rotation direction of the first motor 1, and the analysis is stopped after the acquisition.
[0069] If the target speed is greater than or equal to the limit speed, it indicates that there will be a process in which the first motor 1 accelerates from a low speed to a high speed. In the low speed range, the periodic measurement method should be used to obtain the speed of the first motor 1, and in the high speed range, the frequency measurement method should be used to obtain the speed of the first motor 1. For this purpose, the corresponding acceleration is set in advance for each target speed, and the larger the value of the target speed, the larger the corresponding acceleration value. Then, the ideal operation process of the first motor 1 is generated according to the acceleration, target angle and target angle. The ideal operation process also includes an acceleration stage, a uniform speed stage and a deceleration stage. After the ideal operation process is generated, it is divided into multiple process speeds, and each process speed will correspond to a time point.
[0070] There will be a process speed closest to the limit speed during the acceleration process and the deceleration process, which is defined as the first limit speed and the second limit speed. Before the first time point of the first limit speed and after the second time point of the second limit speed, the actual speed of the first motor 1 should be lower than the limit speed. Therefore, the first speed obtained by the first analysis module is used as the actual speed of the first motor 1 in these two intervals. The third time point and the fourth time point are selected between the first time point and the second time point. The reason is that in order to ensure the seamless switching of the use of the first analysis module and the second analysis module, a transition interval needs to be set, so as to avoid the situation that the first analysis module has stopped before the second analysis module is started. Therefore, between the first time point and the third time point, the first speed measured by the first motor 1 is continued to be used as the actual speed of the first motor 1, and the second analysis module is enabled to obtain the second speed. Similarly, between the fourth time point and the second time point, the second speed measured by the second motor 2 is continued to be used as the actual speed of the first motor 1, and the first analysis module is enabled to obtain the first speed. In particular, the time lengths of the first time point and the third time point, as well as the fourth time point and the second time point should be minimized to avoid the first analysis module and the second analysis module running for too long at the same time and increasing the calculation burden of the system.
[0071] The control instruction for driving the first motor 1 to rotate includes a continuous instruction, and the continuous instruction includes a target angle and a target speed. The continuous instruction received for the first time is defined as the first instruction, and the robot head is rotated according to the target angle and the target speed in the first instruction. If the continuous instruction is received again within a preset time, the robot head continues to be rotated based on the continuous instruction until no continuous instruction is received within the preset time.
[0072] The last received continuous instruction is defined as the last instruction, and the first instruction, the last instruction, all the continuous instructions between them and the network delay record when the first instruction is issued are stored as historical data;
[0073] When the continuous instruction is sent again, the rotation instruction is generated and sent by combining the continuous instruction and historical data;
[0074] After the robot head completes the rotation of the first angle based on the continuous instruction, it rotates to the second angle based on the rotation instruction, and the second angle is smaller than the first angle.
[0075] For continuous instructions, there is no pre-set angle, and it is generated by continuously or continuously pressing the button that controls the rotation of the robot head. Figure 3 , each time button B3 is pressed, a continuous instruction for rotating counterclockwise once is generated. In addition, when button B3 is pressed continuously, the system generates a continuous instruction every 500ms.
[0076] If the control command received this time is identified as a continuous command, for the convenience of explanation, the first received continuous command is positioned as the first command. Here, the preset time is set to 2s. Figure 3 If the user continues to press button B3, a continuous instruction will be sent every 500ms. Since 500ms is less than the preset time of 2s, the robot head will rotate continuously when the user continues to press. After stopping pressing button B3, if the user presses button B2 in the opposite direction within 2s, it will continue to be controlled as a continuous instruction of this control process; when the user does not operate within 2s, that is, no continuous instruction is received, it is considered that this control process is over, and the last continuous instruction received in this process is defined as the last instruction. In addition, when pressing for the first time, the network delay will be measured; finally, the pressing process will be stored as historical data. For example, the historical data is: network delay 100ms, first continuous instruction, target angle 18 degrees, second continuous instruction, target angle 18 degrees, third continuous instruction, target angle -5 degrees, fourth continuous instruction, target angle 2 degrees.
[0077] After collecting a sufficient amount of historical data, the automatic rotation mode can be turned on in the system. In the automatic rotation mode, when the user continues to issue continuous instructions, a rotation instruction will be generated according to the situation of this continuous instruction to automatically rotate the robot head. In particular, the continuous instructions referenced here are continuous instructions in the same direction. For example, if the user continues to press button B3 to generate 5 continuous instructions and then stops, the rotation instruction is generated with reference to the 5 continuous instructions. The specific generation method will be introduced later. In addition, the sum of the numerical values of the rotation angles of the 5 continuous instructions is used as the first angle, and the sum of the rotation angles of the rotation instructions is used as the second angle. The second angle is smaller than the first angle. Since the rotation instruction is to fine-tune the angle of the robot head, it is inevitable that the second angle is smaller than the first angle.
[0078] Generating a rotation instruction based on historical data includes the following steps:
[0079] All target angles included in each piece of historical data are merged into a positive rotation angle and a negative rotation angle, the positive rotation angle is greater than the negative rotation angle, the merged historical data is defined as preprocessed data, and the preprocessed data is classified based on network delay and the positive rotation angle to obtain multiple classification results;
[0080] After the robot head continuously receives multiple continuous instructions including target angles in the same direction and no continuous instructions are received within the detection time, the target angles included in the continuous instructions are merged into a total angle, and the network delay when issuing the continuous instructions is obtained. The corresponding classification results are matched based on the total angle and the network delay, and a historical data is extracted from the classification results as the representative data, and a rotation instruction is generated based on the negative rotation angle in the representative data.
[0081] Here, the rotation angle direction in the continuous instruction received by the receiving module for the first time is positioned as the positive rotation angle, because it is generally used to rotate the robot head to the direction it needs; if the historical data is: the first continuous instruction, the target angle is 18 degrees, the second continuous instruction, the target angle is 18 degrees, the third continuous instruction, the target angle is -5 degrees, the fourth continuous instruction, the target angle is 2 degrees, then the first continuous instruction, the second continuous instruction and the fourth continuous instruction are combined to obtain a positive rotation angle of 38 degrees, and the negative rotation angle is 5 degrees based on the third continuous instruction; after that, the network delay and the positive rotation angle are used as features for classification, and the K-means clustering algorithm is used. In the classification process, the classification results are evaluated by the contour coefficient as an indicator, and the final classification number of the K-means clustering algorithm is changed according to the evaluation results. It is a specific prior art and will not be introduced here. After the classification is completed, the pre-processed data with close network delay values and positive rotation angle values are classified into one category, and the clusters obtained after classification are named classification results. Here, the cluster center in each classification result is used as representative data.
[0082] Here, the detection time is set to 1s, and the detection time should be less than the preset time. After the robot head receives multiple continuous clockwise instructions and no continuous instructions are received within 1s, the robot head starts the automatic rotation process. During the rotation process, the multiple continuous instructions received this time are first merged. For example, the first continuous instruction, the second continuous instruction and the third continuous instruction include 5 degrees, 6 degrees and 7 degrees clockwise respectively. The total angle obtained after merging is 18 degrees. The network delay when the first continuous instruction is issued is 76ms. Then, the corresponding classification result is matched according to the total angle and the network delay. When matching, it is compared with each pre-processed data included in the classification result. As long as there is a network delay less than the second threshold and the difference between the total angle and the positive rotation angle is less than the third threshold, the match is considered successful. The second threshold can be 30ms and the third threshold can be 5 degrees. If the negative rotation angle representing the result in the matched classification result is 2 degrees, a rotation instruction including 2 degrees is generated.
[0083] A graphical interface is provided in the command module for controlling the motor, and the graphical interface includes a first area, a second area and a third area, the first area displays the orientation of the robot head in a vertical plane, the second area displays the orientation of the robot head in a horizontal plane, and the third area is used to display a real-scene image captured by the robot head in real time;
[0084] A first button and a second button are respectively arranged on one side of the first area and the second area. After the user drags the first button or the second button and keeps it still, the instruction module generates a third angle according to the movement stroke of the first button this time, and generates a fourth angle according to the movement stroke of the second button this time, and sends the third angle and the fourth angle as a single instruction.
[0085] like Figure 3 As shown, the graphical interface includes a first area A1, a second area A2 and a third area A3. The first area A1 displays the orientation of the robot head in a vertical plane. The specific orientation can be determined by the robot viewing angle marked in the first area A1. The principle of determining the robot orientation in the second area A2 is the same as that in the first area A1.
[0086] A first button and a second button are respectively arranged on one side of the first area and the second area. After the user drags the first button or the second button and keeps it still, the instruction module generates a third angle according to the movement stroke of the first button this time, and generates a fourth angle according to the movement stroke of the second button this time, and uses the third angle and the fourth angle as the target angles of a single instruction.
[0087] Here Figure 3Take the second button B1 in the figure as an example to illustrate, the fourth angle is generated by dragging the second button B1 left and right with a mouse or finger. The fourth angle is the rotation angle of the robot head in the horizontal plane, and the size of the fourth angle is determined according to the size of the dragging stroke of the second button B1.
[0088] A first combination key and a second combination key are respectively arranged on one side of the first area and the second area. Pressing the first combination key or the second combination key once generates a fifth angle or a sixth angle. When the user continues to press the first combination key or the second combination key, the fifth angle or the sixth angle is generated based on a preset interval, and the fifth angle and the sixth angle are sent as continuous instructions.
[0089] Continue to refer to Figure 3 Here, the second combination key is taken as an example. The second combination key is set on the lower side of the second area, which includes the counterclockwise key B2 and the clockwise key B3. Each time the clockwise key B3 is pressed, the robot head rotates clockwise by the sixth angle. When the clockwise key B3 is pressed continuously, a continuous instruction is generated every 500ms, in which the robot head is specified to rotate clockwise by the sixth angle.
[0090] like Figure 1 As shown, the present invention also provides a motor-based robot head control device, which is used to implement the above-mentioned motor-based robot head control method, and the device includes:
[0091] A first motor 1 is provided at the head of the robot, and the first motor 1 controls the robot head to rotate in a horizontal direction in a direct drive manner;
[0092] The second motor 2 is arranged on the head of the robot, and the second motor 2 controls the robot head to rotate in the vertical direction in a direct drive manner;
[0093] A first motion encoder 3 is provided in the first motor 1. The first motion encoder 3 is provided with a first unit number, which is a multiple of 2. The first motion encoder 3 divides the rotation angle of the first motor 1 into a first control precision based on the first unit number. After receiving the first target angle, the first motion encoder 3 calculates a first pulse value based on the first control precision and the first target angle. During the rotation of the first motor 1, the first motion encoder 3 records the pulse value of the first motion controller 5 to record the rotation angle of the first motor 1.
[0094] The second motion encoder 4 is arranged in the second motor 2. The second motion encoder 4 is provided with a second unit number, and the second unit number is a multiple of 2. The second motion encoder 4 divides the rotation angle of the second motor 2 into a second control precision based on the second unit number. After receiving the second target angle, the second motion encoder 4 calculates a second pulse value based on the second control precision and the second target angle. During the rotation of the second motor 2, the second motion encoder 4 records the pulse value of the second motion controller 6 to record the rotation angle of the second motor 2;
[0095] A first motion controller 5 is disposed in the first motor 1, and the first motion controller 5 drives the first motor 1 to rotate a first target angle based on a first pulse value;
[0096] The second motion controller 6 is disposed in the second motor 2 , and drives the second motor 2 to rotate to a second target angle based on the second pulse value.
[0097] The present invention also discloses a computer storage medium, wherein the computer storage medium stores program instructions, wherein when the program instructions are executed, the device where the computer storage medium is located is controlled to execute the above method.
[0098] It should be understood that, although each step in the flow chart of each embodiment of the present invention is shown in sequence according to the indication of the arrow, these steps are not necessarily performed in sequence according to the order indicated by the arrow. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be performed in other orders. Moreover, at least a portion of the steps in each embodiment may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.
[0099] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0100] The above embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for those of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
[0101] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A motor-based robot head control method, characterized in that: include: A first motor and a second motor are respectively arranged on the first side and the second side of the robot head, the first motor controls the robot head to rotate in the horizontal direction in a direct drive manner, and the second motor controls the robot head to rotate in the vertical direction in a direct drive manner; A first motion encoder and a first motion controller are arranged inside the first motor, and a second motion encoder and a second motion controller are arranged inside the second motor, a first number of units is arranged inside the first motion encoder, and a second number of units is arranged inside the second motion encoder, and both the first number of units and the second number of units are multiples of 2; The first motion encoder divides the rotation angle of the first motor into first control precision based on the first unit number, and the second motion encoder divides the rotation angle of the first motor into second control precision based on the second unit number; After receiving the first target angle and the second target angle, the first motion encoder calculates a first pulse value based on the first control accuracy and the first target angle, and the second motion encoder calculates a second pulse value based on the second control accuracy and the second target angle; The first motion controller drives the first motor to rotate the first target angle based on the first pulse value, and the second motion controller drives the first motor to rotate the second target angle based on the second pulse value; During the rotation of the first motor and the second motor, the first motion encoder and the second motion encoder record the pulse values of the first motion controller and the second motion controller to record the rotation angles of the first motor and the second motor.
2. The method according to claim 1, characterized in that The rotation speed of the first motor and the second motor is greater than or equal to 120r / min.
3. The method according to claim 1, characterized in that During the actual rotation of the robot head, the actual rotation speed of the first motor is obtained based on the following steps: Acquire a first signal and a second signal of the first motor, transmit the first signal to a first analysis module, and input the first signal and the second signal to a second analysis module; Setting a limit speed, obtaining a target speed of the first motor, and if the target speed is less than the limit speed, the first analysis module analyzes the first signal to obtain a first rotation speed of the first motor, and uses the first rotation speed as a current first actual rotation speed of the motor; If the target speed is greater than or equal to the limit speed, a corresponding first motor acceleration is set for each target speed, and an ideal operation process of the first motor is generated based on the acceleration, the target speed and the target angle, wherein the ideal operation process includes an acceleration process, a uniform speed process and a deceleration process, and the ideal operation process is divided into a plurality of process speeds, and the process speed closest to the limit speed in the acceleration process is defined as a first critical speed, and the process speed closest to the limit speed in the deceleration process is defined as a second critical speed, and the time points corresponding to the first critical speed and the second critical speed are defined as a first time point and a second time point, respectively, and a third time point and a fourth time point are located between the first time point and the second time point; After the second time point and before the third time point, the first analysis module obtains the first speed of the first motor, and the first speed is used as the current second actual speed of the motor. Between the third time point and the second time point, the second analysis module analyzes the first signal or the second signal to obtain the second speed of the first motor, and the second speed is used as the current third actual speed of the motor.
4. The method according to claim 1, characterized in that The control instruction for driving the first motor to rotate further includes a continuous instruction, the continuous instruction includes a target angle and a target speed, the continuous instruction received for the first time is defined as a first instruction, the robot head is rotated according to the target angle and the target speed in the first instruction, and if the continuous instruction is received again within a preset time, the robot head continues to be rotated based on the continuous instruction until the continuous instruction is not received within the preset time; defining the continuous instruction received for the last time as the last instruction, and storing the first instruction, the last instruction, all the continuous instructions therebetween, and the network delay when the first instruction is issued as historical data; After the continuous instruction is sent again, a rotation instruction is generated and sent by combining the continuous instruction and the historical data; After the robot head completes the rotation of the first angle based on the continuous instruction, it rotates to a second angle based on the rotation instruction, and the second angle is smaller than the first angle.
5. The method according to claim 4, characterized in that Generating the rotation instruction based on the historical data comprises the following steps: Merging all target angles included in each piece of the historical data into a positive rotation angle and a negative rotation angle, wherein the positive rotation angle is greater than the negative rotation angle, defining the merged historical data as preprocessed data, and classifying the preprocessed data based on the network delay and the positive rotation angle to obtain multiple classification results; After the robot head continuously receives multiple continuous instructions including target angles in the same direction and fails to receive the continuous instructions within the detection time, the target angles included in the continuous instructions are merged into a total angle, and the network delay when the continuous instructions are issued is obtained. The corresponding classification result is matched based on the total angle and the network delay, and one piece of historical data is extracted from the classification result as representative data, and the rotation instruction is generated based on the negative rotation angle in the representative data.
6. The method according to claim 4, characterized in that A graphical interface is provided in the command module for controlling the motor, the graphical interface comprising a first area, a second area and a third area, the first area displays the orientation of the robot head in a vertical plane, the second area displays the orientation of the robot head in a horizontal plane, and the third area is used to display a real-life image captured by the robot head in real time; A first button is set on one side of the first area, and a second button is set on one side of the second area. After the user drags the first button or the second button and keeps it still, the instruction module generates a third angle according to the movement stroke of the first button this time, and generates a fourth angle according to the movement stroke of the second button this time, and sends the third angle and the fourth angle as a single instruction.
7. The method according to claim 6, characterized in that A first combination key is set on one side of the first area, and a second combination key is set on one side of the second area. Pressing the first combination key or the second combination key once generates a fifth angle or a sixth angle. When the user continues to press the first combination key or the second combination key, the fifth angle or the sixth angle is generated based on a preset interval, and the fifth angle and the sixth angle are sent as continuous instructions.
8. The method according to claim 5, characterized in that The preprocessed data is classified using the K-means algorithm.
9. A robot head control device based on a motor, used to implement the method according to any one of claims 1 to 8, characterized in that: include, A first motor is arranged on the head of the robot, and the first motor controls the robot head to rotate in a horizontal direction in a direct drive manner; A second motor is provided at the head of the robot, and the second motor controls the robot head to rotate in a vertical direction in a direct drive manner; a first motion encoder, arranged in the first motor, the first motion encoder being provided with a first number of units, the first number of units being a multiple of 2, the first motion encoder splitting the rotation angle of the first motor into a first control precision based on the first number of units, after receiving a first target angle, the first motion encoder calculating a first pulse value based on the first control precision and the first target angle, and in the process of rotation of the first motor, the first motion encoder recording a pulse value of a first motion controller to record the rotation angle of the first motor; a second motion encoder, arranged in the second motor, the second motion encoder being provided with a second number of units, the second number of units being a multiple of 2, the second motion encoder splitting the rotation angle of the second motor into a second control precision based on the second number of units, after receiving the second target angle, the second motion encoder calculating a second pulse value based on the second control precision and the second target angle, and during the rotation of the second motor, the second motion encoder recording a pulse value of a second motion controller to record the rotation angle of the second motor; A first motion controller is disposed in the first motor, and the first motion controller drives the first motor to rotate the first target angle based on the first pulse value; A second motion controller is disposed in the second motor, and the second motion controller drives the second motor to rotate the second target angle based on the second pulse value.
10. A computer storage medium, characterized in that: The computer storage medium stores program instructions, wherein when the program instructions are executed, the device where the computer storage medium is located is controlled to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Control system based on intelligent robot head
CN106843002A
Control system and control method of bird repellent robot for power industry
CN109799760A
Mechanical arm joint control method
CN109531568A
Method for measuring rotor position of permanent magnet synchronous motor
CN109945819A