Add interactive pose recorder for capturing field coordinates - #171
Add interactive pose recorder for capturing field coordinates#171aryanmathur1 wants to merge 1 commit into
Conversation
By Metal Magic FTC 23362 Adds a TeleOp workflow 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 RobotLog (adb logcat), so they drop straight into path code. Two new classes in com.pedropathing.ftc.util: - PoseRecorder: reusable helper taking (follower, gamepad, telemetry). Call update() each loop to detect button rising-edges, capture follower.getPose(), render the live pose + recorded list, and log each capture. Default buttons A/B/Back+Y for capture/undo/clear, all reconfigurable; exposes capture()/undo()/clear()/getRecordedPoses(). - PoseRecorderOpMode: turnkey abstract LinearOpMode. Teams implement createFollower(hardwareMap) and optionally override startingPose() to declare their start position in code. Enables gamepad teleop driving while leaving the robot free to be hand-dragged. Poses are captured in the follower's native Pedro coordinate frame. Compiles against the existing compileOnly FTC SDK; no build changes.
|
Hello! This is a really cool idea but I think it would make more sense to implement this in the quickstart instead of at the library level. Everything involving the Gamepad and telemetry should be moved from the PoseRecorder to the OpMode and the OpMode should be made concrete (since the user can just edit the start position and or creation method). Also, if you move the gamepad logic to the OpMode you can use the built in rising edge detection on Gamepad instead of a custom Button interface. Maybe consider make it an @Utility class (The one in the new SDK update) |
|
Yeah sure that is a great suggestion! I created the new file and made a pull request to implement it in the quickstart. It is now just in one OpMode rather than a helper class. The @Utility class did not work properly for me (probably because of SDK issues), so I made it an @TeleoOp instead |
By Metal Magic FTC 23362
We added a TeleOp workflow 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 robots 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.
Two new classes in com.pedropathing.ftc.util:
Poses are captured in the follower's native Pedro coordinate frame. Compiles against the existing compileOnly FTC SDK. No build changes.
an example of code (woa i figured out markdown):
on gamepad then:
A to capture current pose
B to undo last
Back + Y to clear all
Then, on computer, check logcat to get lines u can copy paste like "new Pose(12.000, 34.000, Math.toRadians(90.00))"