ui.ui_gains module¶
Controller gain tuning wizard for the Romi robot UI.
Steps the user through adjusting five control parameters via the serial
terminal, then persists all gains to GAINS_FILE so they survive a
power cycle. Uses multichar_input for non-blocking numeric entry.
- Parameters tuned (in order):
Motor Kp – proportional gain (must be > 0; same value applied to both motors)
Motor Ki – integral gain (must be ≥ 0)
LF Kp – line-follower proportional gain (must be ≥ 0)
LF Ki – line-follower integral gain (must be ≥ 0)
LF Kff – line-follower feed-forward gain (must be ≥ 0)
- ui.ui_gains.run(ui)[source]¶
Generator that runs the interactive gain-tuning wizard.
For each gain the function displays the current value, prompts for a new one, validates the range, and either updates the shared variable or reports why the entry was rejected. A summary table is printed at the end and all gains are saved to disk.
Uses
yield from multichar_input(ui._ser)so the scheduler remains responsive while waiting for the user to type a value.- Args:
- ui: UI context object exposing
_ser,_leftMotorKp, _rightMotorKp,_leftMotorKi,_rightMotorKi,_lineFollowKp,_lineFollowKi,_lineFollowKffshares/queues, and a_save_gains()method.
- ui: UI context object exposing
- Yields:
Delegates to
multichar_inputwhich yields on every serial poll.