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

Add force and torque units to wpiunits #6676

Closed
wants to merge 10 commits into from

Conversation

narmstro2020
Copy link
Contributor

Add Newtons for force and NewtonMeters for torque to the units API.
Also added singular aliases

@narmstro2020 narmstro2020 requested a review from a team as a code owner May 28, 2024 18:17
@narmstro2020
Copy link
Contributor Author

/format

Copy link
Member

@SamCarlberg SamCarlberg left a comment

Choose a reason for hiding this comment

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

Naming can be improved.

Imperial units (pounds-force, foot-pounds, inch-pounds, etc) would also be helpful to include

wpiunits/src/main/java/edu/wpi/first/units/Units.java Outdated Show resolved Hide resolved
wpiunits/src/main/java/edu/wpi/first/units/Units.java Outdated Show resolved Hide resolved
@narmstro2020
Copy link
Contributor Author

Just out of curiosity.

Is it possible to setup some alias for LinearVelocity.
That way I don’t have to use Measure<Velocity> when I just want to say
Measure.

I’d like to jump down that rabbit hole but didn’t want to waste my time if it had already been attempted.

@narmstro2020
Copy link
Contributor Author

/format

@narmstro2020
Copy link
Contributor Author

/format

@narmstro2020
Copy link
Contributor Author

@SamCarlberg

Anything I should do with this one?

Copy link
Member

@SamCarlberg SamCarlberg left a comment

Choose a reason for hiding this comment

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

@narmstro2020 Nope, this PR looks good


/** A unit of force equivalent to 4.448222 {@link #Newtons}. */
public static final Mult<Mass, Velocity<Velocity<Distance>>> PoundsForce =
derive(Newtons).aggregate(4.448222).named("Pounds-Force").symbol("lb.").make();
Copy link
Member

Choose a reason for hiding this comment

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

Fun fact, the units work out such that using derive(Pounds.mult(Gs)) would accomplish the same thing while letting the library handle the unit conversions for you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So that leaves the big PR I worked on last week. I'm sure it will take some time to sift through if its got any merit.

@PeterJohnson
Copy link
Member

Superseded by #6958.

@narmstro2020 narmstro2020 deleted the Force-Torque-Units branch August 29, 2024 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants