Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wpical] Refactor to use WPILib libraries, modern C++ conventions, and LGPL libraries #7796

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

Gold856
Copy link
Contributor

@Gold856 Gold856 commented Feb 17, 2025

wpical was unable to use wpimath and its dependent libraries because Ceres was compiled with a different version of Eigen. Now that the Ceres build has been redone, we can now use wpimath and our C++ apriltag wrapper in wpical, allowing for major refactors. This includes:

  • Using to_json and from_json specializations to concisely serialize and deserialize all JSON files instead of manually handling JSON.
  • Removal of the Fieldmap and Pose classes, which was were duplicates of the AprilTagFieldLayout and Pose3d classes respectively.
  • Using AprilTagDetector instead of the raw libapriltag library.
  • Using Pose3d instead of raw Eigen matrices.

In addition, several other refactors were made to make the code more readable and to fix several UX issues and crashes. This includes:

  • Eagerly parsing every JSON file when selected by the user. This means JSON files are only parsed once on selection, instead of every time a downstream function wants to use the data. This also means invalid JSON can be detected upfront and a specific error shown immediately instead of a catch all error when trying to calibrate.
  • Using std::optional to indicate a calibration failed instead of status codes.
  • Breaking up the massive DisplayGui function into separate functions which contain code for different popups. This also allowed for better organization and scoping of static variables.
  • Renaming variables to make their purpose more clear.

Fixes #7722.

@Gold856 Gold856 requested a review from a team as a code owner February 17, 2025 02:58
@Gold856
Copy link
Contributor Author

Gold856 commented Feb 17, 2025

This currently depends on wpilibsuite/thirdparty-ceres#10 being merged.

@Gold856 Gold856 force-pushed the wpical-clean-up branch 6 times, most recently from 1a821a1 to ee48cfe Compare February 19, 2025 07:53
@Gold856 Gold856 marked this pull request as draft February 21, 2025 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wpical output question
2 participants