LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
QMass.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
12
#include "
okapi/api/units/RQuantity.hpp
"
13
14
namespace
okapi
{
15
QUANTITY_TYPE
(1, 0, 0, 0, QMass)
16
17
constexpr QMass
kg
(1.0);
// SI base unit
18
constexpr QMass
gramme
= 0.001 *
kg
;
19
constexpr QMass
tonne
= 1000 *
kg
;
20
constexpr QMass
ounce
= 0.028349523125 *
kg
;
21
constexpr QMass
pound
= 16 *
ounce
;
22
constexpr QMass
stone
= 14 *
pound
;
23
24
inline namespace literals {
25
constexpr
QMass
operator
""
_kg(
long
double
x
) {
26
return
QMass(
x
);
27
}
28
constexpr
QMass
operator
""
_g(
long
double
x
) {
29
return
static_cast<
double
>
(
x
) *
gramme
;
30
}
31
constexpr
QMass
operator
""
_t(
long
double
x
) {
32
return
static_cast<
double
>
(
x
) *
tonne
;
33
}
34
constexpr
QMass
operator
""
_oz(
long
double
x
) {
35
return
static_cast<
double
>
(
x
) *
ounce
;
36
}
37
constexpr
QMass
operator
""
_lb(
long
double
x
) {
38
return
static_cast<
double
>
(
x
) *
pound
;
39
}
40
constexpr
QMass
operator
""
_st(
long
double
x
) {
41
return
static_cast<
double
>
(
x
) *
stone
;
42
}
43
constexpr
QMass
operator
""
_kg(
unsigned
long
long
int
x
) {
44
return
QMass(
static_cast<
double
>
(
x
));
45
}
46
constexpr
QMass
operator
""
_g(
unsigned
long
long
int
x
) {
47
return
static_cast<
double
>
(
x
) *
gramme
;
48
}
49
constexpr
QMass
operator
""
_t(
unsigned
long
long
int
x
) {
50
return
static_cast<
double
>
(
x
) *
tonne
;
51
}
52
constexpr
QMass
operator
""
_oz(
unsigned
long
long
int
x
) {
53
return
static_cast<
double
>
(
x
) *
ounce
;
54
}
55
constexpr
QMass
operator
""
_lb(
unsigned
long
long
int
x
) {
56
return
static_cast<
double
>
(
x
) *
pound
;
57
}
58
constexpr
QMass
operator
""
_st(
unsigned
long
long
int
x
) {
59
return
static_cast<
double
>
(
x
) *
stone
;
60
}
61
}
// namespace literals
62
}
// namespace okapi
RQuantity.hpp
QUANTITY_TYPE
#define QUANTITY_TYPE(_Mdim, _Ldim, _Tdim, _Adim, name)
Definition
RQuantity.hpp:84
okapi
Definition
chassisController.hpp:16
okapi::tonne
constexpr QMass tonne
Definition
QMass.hpp:19
okapi::stone
constexpr QMass stone
Definition
QMass.hpp:22
okapi::pound
constexpr QMass pound
Definition
QMass.hpp:21
okapi::gramme
constexpr QMass gramme
Definition
QMass.hpp:18
okapi::ounce
constexpr QMass ounce
Definition
QMass.hpp:20
okapi::IMUAxes::x
@ x
Roll Axis.
okapi::kg
constexpr QMass kg(1.0)
include
okapi
api
units
QMass.hpp
Generated by
1.9.8