constants module¶
constants.py
Hardware pin assignments, physical parameters, control gains, and file-path constants shared across all tasks in the Romi robot project.
Pin constants are defined only when running on the STM32 target (pyb available); they are skipped silently on desktop/CPython.
- constants.CSV_BEGIN = '>>>>CSV START<<<<'¶
Sentinel string printed before CSV data begins over serial.
- constants.CSV_END = '>>>>CSV END<<<<'¶
Sentinel string printed after CSV data ends over serial.
- constants.DEFAULT_LF_KFF = 0.5¶
Default feed-forward gain for the line-follow controller.
- constants.DEFAULT_LF_KI = 0.3¶
Default integral gain for the line-follow PI controller.
- constants.DEFAULT_LF_KP = 0.4¶
Default proportional gain for the line-follow PI controller.
- constants.DEFAULT_MOTOR_KI = 4.0¶
Default integral gain for motor velocity PI controllers.
- constants.DEFAULT_MOTOR_KP = 0.15¶
Default proportional gain for motor velocity PI controllers.
- constants.ECOUNTS_PER_WREV = 1437.12¶
Number of encoder counts per full wheel revolution (quadrature, Romi gearbox).
- constants.ENCODER_GAIN = 153.02235425851705¶
Encoder linear gain: converts encoder counts to millimeters of wheel travel. Derived as
2 * pi * WHEEL_RADIUS / ECOUNTS_PER_WREV(mm/count).
- constants.GAINS_FILE = 'gains.json'¶
Filename for the JSON file storing PI controller gains on the MCU filesystem.
- constants.IMU_FILE = 'imu.json'¶
Filename for the JSON file storing BNO055 IMU calibration offsets and tare values.
- constants.MOTOR_CONST = 0.03¶
Motor speed constant in RPM/V (from Pololu specifications, 150 RPM at 4.5 V).
- constants.MOTOR_GAIN = 0.8185111358985167¶
Motor linear gain: converts motor voltage (V) to wheel linear velocity (mm/s). Derived as
MOTOR_CONST * 60 / (2 * pi * WHEEL_RADIUS) * 100.
- constants.PI = 3.1415926536¶
Pi to 10 significant figures.
- constants.WHEEL_RADIUS = 35¶
Wheel radius in millimeters.