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

[wpimath] Remove unit suffixes from variable and function names #7529

Open
wants to merge 1 commit into
base: 2027
Choose a base branch
from

Conversation

calcmogul
Copy link
Member

  • Move units into API docs instead because suffixes make user code verbose and hard to read
  • Rename trackWidth to trackwidth
  • Make ultrasonic classes use meters instead of a mix of m, cm, mm, ft, and inches

@calcmogul calcmogul requested review from a team as code owners December 9, 2024 00:19
Copy link
Contributor

github-actions bot commented Dec 9, 2024

This PR modifies commands. Please open a corresponding PR in Python Commands and include a link to this PR.

@github-actions github-actions bot added component: cscore CameraServer library component: wpilibj WPILib Java component: wpilibc WPILib C++ component: hal Hardware Abstraction Layer component: command-based WPILib Command Based Library component: wpimath Math library component: examples component: sysid SysId app 2027 2027 target labels Dec 9, 2024
@calcmogul calcmogul force-pushed the wpimath-remove-unit-suffixes-from-variable-names branch 4 times, most recently from 6046a8f to 5326e0f Compare December 9, 2024 00:45
Copy link
Contributor

@KangarooKoala KangarooKoala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love to see how much cleaner wpimath is now! However, I noticed that some overloads that use the Java units system got the units added to their doc comments. (e.g., new ChassisSpeeds(LinearVelocity, LinearVelocity, AngularVelocity), DifferentialDriveOdometry.resetPosition(Rotation2d, Distance, Distance, Pose2d), and many others). Are the doc comments necessary? Functions in C++, which all use the units system, don't include the units in the doc comments.

Also, just so we don't forget to include this in the change notes, this changes the DifferentialDriveKinematics schema.

@calcmogul calcmogul changed the title [wpimath] Remove unit suffixes from variable names [wpimath] Remove unit suffixes from variable and function names Dec 10, 2024
Copy link
Contributor

@KangarooKoala KangarooKoala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The differential drive odometry and pose estimators still have changed @param comments for units parameters.

@calcmogul calcmogul force-pushed the wpimath-remove-unit-suffixes-from-variable-names branch 6 times, most recently from 313181f to 6fc2306 Compare December 16, 2024 01:47
Copy link
Contributor

@KangarooKoala KangarooKoala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, for what it's worth. I'll just note that merging this would mean every time we merge main back into 2027, any changes to wpimath will need to fix the merge conflicts. (The changes should be fairly trivial, though)

@calcmogul calcmogul force-pushed the wpimath-remove-unit-suffixes-from-variable-names branch from 6fc2306 to b26396d Compare December 20, 2024 02:55
@calcmogul calcmogul force-pushed the wpimath-remove-unit-suffixes-from-variable-names branch from b26396d to 6059f81 Compare December 20, 2024 03:41
@calcmogul calcmogul requested a review from a team as a code owner December 20, 2024 03:41
@calcmogul calcmogul force-pushed the wpimath-remove-unit-suffixes-from-variable-names branch 3 times, most recently from f9a42c8 to 0015370 Compare December 20, 2024 19:02
* Move units into API docs instead because suffixes make user code verbose and hard to read
* Rename trackWidth to trackwidth
* Make ultrasonic classes use meters instead of a mix of m, cm, mm, ft,
  and inches
@calcmogul calcmogul force-pushed the wpimath-remove-unit-suffixes-from-variable-names branch from 0015370 to 77187ec Compare December 22, 2024 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2027 2027 target component: command-based WPILib Command Based Library component: cscore CameraServer library component: examples component: hal Hardware Abstraction Layer component: sysid SysId app component: wpilibc WPILib C++ component: wpilibj WPILib Java component: wpimath Math library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants