23static constexpr double mmToInch = 0.0393700787;
78static constexpr double pi = 3.1415926535897932;
83static constexpr double pi2 = 1.5707963267948966;
122constexpr double ipow(
const double base,
const int expo) {
123 return (expo == 0) ? 1
125 : expo > 1 ? ((expo & 1) ? base *
ipow(base, expo - 1)
126 :
ipow(base, expo / 2) *
ipow(base, expo / 2))
127 : 1 /
ipow(base, -expo);
139constexpr double cutRange(
const double value,
const double min,
const double max) {
140 const double middle = max - ((max - min) / 2);
142 if (value > min && value < middle) {
144 }
else if (value <= max && value >= middle) {
160constexpr double deadband(
const double value,
const double min,
const double max) {
161 return std::clamp(value, min, max) == value ? 0 : value;
178 const double newMax) {
179 return (value - oldMin) * ((newMax - newMin) / (oldMax - oldMin)) + newMin;
189 return static_cast<std::underlying_type_t<E>
>(e);
210constexpr long modulus(
const long lhs,
const long rhs)
noexcept {
211 return ((lhs % rhs) + rhs) % rhs;
247 if (port >=
'a' && port <=
'h') {
248 return port - (
'a' - 1);
249 }
else if (port >=
'A' && port <=
'H') {
250 return port - (
'A' - 1);
gearset
Indicates the internal gear ratio of a motor.
@ blue
6:1, 600 RPM, Blue gear set
@ green
18:1, 200 RPM, Green gear set
@ red
36:1, 100 RPM, Red gear set
static constexpr auto OKAPI_PROS_ERR_F
Same as PROS_ERR_F.
static constexpr double pi2
The value of pi divided by 2.
static constexpr auto OKAPI_PROS_ERR
Same as PROS_ERR.
constexpr long modulus(const long lhs, const long rhs) noexcept
Computes lhs mod rhs using Euclidean division.
static constexpr double pi
The value of pi.
static constexpr double gravity
The conventional value of gravity of Earth.
static constexpr std::int32_t imev5RedTPR
The ticks per rotation of the V5 motor with a red gearset.
constexpr double deadband(const double value, const double min, const double max)
Deadbands a range of the number.
static constexpr double v5MotorMaxVoltage
The maximum voltage that can be sent to V5 motors.
constexpr auto toUnderlyingType(const E e) noexcept
Converts an enum to its value type.
static constexpr double inchToMM
Converts inches to millimeters.
static constexpr std::int32_t imev5GreenTPR
The ticks per rotation of the V5 motor with a green gearset.
static constexpr double ime269TPR
The ticks per rotation of the 269 IME.
static constexpr double degreeToRadian
Converts degrees to radians.
constexpr std::int32_t gearsetToTPR(const AbstractMotor::gearset igearset) noexcept
Converts a gearset to its TPR.
static constexpr double imeTorqueTPR
The ticks per rotation of the 393 IME with torque gearing.
constexpr auto boolToSign(const bool b) noexcept
Converts a bool to a sign.
static constexpr std::int32_t imev5BlueTPR
The ticks per rotation of the V5 motor with a blue gearset.
constexpr std::int8_t transformADIPort(const std::int8_t port)
Maps ADI port numbers/chars to numbers:
constexpr double cutRange(const double value, const double min, const double max)
Cuts out a range from the number.
static constexpr double radianToDegree
Converts radians to degrees.
constexpr double remapRange(const double value, const double oldMin, const double oldMax, const double newMin, const double newMax)
Remap a value in the range [oldMin, oldMax] to the range [newMin, newMax].
constexpr double ipow(const double base, const int expo)
Integer power function.
static constexpr std::int8_t adiUpdateRate
The polling frequency of the ADI ports in milliseconds.
static constexpr std::int32_t quadEncoderTPR
The ticks per rotation of the red quadrature encoders.
static constexpr std::int32_t imeSpeedTPR
The ticks per rotation of the 393 IME with speed gearing.
static constexpr std::int8_t motorUpdateRate
The polling frequency of V5 motors in milliseconds.
static constexpr double imeTurboTPR
The ticks per rotation of the 393 IME with turbo gearing.
static constexpr double mmToInch
Converts millimeters to inches.