2.6 KiB
2.6 KiB
Handoff: Classical-Control Overtaking Implementation
Context & Goal
We implemented a classical, heuristic-only overtaking state machine for the robot. This feature runs alongside the experimental residual-RL model and executes overtakes by dynamically adjusting the lateral setpoint (dist_ref_cur) of the existing PD wall-follower.
Files Modified
RTOS_SensorBoard/RTOS_SensorBoard.c
Key Implementations
- Overtaking State Machine (
overtake_state_t):- States:
S_FOLLOW,S_DETECT,S_COMMIT,S_PASS,S_REJOIN. - Modulates
dist_ref_curto smoothly shift the robot out of line and past an opponent without needing a new low-level controller.
- States:
- Dynamic Object Classifier:
- Uses an ego-motion-compensated range-rate classifier to differentiate between static walls (which approach at ego speed) and moving cars.
- Calculates a residual (
r = front_filt - front_pred) and accumulates it (r_acc).
- Model Gating:
Model_ApplyResidual(&throttle_l, &throttle_r, &steeringAngle)is now strictly gated to only apply whenot_state == S_FOLLOW. It won't interfere with the passing logic.
- Logging (
FileDumpRow):- Increased
NUMCOLSto 14. - Now logs
ot_stateanddist_ref_curalongside standard telemetry for post-run analysis.
- Increased
- Calibration Function (
RobotCalib):- Added a dedicated routine to calibrate the throttle-to-velocity mapping (
V_MAX_MMPS). - Drives perfectly straight (
steeringAngle = 3100;) atCALIB_THROTTLE. - Calculates
-d(front)/dtover the period where50 <= front <= 1000(after a 500ms startup delay) and outputs the average velocity to the ST7735 display.
- Added a dedicated routine to calibrate the throttle-to-velocity mapping (
Current Status
- The code is fully integrated into
RTOS_SensorBoard.cbut requires empirical testing and tuning.
Next Steps for the Next Agent/User
- Run
RobotCalib(): Hook upRobotCalibtoS2Push()or run it directly. Let the robot drive at a wall/target and observe the reported "Avg Vel". - Update Parameters: Use the calibration result to update
V_MAX_MMPS(currently2000as a placeholder) at the top ofRTOS_SensorBoard.c. - Bench Testing: Verify the state machine logic transitions correctly when waiving an obstacle in front of the sensors.
- Solo On-Track Tuning: Drive the robot alone on the track. If the classifier fires (transitions to
DETECTorCOMMIT) on apexes/corners, tuneR_YAW_GAIN_Q8andR_THRESH_BASEuntil the false positives disappear. - Opponent Testing: Test passing on straights using stationary and moving opponents. Watch for edge/corner cases or premature rejoins (
T_PASS_MIN,T_CLEAR_MS).