Tuning Motion Magic PID
Follow these steps to tune the Motion Magic PID for your robot:
Prerequisites
- Ensure you are connected to the robot via its Wi-Fi.
- Open the
constants.py
file to adjust the PID constants.
Steps
-
Set Initial PID Constants
Set all PID constants (kP
,kI
,kD
,kF
, etc.) to0
inconstants.py
. -
Tune
kS
(Static Gain)- Gradually increase the
kS
value. - Deploy the code after each adjustment.
- Stop increasing
kS
once the mechanism begins to move slightly.Note: Keep this value as low as possible while ensuring the mechanism moves.
- Gradually increase the
-
Tune
kG
(Gravity Compensation)- Set a setpoint for the mechanism.
- Gently raise the mechanism to the setpoint and release it while the robot is enabled.
- If the mechanism does not hold its position, incrementally increase the
kG
value. - Deploy the code after each adjustment.
- Stop increasing
kG
once the mechanism holds its position without drifting.
-
Tune
kP
(Proportional Gain)- Gradually increase the
kP
value. - Deploy the code after each adjustment.
- Stop increasing
kP
once the mechanism begins to overshoot the setpoint. - Dial back
kP
slightly to achieve the highest value that does not cause overshooting.
- Gradually increase the
Additional Notes
- If you encounter issues with feedforward, you may need to revisit and refine your feedforward calculations.