Gains tuning - #112
Conversation
SCool62
left a comment
There was a problem hiding this comment.
Generally good. I left some specific comments. Also, if you could go through and polish a little (like put capitals at the start of sentences etc.) that would be good.
|
|
||
| ## Feedforward constants: | ||
|
|
||
| kS is static friction. kS represents the amount of motor output required to overcome static friction and get the mechanism to move. |
There was a problem hiding this comment.
Same for all of these: maybe reword this to "kS is the static friction feedforward gain" or something to make it more clear what exactly the number refers to (like its not referring to the actual force of friction on the mechanism)
| - if kP is too low the mechanism responds slowly and can't keep up with the target accurately | ||
| - if kP is too high the mechanism may overshoot, oscillate, or become unstable | ||
|
|
||
| kI is based on the accumulated error over time. An integral is the area under a curve or in our case the error accumulated over time so if error gradually builds up in our system I can help with that. |
There was a problem hiding this comment.
I would make the connection between kI, integrals, and accumulated error over time more clear.
|
|
||
| kD is based on how quickly the error is changing, it is looking at the rate of change of the error or how quickly it's approaching the target. | ||
| - low kD can make the mechanism overshoot or oscillate. | ||
| - high kD can make the mechanism too slow to react or react excessively. |
There was a problem hiding this comment.
Maybe this is what you mean by "react excessively" but the most common symptom of high kD is very rapid, almost spasm-like oscillations when near the setpoint
|
|
||
| Understanding these things conceptually is the first step, but now we will include a guide on tuning for practical use. In general, you should not tune everything at once. A solid approach is making feedforward reasonably accurate, then using feedback to reduce the rest of the error. The process and constants you will need depends on the mechanism because they all have different physics. The procedure can depend on the motor controller, control mode, and mechanism. For example, it's important to distinguish between velocity and position control. If you're tuning a roller to maintain a certain RPM then you're dealing with velocity. However, if you're dealing with an elevator that needs to move to particular heights that's position control. | ||
|
|
||
| In general, the order for tuning is: kS, kV, kA, kG, kP, kD, kI (note: not all may be needed) |
There was a problem hiding this comment.
We usually tune kG right after/along with kS
|
|
||
| In general, the order for tuning is: kS, kV, kA, kG, kP, kD, kI (note: not all may be needed) | ||
|
|
||
| ### Elevator tuning: |
There was a problem hiding this comment.
Add kG tuning here. Usually, when tuning manually, I measure the voltage required to start moving up, representing (kS+kG), then the voltage required to start moving down (kS-kG). Then solve the system to get the correct gains
| - kI may not be necessarily but if there's consistently small position error it may help. | ||
|
|
||
| ### Arm tuning: | ||
| similar to elevator processes with kS, kV, kA if necessary, kG(when arm is horizontal), kP, kD, and kI is necessary |
There was a problem hiding this comment.
i think this should say "kI if necessary"
There was a problem hiding this comment.
Also once again kG should be tuned either along with kS or before it
| similar to elevator processes with kS, kV, kA if necessary, kG(when arm is horizontal), kP, kD, and kI is necessary | ||
|
|
||
| ### roller tuning: | ||
| typical rollers only need kS, kV, kA, kP, and kD |
There was a problem hiding this comment.
Maybe note that kP and kD are usually very small (like on the order of 0.1 kP and 0.01 kD) if the feedforward has been properly tuned
| typical rollers only need kS, kV, kA, kP, and kD | ||
|
|
||
| ## Additional tips: | ||
| - using tools such as SysID (see sysId article) rather than this process can give you kS, kV, and kA |
|
|
||
| ## Additional tips: | ||
| - using tools such as SysID (see sysId article) rather than this process can give you kS, kV, and kA | ||
| - your tuning process and gains need to make sense for the control system your using whether that position, velocity, voltage, etc |
There was a problem hiding this comment.
I would edit this sentence to be more clear. Also, you shouldn't need gains for voltage. I would also add that if you're planning to motion-profile a mechanism its PID should be tuned with a motion profile
| kI is based on the accumulated error over time. An integral is the area under a curve or in our case the error accumulated over time so if error gradually builds up in our system I can help with that. | ||
| - kI is often not needed and will be set to 0 or a very small value in most cases. This is because kP and kD are often good enough. If kI is too high it can cause overshooting. | ||
|
|
||
| kD is based on how quickly the error is changing, it is looking at the rate of change of the error or how quickly it's approaching the target. |
There was a problem hiding this comment.
This should be 2 sentences
|
Oh also, why are there a ton of files from kitbot stuff on here? |
lowkey not that well written but I think it covers some useful tips.