Disclosure of Invention
Aiming at the defects that the control precision of a steering engine is poor, the working efficiency of a robot in the actual working process is affected and a certain potential safety hazard is caused due to the fact that the traditional steering engine has gear deficiency, shake and small locking moment in the technology, the invention provides a control method, a control system, a robot and a readable storage medium of an outer rotor brushless double-magnetic encoder steering engine.
In order to achieve the above purpose, the control method of the outer rotor brushless double-magnetic encoder steering engine provided by the invention comprises the following steps:
s1, initializing state parameters of a steering engine and a controller, and acquiring an initial position of the steering engine;
S2, setting a target position and expected parameters of a steering engine, and respectively detecting and obtaining the current angle positions of a steering engine motor rotor and an output shaft of a gear set through a motor magnetic encoder and an output shaft magnetic encoder;
s3, calculating the distance between the current position of the output shaft and the target position;
And S4, regulating and controlling motor parameters through a controller to enable the output shaft to reach a target position, firstly judging whether the current speed of the output shaft is 0, accelerating to the target speed and performing uniform motion, slowly decelerating until reaching the target position when approaching the target position if the current speed of the output shaft is 0, judging whether the current speed is consistent with the target speed if the current speed of the output shaft is not 0, judging whether the current speed is consistent with the target speed or not, accelerating or decelerating until the current speed is consistent with the target speed if the current speed is inconsistent with the target speed, decelerating to 0 if the current speed is inconsistent with the target speed, and re-accelerating to the target speed and performing uniform motion, and slowly decelerating until reaching the target position when approaching the target position.
As an improvement of the present invention, in S2, the current actual angular positions P m_actual and P actual of the motor rotor and the output shaft are obtained by the motor magnetic encoder and the output shaft encoder, respectively, and in S3, the motor rotor output converts the power to output shaft through the reduction gear set, and then the angle variation of the output shaft is obtained as follows:
Wherein P m△ is the angle variation of the motor rotor, P △ is the angle variation of the output shaft, R gear is the gear reduction ratio, and further, the angle required by the motion of the output shaft from the current angle position to the target position is calculated as follows:
P△=Pnow-Pactual
Wherein P now is the current angular position of the output shaft, and then the angle required for the motor rotor to move from the current angular position to the output shaft reaching the target position is calculated as follows:
Pm△=P△·Rgear=(Pnow-Pactual)·Rgear
As a modification of the present invention, in S4, according to the target speed V target and the target acceleration a accel input by the user, repeating the motion at the fixed frequency f m, the time T accel, the elapsed control cycle number T ticks_accel, and the elapsed angle S accel of the motor from 0 to the target speed are calculated as
As an improvement scheme of the invention, the duration T const, the number of the passed control cycles T ticks_const and the distance S const of the constant speed stage when the steering engine is reached are
Sconst=|Ptarget-Pstart|-Saccel-Sdecel
Wherein, P target is the target angle of the output shaft input by the user, and P start is the initial angle of the whole acceleration and deceleration process. After the steering engine reaches the target speed, the steering engine keeps constant-speed motion at the target speed,
As an improvement of the present invention, when the steering engine starts decelerating at the current target speed approaching the target position, the time required for the deceleration process is T decel, the number of elapsed control cycles T ticks_decel, and the elapsed angle S decel are:
as an improvement scheme of the invention, when the steering engine is in an acceleration movement stage, the calculation formula is as follows:
The calculation formula of the steering engine in the uniform motion stage is as follows:
Vnow=Vtarget
the calculation formula when the steering engine is in the deceleration movement stage is as follows:
wherein, V now is the expected speed of the steering engine at the current time, V last is the expected speed of the steering engine at the last time, P now is the expected position of the steering engine at the current time, P last is the expected position of the steering engine at the last time, and a accel is the acceleration set by user input.
As an improvement of the present invention, when the motor movement is finished, the current angle position P now of the motor rotor is equal to the output shaft target angle P target input by the user, so that the actual angle position P actual of the output shaft is equal to the output shaft target angle P target input by the user, and the actual angle position P actual of the output shaft is adjusted by the following formula:
Pm_target=Pm_actual+(Ptarget-Pactual)·Rgear
When the actual position is consistent with the target position, the P m_actual of the current motor is recorded, the repeated movement process is stopped, the actual angle position P m_actual of the motor rotor is taken as the target angle position P m_target of the motor rotor, and the motor control program locks the angle position of the motor rotor at P m_actual until the next movement process starts.
As an improvement scheme of the invention, the invention also discloses a control system of the outer rotor brushless double-magnetic encoder steering engine, which is used for executing the control method of the outer rotor brushless double-magnetic encoder steering engine, and comprises the following steps of
The output module is used for generating power so as to enable the steering engine to work;
the control module is used for inputting steering engine parameters and carrying out parameter adjustment on the output module;
The detection module is used for detecting the rotating speed and the angle of the output module and feeding back the rotating speed and the angle to the control module.
The invention also comprises an outer rotor brushless double-magnetic encoder steering engine, and a control method for executing the outer rotor brushless double-magnetic encoder steering engine, wherein the control method comprises a shell, an outer rotor brushless motor, a reduction gear set and a main control board, wherein the outer rotor brushless motor, the reduction gear set and the main control board are arranged in the shell, the brushless motor is sleeved with the reduction gear set through a motor output shaft, and the reduction gear set is provided with a gear set output shaft; the main control board is provided with a first magnetic encoder and a second magnetic encoder for detecting the rotation speed and the angle of a motor rotor of the outer rotor brushless motor and an output shaft of the gear set.
As an improvement of the present invention, there is also provided a readable storage medium having stored thereon a computer program for realizing the control method of the outer rotor brushless double magnetic encoder steering engine when the computer program is executed by a robot.
Compared with the prior art, the control method, the control system, the robot and the readable storage medium for the external rotor brushless double-magnetic encoder steering engine have the advantages that the double-magnetic encoder is used for detecting the angle positions of the motor rotor and the output shaft, the high-precision adjustment of the steering engine output is realized through the compensation detection of the double-magnetic encoder according to the angle positions and the differential speed of the motor and the output shaft of the gear set and the power difference value converted by the reduction gear set, the problems of gear deficiency, shake and small locking moment of the traditional steering engine are avoided, and the upper limit of the movement and the operation precision of the robot in an actual application scene are further improved.
Detailed Description
In order to more clearly illustrate the invention, the invention is further described below with reference to the accompanying drawings.
In the following description, details of examples are set forth in order to provide a more thorough understanding of the present invention. It will be apparent that the described embodiments are only some, but not all, embodiments of the invention. It should be understood that the detailed description is intended to illustrate the invention, and is not intended to limit the invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, or groups thereof.
Referring to fig. 1-4, the control method of the steering engine of the outer rotor brushless double-magnetic encoder comprises the following steps:
s1, initializing state parameters of a steering engine and a controller, and acquiring an initial position of the steering engine;
S2, setting a target position and expected parameters of a steering engine, and respectively detecting and obtaining the current angle positions of a steering engine motor rotor and an output shaft of a gear set through a motor magnetic encoder and an output shaft magnetic encoder;
s3, calculating the distance between the current position of the output shaft and the target position;
And S4, regulating and controlling motor parameters through a controller to enable the output shaft to reach a target position, firstly judging whether the current speed of the output shaft is 0, accelerating to the target speed and performing uniform motion, slowly decelerating until reaching the target position when approaching the target position if the current speed of the output shaft is 0, judging whether the current speed is consistent with the target speed if the current speed of the output shaft is not 0, judging whether the current speed is consistent with the target speed or not, accelerating or decelerating until the current speed is consistent with the target speed if the current speed is inconsistent with the target speed, decelerating to 0 if the current speed is inconsistent with the target speed, and re-accelerating to the target speed and performing uniform motion, and slowly decelerating until reaching the target position when approaching the target position.
The invention adopts the steering engine driven by the external rotor brushless motor, so that compared with the traditional direct current brush motor, the power density and the torque density of the external rotor brushless motor are larger than those of the brush motor, the brushless motor can realize larger locking moment and ensure the stable operation of the steering engine, meanwhile, the invention adopts the double-magnetic encoder to perform angle detection on the motor rotor and the output shaft of the brushless motor, the high accuracy can be realized in the control output of the steering engine, and the response gain is larger under the condition that the steering engine locking moment is larger, so that the overshoot problem occurs when the steering engine is more easy to move from the initial position to the target position, the steering engine is required to realize large gain, and the detection of the double-magnetic encoder is required to be matched with the brushless motor, so as to achieve the accurate control of the angle position of the motor rotor, thereby ensuring the normal operation of the steering engine.
The acceleration during acceleration and deceleration of the brushless motor, the maximum speed during movement, and the target position of the output shaft are all specified by the user inputting data via the communication interface, and the controller executes the movement control logic at a fixed frequency.
According to the control logic, the expected speed V now at the current moment corresponding to the steering engine at the current moment and the expected position P now at the current moment are calculated according to the motion parameters, the initial speed is set to be V start, the maximum speed input by a user is set to be V target, and the acceleration is set to be A accel. Control repeating the motion control logic at frequency f m for a time T accel from acceleration to maximum speed
The number of control cycles T ticks_accel passing from 0 acceleration to maximum speed is
An angle S accel from 0 acceleration to maximum speed
When the steering engine accelerates to the target speed, the steering engine moves at the target speed until the steering engine approaches to the target position to start decelerating, wherein the acceleration during deceleration is opposite to the acceleration during acceleration in the same direction, namely A decel=-Aaccel. So the time T decel, the number of control cycles T ticks_decel, and the angle S decel for the deceleration process are respectively
Wherein P target is the target angle of the output shaft input by the user, and P start is the initial angle of the whole acceleration and deceleration process of the steering engine.
The duration T const of the steering engine in the constant speed stage, the passing control cycle number T ticks_const and the path S const are as follows:
Sconst=|Ptarget-Pstart|-Saccel-Sdecel
After the acceleration and deceleration time length of each stage of the steering engine is obtained, the current time and the starting time of the motion process are checked when the motion control program is operated each time, and the specific time T from the starting time to the current elapsed time of the steering engine is calculated, so that how the steering engine moves can be judged.
T=Tnow-Tstart
Where T is the time elapsed from the start time to the current time, T now is the current time, and T start is the start time of the entire exercise session.
Acceleration time T < T accel
Constant speed time T accel<=T<Taccel+Tconst
Deceleration time T accel+Tconst<=T<Taccel+Tconst + Tdecel
After the control program finishes judging the motion state of the steering engine, calculating the expected position and the expected speed at the current moment according to the motion state of the steering engine, wherein the expected speed is obtained through acceleration integration, and the expected position of the steering engine is obtained through speed integration.
Calculating formula of steering engine in acceleration stage according to uniform acceleration motion calculating formula
The calculation formula of the steering engine in the uniform motion stage is as follows
Vnow=Vtarget
The calculation formula of the steering engine in the deceleration movement stage is as follows
Where V now is the desired speed at the current time, V last is the desired speed at the last time, P now is the desired position at the current time, P last is the desired position at the last time, and A accel is the acceleration input by the user.
After the current time expected position and the current time expected speed of each stage of the steering engine acceleration motion stage, the uniform motion stage and the deceleration motion stage are calculated, the current actual angle position P actual of the output shaft acquired by the output shaft magnetic encoder and the current actual angle position P m_actual of the motor rotor are acquired by the motor magnetic encoder, and the angle change of the motor rotor output to the output shaft through the reduction gear set is calculated, so that the angle of the output shaft is accurately controlled, and the angle change relation is as follows:
Wherein P m△ is the angle variation of the motor rotor, P △ is the angle variation of the output shaft, R gear is the gear reduction ratio, and further, the angle formula needed to pass from the current actual position of the output shaft to the desired position is calculated as follows:
P△=Pnow-Pactual
The angle formula for calculating the motor from the current position to the output shaft reaching the expected position is:
Pm△=P△·Rgear=(Pnow-Pactual)·Rgear
The motor target angular position P m_target is:
Pm_target=Pm_actual+Pm△=Pm_actual+(Pnow-Pactual)·Rgear
The new motor target position is used as the target position of a motor control program position PID, a motor control program generates a control moment for controlling the motor according to the target position and the current position, the motor control program mainly realizes the universal FOC force position control, FOC (field vector control) is a motor control method, the method is called vector control, the method realizes the accurate control of the motor by converting three-phase current of the motor into two orthogonal currents, namely a straight axis current I d and an intersecting axis current I q and controlling the magnitudes of the straight axis current I d and the intersecting axis current I q, the force position control, namely torque and position control, the above-mentioned motion process is repeated until the motion process is completed, and the expected position at the end of the last motion process is equal to the target position, namely P now=Ptarget. After the movement process is completed, the following process is continuously repeated until P actual=Ptarget.
Pm_target=Pm_actual+(Ptarget-Pactual)·Rgear
When the actual position of the motor rotor is consistent with the target position, recording the actual position P m_actual of the motor rotor at the current moment of the motor, stopping repeating the process, and locking the position at P m_actual by taking P m_actual as the target angle P m_target of the output shaft until the next movement process starts. Because the micro disturbance of the steering engine output shaft can be amplified by the reduction gear set and fed back to the motor, the motor output shaft causes larger disturbance, and the motor control program directly controls and adjusts according to the disturbance, so that the response speed of the steering engine is greatly improved.
As the reduction gear set exists between the motor rotor and the steering engine output shaft, the rotation angle of the steering engine output shaft with the motor rotor rotating by 1 DEG is onlyThe control precision is higher, and because of the gear clearance of the reduction gear and the size of the load, virtual positions exist, the error between the position of the output shaft detected by the magnetic encoder of the steering engine output shaft and the actual position can be reduced by using the method, wherein the precision resolution of the magnetic encoder can reach 0.02 DEG, the magnetic encoder of the motor rotor compensates, and the compensating resolution can reachTherefore, the motor rotor can realize faster response and higher control bandwidth, and finally realize the full use of two encoders to realize high-precision position control so as to meet the precision requirements of robots such as mechanical arms.
The position output of the magnetic encoder is a single-circle absolute value, namely, the angle of 0-360 can be detected, and the position output starts from 0 again after exceeding the angle. The output shaft is rotated by the motor rotor through the transmission of the reduction gear set, and the motion of the motor rotor does not exceed 360 degrees in practical application of the robot joint, so special treatment is not needed, and most of the motor rotor actually moves for multiple circles in the steering engine operation process, so that the calculation of the absolute positions of multiple circles is needed to be realized on software, and the calculation flow is as follows:
Referring to fig. 2, firstly, a single-turn angular position of a motor rotor of a current brushless motor is detected and obtained through a magnetic encoder, and whether the current turn number is increased or decreased is judged according to the current motor rotor position and the position of the motor rotor at the last moment, namely, whether the current angle position P now -the last position P last are more than 180 degrees, so that the multi-turn absolute position of the electronic rotor is the current angle position P now +the number of turns×360 degrees, and when the next movement is performed, the angle obtained at the time is assigned as the current angle position P now, so that the calculation of the motor rotor on the multi-turn absolute position can be obtained.
In order to ensure that the gear set output shaft can stably and does not overshoot when moving or changing speed, a user can input parameters such as a target position, speed, acceleration and the like through a control interface, control the rotation of a motor, determine how to change the movement state according to the current movement state, specifically judge whether the movement control parameter of a current steering engine is updated or not as shown in a graph 2, acquire the position of the current output shaft if the update occurs, calculate the distance between the position of the output shaft and the set target position and whether the rotation speed of the motor is 0 or not, accelerate to the same size and perform uniform movement according to the size of the target speed when the current speed of the motor is 0, until the current speed of the motor is not 0 and is consistent with the set target speed, further judge whether the current speed is less than the target speed according to the direction, accelerate to the target speed if the current speed is less than the target speed, decelerate to 0 and re-accelerate to the same size and direction as the target speed, and then slowly accelerate to the target position when the current speed is 0 and the current speed is consistent with the set target speed.
In this embodiment, the invention also discloses a control system of the outer rotor brushless dual magnetic encoder steering engine, which is used for executing the control method of the outer rotor brushless dual magnetic encoder steering engine, comprising:
The output module is used for generating power so as to enable the steering engine to work;
The control module is used for inputting steering engine parameters and carrying out parameter adjustment on the output module;
The detection module is used for detecting the rotating speed and the angle of the output module and feeding the rotating speed and the angle back to the control module.
Referring to fig. 3-4, in this embodiment, the control method for implementing the external rotor brushless dual magnetic encoder steering engine further includes a housing 1, an external rotor brushless motor 2, a reduction gear set 3 and a main control board 4, wherein the external rotor brushless motor 2, the reduction gear set 3 and the main control board 4 are arranged in the housing 1, the brushless motor 2 is in transmission connection with the reduction gear set 3 through a motor output shaft 5, the reduction gear set 3 is sleeved with a gear set output shaft 6, and the main control board 4 is provided with a first magnetic encoder 7 and a second magnetic encoder 8 for detecting the rotation speed and the angle of the motor rotor and the gear set output shaft of the external rotor brushless motor.
In this embodiment, there is also provided a readable storage medium having stored thereon a computer program for implementing the control method of the outer rotor brushless dual magnetic encoder steering engine of any one of the above when the computer program is executed by the robot.
The invention has the advantages that:
1) According to the invention, the double magnetic encoders are arranged to detect the angles and the rotating speeds of the motor rotor and the output shaft respectively, so that the control precision is improved.
2) The transmission ratio of the brushless motor and the output shaft is accurately controlled through the double magnetic encoders, shake can be avoided when the motor gain is large, the problems of overshoot and shake of the steering engine are prevented, the brushless motor is adopted, and the problem that the locking moment of the traditional steering engine is small is solved.
The above disclosure is only a few specific embodiments of the present invention, but the present invention is not limited thereto, and any changes that can be thought by those skilled in the art should fall within the protection scope of the present invention.