Home > other >  Program how to realize dc gear motor double closed loop speed loop and position loop control?
Program how to realize dc gear motor double closed loop speed loop and position loop control?

Time:09-20

1000 r/min, dc gear motor, motor speed 200 r/min, the motor tail with incremental encoder, hall 12 PPR resolution, is to achieve statistical hall pulse number which can adjust the position and velocity,, do you have any Suggestions? Purpose is to achieve a given location, accurate positioning, allowing each positioning two pulse error,

CodePudding user response:

Taobao is through that hole block slice statistical number to calculate revolution sensor, laser do car all know

CodePudding user response:

Hardware has been on my side, mainly program algorithm to achieve, speed and position double closed loop control, the purpose is: in the fixed stop, overshoot error not too much, want to know related data or program, hope to have a big inspiration,

CodePudding user response:

refer to the second floor cloud mountain foothill reply:
I have been here for the hardware, mainly is the program algorithm to achieve, speed and position double closed loop control, the purpose is: in the fixed stop, overshoot error not too much, want to know related data or program, hope to have a big inspiration,

With PI control, P parameters and slowly try,

CodePudding user response:

references a tree may reply: 3/f
Quote: refer to the second floor cloud mountain foothill reply:

Hardware have on my side, mainly program algorithm to achieve, speed and position double closed loop control, the purpose is: in the fixed stop, overshoot error not too much, want to know related data or program, hope to have a big inspiration,

With PI control, P parameters and slowly try,
how to switch the speed and position control, need to accelerate the s curve?

CodePudding user response:

reference 4 floor cloud mountain foothill reply:
Quote: refer to the third floor of a tree may reply:
Quote: refer to the second floor cloud mountain foothill reply:

Hardware have on my side, mainly program algorithm to achieve, speed and position double closed loop control, the purpose is: in the fixed stop, overshoot error not too much, want to know related data or program, hope to have a big inspiration,

With PI control, P parameters and slowly try,
how to switch the speed and position control, need to accelerate the s curve?

I sorry, I didn't know your problem, when the position control speed change isn't it?

CodePudding user response:

Is variable, even don't know how to match between speed and actual location, such as what a function can let the motor when set to position, velocity is almost zero, so no overshoot, speed regulation: I now is trapezoidal speed control method, the result is bad, want to try the S type, need you say PI speed and compare set speed? Then the set speed is I need to measure out? Anyway, regardless of how to achieve a purpose, realize dc gear motor positioning is accurate,

CodePudding user response:

PI control is according to the location difference speed regulation, the original poster is using PWM control of the motor?

CodePudding user response:

Yes, STM32 hardware produces PWM frequency 1 k

CodePudding user response:

Can go into more detail about PI speed according to its location is poor? Such as speed control function parameter is the current position and target location; Or the other, mainly is the mentally, no clue,

CodePudding user response:

Double Command;//target position pulse number
Double Proportion;//ratio
A double Integral.//integral coefficient
Double preErr;//a beat before error

Void PI_Cal ()
{
Float Err, pErr, dU;
Err=Command - feedback;//feed back pulse number
PErr=Err - preErr;
DU=pErr + Integral Proportion * * Err;
PreErr=Err;
Return the dU;
}
The code above is incremental PI control code,
1. DU can be thought of as a coefficient, the coefficient multiplied by the PWM pulse width as the largest output; Also can be regarded as a PWM output pulse width,
2. General PI parameter set for the first a few or even zero 0 0 point, simulation calculate dU is probably best; P parameters affect the overshoot, the I parameter influence to adjust time, is a positive correlation, the greater the P overshoot amount is larger, I adjust the longer, the greater the
3. Set the limit value, such as dU & lt; 0, PWM pulse width limit for the minimum pulse width, dU & gt; Max, the PWM pulse width limits to the maximum pulse width,
4. Position the refresh time between 1 ~ 100 ms, experience value, specific see debugging result,

CodePudding user response:

Have a professional servo card, the original poster is this low cost solution

CodePudding user response:

Thank you for your answer, this program has given me great inspiration, but I still have a few questions:
1. Combined the actual motor speed, I was ready to set up 20-50 ms ms refresh pulse number at a time,
2. The target pulse number is every time to time to refresh, then set the new; Or directly set pulse count, the final goal (should be updated every time)
3. If be to reset pulse number every time, so every time the target pulse number how to set up? As increasing arithmetic or geometric index increment?
4. The whole post in order to accurate positioning, speed is just one of them, in the end, how to set goals pulse number?

CodePudding user response:

Target pulse number set to the current position to the target of the total number of pulse; Feedback pulse number is source to the moment of the total number of pulses, refreshed in the position of computing, near the end of the calculated value of dU will be small, almost to zero, the distance from the end stop with one or two pulse motor, motor inertia can rely on stepped forward a bit, specific see effect,
This is the most typical applications of classical control theory, the original poster can find information on the net,

CodePudding user response:

PID control

CodePudding user response:

The
references to the tenth floor yishumei response:
double Command;//target position pulse number
Double Proportion;//ratio
A double Integral.//integral coefficient
Double preErr;//a beat before error

Void PI_Cal ()
{
Float Err, pErr, dU;
Err=Command - feedback;//feed back pulse number
PErr=Err - preErr;
DU=pErr + Integral Proportion * * Err;
PreErr=Err;
Return the dU;
}
The code above is incremental PI control code,
1. DU can be thought of as a coefficient, the coefficient multiplied by the PWM pulse width as the largest output; Also can be regarded as a PWM output pulse width,
2. General PI parameter set for the first a few or even zero 0 0 point, simulation calculate dU is probably best; P parameters affect the overshoot, the I parameter influence to adjust time, is a positive correlation, the greater the P overshoot amount is larger, I adjust the longer, the greater the
3. Set the limit value, such as dU & lt; 0, PWM pulse width limit for the minimum pulse width, dU & gt; Max, the PWM pulse width limits to the maximum pulse width,
4. Position the refresh time between 1 ~ 100 ms, experience value, specific see debugging result,


You are the proportional and differential how to feel? Error - preerror should be differential process, and then directly by the error ratio regulation, isn't it? If I score should not accumulate
  • Related