-
Notifications
You must be signed in to change notification settings - Fork 663
[wpiunits] Add Whimsical Units #7969
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
base: main
Are you sure you want to change the base?
[wpiunits] Add Whimsical Units #7969
Conversation
The c++ units library is imported from https://github.com/nholthaus/units. Additionally, each unit type has its own header, and unit types aren't globally accessible in Intellisense. |
Yeah. Our goal is not to match the c++ impl, because we didn’t write that, it was imported. We should only be adding units to Java we actually use. |
Additionally, we will in all probability drop some of the units in C++ when we switch to a different units library (mp-units) for 2027. |
I'm in favor of using whimsical types. Since FRC is mostly North American, it would be nice to include units like miles, if only to display robot speed in MPH, for example. |
Idk about you but i would love to have a virtual speedometer on my Dashboard showing my speed for the fun of it. Leagues would have been a great on-theme measurement for this year. For any horse racing or city-planning sponsors furlongs is directly relatable! I think by not merging this you're just making it that much harder to inspire and let programmers have fun while competing especially since FTC (middle-high schoolers) will see this and get thinking. Additionally pollution for Units isn't a bad thing! The more Units we have the better! |
Well for starters, something is wrong with this PR, because it says no files changed. So until it is actually fixed, we cannot review this. |
Thats what happens when you have to open PR's from your phone bc you don't have a full busybox terminal setup yet to use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I foresee the average FRC team using almost none of these.
Aren't there many features few teams use anyways like meccanum drive classes? 💩 |
For the record, Kiwi/Killough drive classes were removed because no one used them. Mecanum could be removed if usage continues to drop, but I doubt that will happen as FTC starts to use WPILib. Also, adding "useless" features because there's other features that have low use isn't really a good justification. Basically all of the features in wpimath, for example, have valid use cases, with maybe simulated annealing being one that would be the hardest to find a use case for. But otherwise, the various controllers, filters, kinematics, trajectory library, etc do have use cases. Units like Leagues and Cubits however, don't really have any use case at all. So there's not really a good reason to add arachic units like those. I'm not opposed to adding units like Miles or Hours though. Those do have use cases, the most common likely being calculating robot velocity in miles per hour. Also, keep in mind that even if whimsical units do inspire some students, you'd also annoy other students who use Intellisense and get annoyed that their suggestions are cluttered with units they wouldn't use. I'd probably be one of those annoyed students (I know, I'm no fun.) |
Speaking of which we may want to reconsider those classes since those drives are still used in FTC? |
To my knowledge (since I'm not a WPILib maintainer), Mecanum is not under consideration for removal. |
Intellisense works just fine even with these showing up and shows the package if you have it set to. You can also choose to import it like By this logic typing I think you're overreacting and that its something that already has precedent. It's not something many people notice or care about (and considering it at this scope seems more pedantic than necessary). In my opinion there are more students that care the names aren't duplicated across wpilib and common libraries in intelisense so they can auto-import with intellisense nicely. |
|
Why? I usually use Why would you bother scrolling through all of them? |
Agreed that adding new constants has a cost. In general, a larger API surface can make it harder to understand an API. Suggestion: Instead of adding more constants to Doing this would provide a path for teams that want to add the robot's speed in MPH to a dashboard, and could allow some students to see how extensible APIs allow people to do fun things with the code that the maintainers might not have expected. |
There's documentation for defining a custom unit here: https://docs.wpilib.org/en/stable/docs/software/basic-programming/java-units.html#defining-new-units but nothing in the javadocs that I could find quickly. |
Good to know. If someone added some example code in those docs(furlongs per fortnight, perhaps) we could add a link to there from the |
In addition to adding useful Imperial units like Miles. Useful missing time units like Hours, which is used to create RELATABLE UNITS!
Whimsical Units inspire creativity in students and let them think out of the box. Nothing in this PR is unprecedented because it is already in the C++ impl.
Discuss!