Two Wheel + IMU autotuner - #95
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new tuner has correctness issues that can yield invalid calibration (division by zero/Infinity) and likely computes xPodOffset with the wrong sign.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new PedroPathing autotune Procedure to guide teams through configuring and calibrating a TwoWheelLocalizer + IMU setup (encoder scalars, encoder directions, and pod offsets), and outputs a ready-to-paste TwoWheelConfig snippet.
Changes:
- Introduces
TwoWheelTunerprocedure with interactive setup inputs (encoder names, IMU name, Hub orientation). - Adds tuning OpModes for forward/strafe encoder resolution, direction detection, and 180° spin-based offset identification.
- Emits
result(...)values and a generated Java config snippet for easy transfer into constants/config.
File summaries
| File | Description |
|---|---|
| TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/procedures/TwoWheelTuner.java | New two-wheel + IMU autotuning procedure and supporting tuning opmodes (resolution, direction, offsets). |
Review details
Suppressed comments (2)
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/procedures/TwoWheelTuner.java:225
- If the robot is not pushed (or the localizer fails to update), localizer.pose().y() can be 0, making this return Infinity/NaN and producing an invalid ticks-to-inches scalar.
return Math.abs(distance / localizer.pose().y());
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/procedures/TwoWheelTuner.java:362
- The xPodOffset sign here is inconsistent with the established 180°-turn offset calculation used elsewhere in the codebase (e.g., OffsetsTuner reports xPodOffset = (-pose.y)/2). As written, this will likely produce the wrong xPodOffset sign.
offsets = Arrays.asList(localizer.pose().y() / 2.0, -localizer.pose().x() / 2.0);
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Before issuing a pull request, please see the contributing page.