Create PoseRecorder.java#78
Conversation
By Metal Magic FTC 23362 We added a TeleOp for authoring field coordinates by moving the robot instead of measuring the field by hand. Set a starting pose in code, then drag or drive the robot around the field and press a button to capture the robot's current pose. Captures accumulate in a numbered, copy-pasteable list on the Driver Station and stream to the coding computer via adb logcat, so they drop straight into path code.
|
This looks a lot better! The final suggestion I have is moving away from logcat for storing the poses. What if instead of writing each of the captured poses to the log when the are recorded, you have a button to save all of them to a file? You could have a PATH variable that defaults to something sensible (maybe OnBot java so it can be accessed by less advanced teams?) which can then be edited to put he logs wherever. I think that would make it more approachable for teams that don't have much experience with logcat. |
Changed saving from logcat to: Buttons are now: A capture, B undo, X save, Back+Y clear. Retrieving the file (documented in the class Javadoc): Android Studio teams: adb pull /sdcard/FIRST/pose_recorder.txt OnBot Java / no adb: plug the Control Hub or RC phone into the computer over USB and browse to the FIRST folder (the exact on-robot path is shown live in telemetry).
|
Thanks again for the feedback. I updated it so: Buttons are now: A capture, B undo, X save, Back+Y clear. Retrieving the file (documented in the class Javadoc):
I couldn't think of a better way to do this, so lmk if you have any other suggestions. |
By Metal Magic FTC 23362
We added a TeleOp for authoring field coordinates by moving the robot instead of measuring the field by hand. Set a starting pose in code, then drag or drive the robot around the field and press a button to capture the robot's current pose. Captures show up in a numbered, copy-pasteable list on the Driver Station, and a save button writes the whole list to a text file on the Robot Controller so they drop straight into path code.
It's one concrete OpMode in org.firstinspires.ftc.teamcode.pedroPathing, alongside the existing Tuning OpModes. PoseRecorder is a self-contained @TELEOP. All gamepad reading and telemetry rendering live directly in the OpMode, and button rising-edges use the FTC SDK's built-in gamepad1.aWasPressed() / bWasPressed() / xWasPressed() / yWasPressed() detection. Each loop it drives via follower.setTeleOpDrive(...) so the robot can be driven or hand-dragged, captures follower.getPose(), and renders the live pose plus the recorded list. Pressing X writes every captured pose to a file using the SDK's ReadWriteFile, so teams don't need logcat. Teams edit two things in the class: the startingPose field and the Constants.createFollower(hardwareMap) line, plus an optional OUTPUT_PATH.
The save file defaults to the FTC FIRST folder (/sdcard/FIRST/pose_recorder.txt), which every Control Hub and RC phone already has. OUTPUT_PATH can be edited to put the file anywhere the app can write. Telemetry shows the current save path and a save status line, so you get confirmation right on the Driver Station.
Poses are captured in the follower's native Pedro coordinate frame. Compiles against the existing SDK and Pedro com.pedropathing:ftc:2.1.2 dependencies, no build changes. @Utility isn't available in this repo's dependencies (checked RobotCore 11.1.0 and the full fullpanels:1.0.12 tree), so this uses @TELEOP.
To use, just edit the two lines in the class:
on the gamepad:
then get the file onto your computer:
the file holds lines you can copypaste like new Pose(12.00, 34.00, Math.toRadians(90.00)).