LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
QAngularSpeed.hpp
Go to the documentation of this file.
1/*
2 * This code is a modified version of Benjamin Jurke's work in 2015. You can read his blog post
3 * here:
4 * https://benjaminjurke.com/content/articles/2015/compile-time-numerical-unit-dimension-checking/
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 */
10#pragma once
11
16
17namespace okapi {
18QUANTITY_TYPE(0, 0, -1, 1, QAngularSpeed)
19
20constexpr QAngularSpeed radps = radian / second;
21constexpr QAngularSpeed rpm = (360 * degree) / minute;
22constexpr QAngularSpeed cps = (0.01 * degree) / second; // centidegree per second
23
24#pragma GCC diagnostic push
25#pragma GCC diagnostic ignored "-Wunused-function"
26static QAngularSpeed convertHertzToRadPerSec(QFrequency in) {
27 return (in.convert(Hz) / 2_pi) * radps;
28}
29#pragma GCC diagnostic pop
30
31inline namespace literals {
32constexpr QAngularSpeed operator"" _rpm(long double x) {
33 return x * rpm;
34}
35constexpr QAngularSpeed operator"" _rpm(unsigned long long int x) {
36 return static_cast<double>(x) * rpm;
37}
38} // namespace literals
39} // namespace okapi
#define QUANTITY_TYPE(_Mdim, _Ldim, _Tdim, _Adim, name)
Definition RQuantity.hpp:84
static QAngularSpeed convertHertzToRadPerSec(QFrequency in)
constexpr QFrequency Hz(1.0)
constexpr QAngularSpeed rpm
constexpr QAngle radian(1.0)
constexpr QAngle degree
Definition QAngle.hpp:19
constexpr QAngularSpeed cps
@ x
Roll Axis.
constexpr QTime minute
Definition QTime.hpp:19
constexpr QTime second(1.0)
constexpr QAngularSpeed radps