Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughChangesReplay recording and playback
Estimated code review effort: 5 (Critical) | ~90+ minutes Sequence Diagram(s)sequenceDiagram
participant DataRecordingOp3
participant Robot
participant CSVFile
participant ReplayAutoOp3
DataRecordingOp3->>Robot: control robot and read state
DataRecordingOp3->>CSVFile: write recorded frame
ReplayAutoOp3->>CSVFile: load recorded frames
ReplayAutoOp3->>Robot: apply interpolated drive and mechanism outputs
Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This pull request updates the KronBot FTC codebase to support TeleOp recording and Autonomous replay (“Replay V3”), alongside minor cleanup and a flap calibration tweak.
Changes:
- Adjust flap open servo constant for mechanism calibration.
- Add TeleOp opmodes to record drive + mechanism data to CSV (V2 power-based, V3 velocity-based).
- Add autonomous opmodes to replay recorded CSV data with improved control logic.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/utils/Constants.java | Adjusts flap open position constant. |
| TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/Robot.java | Removes a large commented-out turret-alignment block. |
| TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/manual/MainDrivingOp.java | Removes dead/commented alignment code and extra whitespace. |
| TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/manual/DataRecordingOp3.java | Adds a TeleOp “Data Recorder V3” that records pose + mechanism velocities to CSV. |
| TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/manual/DataRecordingOp2.java | Adds a TeleOp “Data Recorder” that records pose + mechanism powers to CSV. |
| TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/autonomous/ReplayAutoOp3.java | Adds an autonomous replay opmode for the V3 CSV format with interpolation/PD improvements. |
| TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/autonomous/OldReplayOp2.java | Adds an older replay implementation for the V2 CSV format. |
| TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/autonomous/Auto_BackBlueOp.java | Removes an inline comment in an autonomous state machine. |
Suppressed comments (2)
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/manual/DataRecordingOp3.java:245
- If the FileWriter fails to initialize, dataRecorder remains null, but the loop still calls recordData(), which will throw a NullPointerException when writing. Guard recording when the recorder isn't initialized.
// Record Data (Fix #5: uses same ElapsedTime as replay for consistent timestamps)
if (now - lastRecordTime >= RECORD_INTERVAL_SEC) {
try {
recordData(now);
} catch (IOException e) {
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/kronbot/manual/DataRecordingOp2.java:282
- Telemetry label says "angle servo pos" but this prints the turret servo position, which is misleading during tuning/debugging.
telemetry.addData("shooter motor vel:", robot.leftOuttake.getVelocity());
telemetry.addData("angle servo pos:", robot.turretServo.getPosition());
telemetry.addData("turret angle:", robot.turret.angle);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @Autonomous(name = "Replay Auto V3", group = "Autonomous") | ||
| public class ReplayAutoOp3 extends LinearOpMode { | ||
|
|
||
| private static final String CSV_PATH = "/sdcard/robot_data.csv"; |
| // Record Data | ||
| if (now - lastRecordTime >= RECORD_INTERVAL_MS) { | ||
| try { | ||
| recordData(); | ||
| } catch (IOException e) { | ||
| telemetry.addData("Recording Error", e.getMessage()); | ||
| } | ||
| lastRecordTime = now; | ||
| } |
| telemetry.addData("Drive Powers", "LF:%.2f RF:%.2f LR:%.2f RR:%.2f", | ||
| leftFront.getPower(), rightFront.getPower(), leftRear.getPower(), rightRear.getPower()); | ||
| telemetry.addData("shooter motor vel:", robot.leftOuttake.getVelocity()); | ||
| telemetry.addData("angle servo pos:", robot.turretServo.getPosition()); |
| * Records drive motor powers (for feedforward replay) and mechanism velocities | ||
| * (for faithful shooter reproduction). | ||
| * | ||
| * CSV columns (17 total): |
Before issuing a pull request, please see the contributing page.
Summary by CodeRabbit