-
Notifications
You must be signed in to change notification settings - Fork 22
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
[Question] Converting from linear to angular velocity #368
Comments
I suppose I can fake getting the dimensionless units out of it by also multiplying by 1 second but it still feels like it's outside of the spirit of unit safety: const auto angular_velocity = (au::radians / au::seconds)(speed / radius * au::seconds(1.0)); |
Indeed it is! We can rule this approach out pretty quickly. The right approach turns out to be simple, but it needs a little motivation. The root cause of all this weirdness is that conventional equations are based on a kind of "natural units" system, but for angles. In case you're not familiar with "natural units", one example is that high energy physicists like to choose units where constants like With angles, we tend to choose units where a specific angle-dimensioned constant --- the "Cotes angle", or, simply, the "radian" --- has a numeric value of Going from a natural-units equation to a "complete" equation is hard in general, because you're trying to reverse a lossy step. But the reward is worth it: you get an equation that is valid for any choice of angular units! In this case, we can check out Table 1 of Quincey (2021), the best freely available paper outlining a proposal to fix the SI (Leonard (2021) is similarly excellent but is not freely available). We find the following excerpt:
Since TEST(UnitsTest, MetersPerSecondToRadsPerSecond) {
using au::symbols::rad;
//^^^^^^^^^^^^^^^^^^^^^
const auto speed = (au::meters / au::seconds)(100.0);
const auto radius = au::meters(10.0);
const auto angular_velocity = speed * rad / radius;
// ^^^^^^
EXPECT_DOUBLE_EQ(angular_velocity.in(au::radians / au::seconds), 10.0);
} That should work! P.S. When reading a conventional equation, I like to mentally append what I have taken to calling the "Quincey disclaimer", (from that same paper) to the equation:
This helps me make sense of the equation, and reminds me to be aware of its preconditions. |
Oh! And I forgot to mention #87. We are on the hook for providing thorough documentation for how to deal with dimensioned angles in a world that overwhelmingly pretends they are dimensionless --- including (as mentioned there) a "how-to" page that will give you tables of "familiar" and "complete" equations, so that it will become perfectly clear where to "stick the No firm commitments, but I hope/expect to be able to address this in 2025, some time after Aurora's first product launches. |
I'm looking at converting a linear
m/s
to angularrad/s
when I know the radius of the rotating item but I'm stuck at trying to get the result of the division ofm/s / m
which, if you just consider unit labels, ends up being1/s
. With a contrived googletest example:I get the expected error that the conversion can't take place because the types aren't the same dimension:
Is there an explicit way to do that conversion that I'm missing?
The text was updated successfully, but these errors were encountered: