okapi namespace

Namespaces

namespace literals

Classes

class AbstractButton
class AbstractMotor
class AbstractRate
class AbstractTimer
class ADIButton
class ADIEncoder
class ADIGyro
class ADIMotor
class ADIUltrasonic
template<typename Input, typename Output>
class AsyncController
Closed-loop controller that steps on its own in another thread and automatically writes to the output.
class AsyncLinearMotionProfileController
class AsyncMotionProfileController
class AsyncMotionProfileControllerBuilder
class AsyncPosControllerBuilder
class AsyncPosIntegratedController
Closed-loop controller that uses the V5 motor's onboard control to move.
template<typename Input, typename Output>
class AsyncPositionController
class AsyncPosPIDController
class AsyncVelControllerBuilder
class AsyncVelIntegratedController
Closed-loop controller that uses the V5 motor's onboard control to move.
template<typename Input, typename Output>
class AsyncVelocityController
class AsyncVelPIDController
template<typename Input, typename Output>
class AsyncWrapper
template<std::size_t n>
class AverageFilter
A filter which returns the average of a list of values.
class ButtonBase
class ChassisController
class ChassisControllerBuilder
class ChassisControllerIntegrated
class ChassisControllerPID
class ChassisModel
A version of the ReadOnlyChassisModel that also supports write methods, such as setting motor speed.
class ChassisScales
template<typename Input, typename Output>
class ClosedLoopController
An abstract closed-loop controller.
class ComposableFilter
class ConfigurableTimeUtilFactory
A TimeUtilFactory that supplies the SettledUtil parameters passed in the constructor to every new TimeUtil instance.
class ContinuousRotarySensor
class Controller
class ControllerButton
template<typename T>
class ControllerInput
template<typename T>
class ControllerOutput
template<typename Input, typename Output>
class ControllerRunner
template<typename Input, typename Output>
class ControllerRunnerFactory
class ControllerUtil
struct DefaultLoggerInitializer
class DefaultOdomChassisController
class DemaFilter
class DistanceSensor
class EKFFilter
class EmaFilter
class Filter
template<typename InputType, typename FilterType>
class FilteredControllerInput
A ControllerInput with a filter built in.
class FlywheelSimulator
class HDriveModel
class IMU
class IntegratedEncoder
template<typename Input, typename Output>
class IterativeController
Closed-loop controller that steps iteratively using the step method below.
class IterativeControllerFactory
class IterativeMotorVelocityController
template<typename Input, typename Output>
class IterativePositionController
class IterativePosPIDController
template<typename Input, typename Output>
class IterativeVelocityController
class IterativeVelPIDController
class Logger
template<std::size_t n>
class MedianFilter
A filter which returns the median value of list of values.
class Motor
class MotorGroup
class OdomChassisController
class Odometry
class OdomMath
struct OdomState
class OffsetableControllerInput
class OpticalSensor
class PassthroughFilter
struct PathfinderLimits
struct PathfinderPoint
class PIDTuner
class PIDTunerFactory
struct Point
class Potentiometer
class Rate
class ReadOnlyChassisModel
A version of the ChassisModel that only supports read methods, such as querying sensor values.
class RotarySensor
class RotationSensor
template<typename MassDim, typename LengthDim, typename TimeDim, typename AngleDim>
class RQuantity
class SettledUtil
class SkidSteerModel
template<typename T>
class Supplier
A supplier of instances of T.
class ThreeEncoderOdometry
class ThreeEncoderSkidSteerModel
class ThreeEncoderXDriveModel
class Timer
class TimeUtil
Utility class for holding an AbstractTimer, AbstractRate, and SettledUtil together in one class since they are commonly used together.
class TimeUtilFactory
class TwoEncoderOdometry
class VelMath
class VelMathFactory
class XDriveModel

Enums

enum StateMode { FRAME_TRANSFORMATION, CARTESIAN }
The mode for the OdomState calculated by Odometry.
enum ControllerId { master = 0, partner = 1 }
Which controller role this has.
enum ControllerAnalog { leftX = 0, leftY = 1, rightX = 2, rightY = 3 }
The analog sticks.
enum ControllerDigital { L1 = 6, L2 = 7, R1 = 8, R2 = 9, up = 10, down = 11, left = 12, right = 13, X = 14, B = 15, Y = 16, A = 17 }
Various buttons.
enum OpticalSensorOutput { hue, saturation, brightness }
enum IMUAxes { z, y, x }

Functions

auto operator*(AbstractMotor::gearset gearset, double ratio) -> AbstractMotor::GearsetRatioPair
auto radian(1. 0) -> QAngle constexpr
static auto convertHertzToRadPerSec(QFrequency in) -> QAngularSpeed
auto Hz(1. 0) -> QFrequency constexpr
auto meter(1. 0) -> QLength constexpr
auto kg(1. 0) -> QMass constexpr
auto pascal(1. 0) -> QPressure constexpr
auto second(1. 0) -> QTime constexpr
auto number(1. 0) -> Number constexpr
template<typename M, typename L, typename T, typename A>
auto operator+(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> RQuantity<M, L, T, A> constexpr
template<typename M, typename L, typename T, typename A>
auto operator-(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> RQuantity<M, L, T, A> constexpr
template<typename M1, typename L1, typename T1, typename A1, typename M2, typename L2, typename T2, typename A2>
auto operator*(const RQuantity<M1, L1, T1, A1>& lhs, const RQuantity<M2, L2, T2, A2>& rhs) -> RQuantity<std::ratio_add<M1, M2>, std::ratio_add<L1, L2>, std::ratio_add<T1, T2>, std::ratio_add<A1, A2>> constexpr
template<typename M, typename L, typename T, typename A>
auto operator*(const double& lhs, const RQuantity<M, L, T, A>& rhs) -> RQuantity<M, L, T, A> constexpr
template<typename M, typename L, typename T, typename A>
auto operator*(const RQuantity<M, L, T, A>& lhs, const double& rhs) -> RQuantity<M, L, T, A> constexpr
template<typename M1, typename L1, typename T1, typename A1, typename M2, typename L2, typename T2, typename A2>
auto operator/(const RQuantity<M1, L1, T1, A1>& lhs, const RQuantity<M2, L2, T2, A2>& rhs) -> RQuantity<std::ratio_subtract<M1, M2>, std::ratio_subtract<L1, L2>, std::ratio_subtract<T1, T2>, std::ratio_subtract<A1, A2>> constexpr
template<typename M, typename L, typename T, typename A>
auto operator/(const double& x, const RQuantity<M, L, T, A>& rhs) -> RQuantity<std::ratio_subtract<std::ratio<0>, M>, std::ratio_subtract<std::ratio<0>, L>, std::ratio_subtract<std::ratio<0>, T>, std::ratio_subtract<std::ratio<0>, A>> constexpr
template<typename M, typename L, typename T, typename A>
auto operator/(const RQuantity<M, L, T, A>& rhs, const double& x) -> RQuantity<M, L, T, A> constexpr
template<typename M, typename L, typename T, typename A>
auto operator==(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> bool constexpr
template<typename M, typename L, typename T, typename A>
auto operator!=(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> bool constexpr
template<typename M, typename L, typename T, typename A>
auto operator<=(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> bool constexpr
template<typename M, typename L, typename T, typename A>
auto operator>=(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> bool constexpr
template<typename M, typename L, typename T, typename A>
auto operator<(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> bool constexpr
template<typename M, typename L, typename T, typename A>
auto operator>(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> bool constexpr
template<typename M, typename L, typename T, typename A>
auto abs(const RQuantity<M, L, T, A>& rhs) -> RQuantity<M, L, T, A> constexpr
template<typename R, typename M, typename L, typename T, typename A>
auto pow(const RQuantity<M, L, T, A>& lhs) -> RQuantity<std::ratio_multiply<M, R>, std::ratio_multiply<L, R>, std::ratio_multiply<T, R>, std::ratio_multiply<A, R>> constexpr
template<int R, typename M, typename L, typename T, typename A>
auto pow(const RQuantity<M, L, T, A>& lhs) -> RQuantity<std::ratio_multiply<M, std::ratio<R>>, std::ratio_multiply<L, std::ratio<R>>, std::ratio_multiply<T, std::ratio<R>>, std::ratio_multiply<A, std::ratio<R>>> constexpr
template<int R, typename M, typename L, typename T, typename A>
auto root(const RQuantity<M, L, T, A>& lhs) -> RQuantity<std::ratio_divide<M, std::ratio<R>>, std::ratio_divide<L, std::ratio<R>>, std::ratio_divide<T, std::ratio<R>>, std::ratio_divide<A, std::ratio<R>>> constexpr
template<typename M, typename L, typename T, typename A>
auto sqrt(const RQuantity<M, L, T, A>& rhs) -> RQuantity<std::ratio_divide<M, std::ratio<2>>, std::ratio_divide<L, std::ratio<2>>, std::ratio_divide<T, std::ratio<2>>, std::ratio_divide<A, std::ratio<2>>> constexpr
template<typename M, typename L, typename T, typename A>
auto cbrt(const RQuantity<M, L, T, A>& rhs) -> RQuantity<std::ratio_divide<M, std::ratio<3>>, std::ratio_divide<L, std::ratio<3>>, std::ratio_divide<T, std::ratio<3>>, std::ratio_divide<A, std::ratio<3>>> constexpr
template<typename M, typename L, typename T, typename A>
auto square(const RQuantity<M, L, T, A>& rhs) -> RQuantity<std::ratio_multiply<M, std::ratio<2>>, std::ratio_multiply<L, std::ratio<2>>, std::ratio_multiply<T, std::ratio<2>>, std::ratio_multiply<A, std::ratio<2>>> constexpr
template<typename M, typename L, typename T, typename A>
auto cube(const RQuantity<M, L, T, A>& rhs) -> RQuantity<std::ratio_multiply<M, std::ratio<3>>, std::ratio_multiply<L, std::ratio<3>>, std::ratio_multiply<T, std::ratio<3>>, std::ratio_multiply<A, std::ratio<3>>> constexpr
template<typename M, typename L, typename T, typename A>
auto hypot(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> RQuantity<M, L, T, A> constexpr
template<typename M, typename L, typename T, typename A>
auto mod(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> RQuantity<M, L, T, A> constexpr
template<typename M1, typename L1, typename T1, typename A1, typename M2, typename L2, typename T2, typename A2>
auto copysign(const RQuantity<M1, L1, T1, A1>& lhs, const RQuantity<M2, L2, T2, A2>& rhs) -> RQuantity<M1, L1, T1, A1> constexpr
template<typename M, typename L, typename T, typename A>
auto ceil(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> RQuantity<M, L, T, A> constexpr
template<typename M, typename L, typename T, typename A>
auto floor(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> RQuantity<M, L, T, A> constexpr
template<typename M, typename L, typename T, typename A>
auto trunc(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> RQuantity<M, L, T, A> constexpr
template<typename M, typename L, typename T, typename A>
auto round(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> RQuantity<M, L, T, A> constexpr
auto sin(const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>& rhs) -> Number constexpr
auto cos(const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>& rhs) -> Number constexpr
auto tan(const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>& rhs) -> Number constexpr
auto asin(const Number& rhs) -> RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> constexpr
auto acos(const Number& rhs) -> RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> constexpr
auto atan(const Number& rhs) -> RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> constexpr
auto sinh(const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>& rhs) -> Number constexpr
auto cosh(const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>& rhs) -> Number constexpr
auto tanh(const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>& rhs) -> Number constexpr
auto asinh(const Number& rhs) -> RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> constexpr
auto acosh(const Number& rhs) -> RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> constexpr
auto atanh(const Number& rhs) -> RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> constexpr
template<typename M, typename L, typename T, typename A>
auto atan2(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) -> RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> constexpr
template<class QType>
auto getShortUnitName(QType q) -> std::string
Returns a short name for a unit.
auto ipow(const double base, const int expo) -> double constexpr
Integer power function.
auto cutRange(const double value, const double min, const double max) -> double constexpr
Cuts out a range from the number.
auto deadband(const double value, const double min, const double max) -> double constexpr
Deadbands a range of the number.
auto remapRange(const double value, const double oldMin, const double oldMax, const double newMin, const double newMax) -> double constexpr
Remap a value in the range [oldMin, oldMax] to the range [newMin, newMax].
template<typename E>
auto toUnderlyingType(const E e) -> auto constexpr noexcept
Converts an enum to its value type.
auto boolToSign(const bool b) -> auto constexpr noexcept
Converts a bool to a sign.
auto modulus(const long lhs, const long rhs) -> long constexpr noexcept
Computes lhs mod rhs using Euclidean division.
auto gearsetToTPR(const AbstractMotor::gearset igearset) -> std::int32_t constexpr noexcept
Converts a gearset to its TPR.
auto transformADIPort(const std::int8_t port) -> std::int8_t constexpr

Variables

QAcceleration mps2 constexpr
QAcceleration G constexpr
QAngle degree constexpr
QAngularSpeed radps constexpr
QAngularSpeed rpm constexpr
QAngularSpeed cps constexpr
QArea kilometer2 constexpr
QArea meter2 constexpr
QArea decimeter2 constexpr
QArea centimeter2 constexpr
QArea millimeter2 constexpr
QArea inch2 constexpr
QArea foot2 constexpr
QArea mile2 constexpr
QForce newton constexpr
QForce poundforce constexpr
QForce kilopond constexpr
QLength decimeter constexpr
QLength centimeter constexpr
QLength millimeter constexpr
QLength kilometer constexpr
QLength inch constexpr
QLength foot constexpr
QLength yard constexpr
QLength mile constexpr
QLength tile constexpr
QMass gramme constexpr
QMass tonne constexpr
QMass ounce constexpr
QMass pound constexpr
QMass stone constexpr
QPressure bar constexpr
QPressure psi constexpr
QSpeed mps constexpr
QSpeed miph constexpr
QSpeed kmph constexpr
QTime millisecond constexpr
QTime minute constexpr
QTime hour constexpr
QTime day constexpr
QTorque newtonMeter constexpr
QTorque footPound constexpr
QTorque inchPound constexpr
QVolume kilometer3 constexpr
QVolume meter3 constexpr
QVolume decimeter3 constexpr
QVolume centimeter3 constexpr
QVolume millimeter3 constexpr
QVolume inch3 constexpr
QVolume foot3 constexpr
QVolume mile3 constexpr
QVolume litre constexpr
std::shared_ptr<Logger> defaultLogger
static DefaultLoggerInitializer defaultLoggerInitializer
static double inchToMM constexpr
Converts inches to millimeters.
static double mmToInch constexpr
Converts millimeters to inches.
static double degreeToRadian constexpr
Converts degrees to radians.
static double radianToDegree constexpr
Converts radians to degrees.
static double imeTorqueTPR constexpr
The ticks per rotation of the 393 IME with torque gearing.
static std::int32_t imeSpeedTPR constexpr
The ticks per rotation of the 393 IME with speed gearing.
static double imeTurboTPR constexpr
The ticks per rotation of the 393 IME with turbo gearing.
static double ime269TPR constexpr
The ticks per rotation of the 269 IME.
static std::int32_t imev5RedTPR constexpr
The ticks per rotation of the V5 motor with a red gearset.
static std::int32_t imev5GreenTPR constexpr
The ticks per rotation of the V5 motor with a green gearset.
static std::int32_t imev5BlueTPR constexpr
The ticks per rotation of the V5 motor with a blue gearset.
static std::int32_t quadEncoderTPR constexpr
The ticks per rotation of the red quadrature encoders.
static double pi constexpr
The value of pi.
static double pi2 constexpr
The value of pi divided by 2.
static double gravity constexpr
The conventional value of gravity of Earth.
static auto OKAPI_PROS_ERR constexpr
Same as PROS_ERR.
static auto OKAPI_PROS_ERR_F constexpr
Same as PROS_ERR_F.
static double v5MotorMaxVoltage constexpr
The maximum voltage that can be sent to V5 motors.
static std::int8_t motorUpdateRate constexpr
The polling frequency of V5 motors in milliseconds.
static std::int8_t adiUpdateRate constexpr
The polling frequency of the ADI ports in milliseconds.

Enum documentation

enum okapi::StateMode

The mode for the OdomState calculated by Odometry.

Enumerators
FRAME_TRANSFORMATION

+x is forward, +y is right, 0 degrees is along +x

CARTESIAN

+x is right, +y is forward, 0 degrees is along +y

enum okapi::ControllerId

Which controller role this has.

Enumerators
master

master

partner

partner

enum okapi::ControllerAnalog

The analog sticks.

Enumerators
leftX

leftX

leftY

leftY

rightX

rightX

rightY

rightY

enum okapi::ControllerDigital

Various buttons.

Enumerators
L1

L1.

L2

L2.

R1

R1.

R2

R2.

up

up

down

down

left

left

right

right

X

X.

B

B.

Y

Y.

A

A.

enum okapi::OpticalSensorOutput

Enumerators
hue

The color.

saturation

The color's intensity relative to its brightness.

brightness

The amount of light.

enum okapi::IMUAxes

Enumerators
z

Yaw Axis.

y

Pitch Axis.

x

Roll Axis.

Function documentation

QAngle okapi::radian(1. 0) constexpr

static QAngularSpeed okapi::convertHertzToRadPerSec(QFrequency in)

QFrequency okapi::Hz(1. 0) constexpr

QLength okapi::meter(1. 0) constexpr

QMass okapi::kg(1. 0) constexpr

QPressure okapi::pascal(1. 0) constexpr

QTime okapi::second(1. 0) constexpr

Number okapi::number(1. 0) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<M, L, T, A> okapi::operator+(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<M, L, T, A> okapi::operator-(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M1, typename L1, typename T1, typename A1, typename M2, typename L2, typename T2, typename A2>
RQuantity<std::ratio_add<M1, M2>, std::ratio_add<L1, L2>, std::ratio_add<T1, T2>, std::ratio_add<A1, A2>> okapi::operator*(const RQuantity<M1, L1, T1, A1>& lhs, const RQuantity<M2, L2, T2, A2>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<M, L, T, A> okapi::operator*(const double& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<M, L, T, A> okapi::operator*(const RQuantity<M, L, T, A>& lhs, const double& rhs) constexpr

template<typename M1, typename L1, typename T1, typename A1, typename M2, typename L2, typename T2, typename A2>
RQuantity<std::ratio_subtract<M1, M2>, std::ratio_subtract<L1, L2>, std::ratio_subtract<T1, T2>, std::ratio_subtract<A1, A2>> okapi::operator/(const RQuantity<M1, L1, T1, A1>& lhs, const RQuantity<M2, L2, T2, A2>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<std::ratio_subtract<std::ratio<0>, M>, std::ratio_subtract<std::ratio<0>, L>, std::ratio_subtract<std::ratio<0>, T>, std::ratio_subtract<std::ratio<0>, A>> okapi::operator/(const double& x, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<M, L, T, A> okapi::operator/(const RQuantity<M, L, T, A>& rhs, const double& x) constexpr

template<typename M, typename L, typename T, typename A>
bool okapi::operator==(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
bool okapi::operator!=(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
bool okapi::operator<=(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
bool okapi::operator>=(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
bool okapi::operator<(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
bool okapi::operator>(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<M, L, T, A> okapi::abs(const RQuantity<M, L, T, A>& rhs) constexpr

template<typename R, typename M, typename L, typename T, typename A>
RQuantity<std::ratio_multiply<M, R>, std::ratio_multiply<L, R>, std::ratio_multiply<T, R>, std::ratio_multiply<A, R>> okapi::pow(const RQuantity<M, L, T, A>& lhs) constexpr

template<int R, typename M, typename L, typename T, typename A>
RQuantity<std::ratio_multiply<M, std::ratio<R>>, std::ratio_multiply<L, std::ratio<R>>, std::ratio_multiply<T, std::ratio<R>>, std::ratio_multiply<A, std::ratio<R>>> okapi::pow(const RQuantity<M, L, T, A>& lhs) constexpr

template<int R, typename M, typename L, typename T, typename A>
RQuantity<std::ratio_divide<M, std::ratio<R>>, std::ratio_divide<L, std::ratio<R>>, std::ratio_divide<T, std::ratio<R>>, std::ratio_divide<A, std::ratio<R>>> okapi::root(const RQuantity<M, L, T, A>& lhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<std::ratio_divide<M, std::ratio<2>>, std::ratio_divide<L, std::ratio<2>>, std::ratio_divide<T, std::ratio<2>>, std::ratio_divide<A, std::ratio<2>>> okapi::sqrt(const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<std::ratio_divide<M, std::ratio<3>>, std::ratio_divide<L, std::ratio<3>>, std::ratio_divide<T, std::ratio<3>>, std::ratio_divide<A, std::ratio<3>>> okapi::cbrt(const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<std::ratio_multiply<M, std::ratio<2>>, std::ratio_multiply<L, std::ratio<2>>, std::ratio_multiply<T, std::ratio<2>>, std::ratio_multiply<A, std::ratio<2>>> okapi::square(const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<std::ratio_multiply<M, std::ratio<3>>, std::ratio_multiply<L, std::ratio<3>>, std::ratio_multiply<T, std::ratio<3>>, std::ratio_multiply<A, std::ratio<3>>> okapi::cube(const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<M, L, T, A> okapi::hypot(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<M, L, T, A> okapi::mod(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M1, typename L1, typename T1, typename A1, typename M2, typename L2, typename T2, typename A2>
RQuantity<M1, L1, T1, A1> okapi::copysign(const RQuantity<M1, L1, T1, A1>& lhs, const RQuantity<M2, L2, T2, A2>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<M, L, T, A> okapi::ceil(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<M, L, T, A> okapi::floor(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<M, L, T, A> okapi::trunc(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<M, L, T, A> okapi::round(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

Number okapi::sin(const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>& rhs) constexpr

Number okapi::cos(const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>& rhs) constexpr

Number okapi::tan(const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>& rhs) constexpr

RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> okapi::asin(const Number& rhs) constexpr

RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> okapi::acos(const Number& rhs) constexpr

RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> okapi::atan(const Number& rhs) constexpr

Number okapi::sinh(const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>& rhs) constexpr

Number okapi::cosh(const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>& rhs) constexpr

Number okapi::tanh(const RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>>& rhs) constexpr

RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> okapi::asinh(const Number& rhs) constexpr

RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> okapi::acosh(const Number& rhs) constexpr

RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> okapi::atanh(const Number& rhs) constexpr

template<typename M, typename L, typename T, typename A>
RQuantity<std::ratio<0>, std::ratio<0>, std::ratio<0>, std::ratio<1>> okapi::atan2(const RQuantity<M, L, T, A>& lhs, const RQuantity<M, L, T, A>& rhs) constexpr

template<class QType>
std::string okapi::getShortUnitName(QType q)

Returns a short name for a unit.

Parameters
q Your unit. Currently only QLength and QAngle are supported.
Returns The short string suffix for that unit.

For example: str(1_ft) will return "ft", so will 1 * foot or 0.3048_m. Throws std::domain_error when q is a unit not defined in this function.

double okapi::ipow(const double base, const int expo) constexpr

Integer power function.

Parameters
base The base.
expo The exponent.
Returns base^expo.

Computes base^expo.

double okapi::cutRange(const double value, const double min, const double max) constexpr

Cuts out a range from the number.

Parameters
value The number to bound.
min The lower bound of range.
max The upper bound of range.
Returns The remapped value.

The new range of the input number will be (-inf, min]U[max, +inf). If value sits equally between min and max, max will be returned.

double okapi::deadband(const double value, const double min, const double max) constexpr

Deadbands a range of the number.

Parameters
value The number to deadband.
min The lower bound of deadband.
max The upper bound of deadband.
Returns The input value or 0 if it is in the range [min, max].

Returns the input value, or 0 if it is in the range [min, max].

double okapi::remapRange(const double value, const double oldMin, const double oldMax, const double newMin, const double newMax) constexpr

Remap a value in the range [oldMin, oldMax] to the range [newMin, newMax].

Parameters
value The value in the old range.
oldMin The old range lower bound.
oldMax The old range upper bound.
newMin The new range lower bound.
newMax The new range upper bound.
Returns The input value in the new range [newMin, newMax].

template<typename E>
auto okapi::toUnderlyingType(const E e) constexpr noexcept

Converts an enum to its value type.

Parameters
e The enum value.
Returns The corresponding value.

auto okapi::boolToSign(const bool b) constexpr noexcept

Converts a bool to a sign.

Parameters
b The bool.
Returns True corresponds to 1 and false corresponds to -1.

long okapi::modulus(const long lhs, const long rhs) constexpr noexcept

Computes lhs mod rhs using Euclidean division.

Parameters
lhs The left-hand side.
rhs The right-hand side.
Returns lhs mod rhs.

C's % symbol computes the remainder, not modulus.

std::int32_t okapi::gearsetToTPR(const AbstractMotor::gearset igearset) constexpr noexcept

Converts a gearset to its TPR.

Parameters
igearset The gearset.
Returns The corresponding TPR.

std::int8_t okapi::transformADIPort(const std::int8_t port) constexpr

Parameters
port The ADI port number or char.
Returns An equivalent ADI port number.

Variable documentation

QAcceleration okapi::mps2 constexpr

QAcceleration okapi::G constexpr

QAngle okapi::degree constexpr

QAngularSpeed okapi::radps constexpr

QAngularSpeed okapi::rpm constexpr

QAngularSpeed okapi::cps constexpr

QArea okapi::kilometer2 constexpr

QArea okapi::meter2 constexpr

QArea okapi::decimeter2 constexpr

QArea okapi::centimeter2 constexpr

QArea okapi::millimeter2 constexpr

QArea okapi::inch2 constexpr

QArea okapi::foot2 constexpr

QArea okapi::mile2 constexpr

QForce okapi::newton constexpr

QForce okapi::poundforce constexpr

QForce okapi::kilopond constexpr

QLength okapi::decimeter constexpr

QLength okapi::centimeter constexpr

QLength okapi::millimeter constexpr

QLength okapi::kilometer constexpr

QLength okapi::inch constexpr

QLength okapi::foot constexpr

QLength okapi::yard constexpr

QLength okapi::mile constexpr

QLength okapi::tile constexpr

QMass okapi::gramme constexpr

QMass okapi::tonne constexpr

QMass okapi::ounce constexpr

QMass okapi::pound constexpr

QMass okapi::stone constexpr

QPressure okapi::bar constexpr

QPressure okapi::psi constexpr

QSpeed okapi::mps constexpr

QSpeed okapi::miph constexpr

QSpeed okapi::kmph constexpr

QTime okapi::millisecond constexpr

QTime okapi::minute constexpr

QTime okapi::hour constexpr

QTime okapi::day constexpr

QTorque okapi::newtonMeter constexpr

QTorque okapi::footPound constexpr

QTorque okapi::inchPound constexpr

QVolume okapi::kilometer3 constexpr

QVolume okapi::meter3 constexpr

QVolume okapi::decimeter3 constexpr

QVolume okapi::centimeter3 constexpr

QVolume okapi::millimeter3 constexpr

QVolume okapi::inch3 constexpr

QVolume okapi::foot3 constexpr

QVolume okapi::mile3 constexpr

QVolume okapi::litre constexpr

std::shared_ptr<Logger> okapi::defaultLogger

static double okapi::inchToMM constexpr

Converts inches to millimeters.

static double okapi::mmToInch constexpr

Converts millimeters to inches.

static double okapi::degreeToRadian constexpr

Converts degrees to radians.

static double okapi::radianToDegree constexpr

Converts radians to degrees.

static double okapi::imeTorqueTPR constexpr

The ticks per rotation of the 393 IME with torque gearing.

static std::int32_t okapi::imeSpeedTPR constexpr

The ticks per rotation of the 393 IME with speed gearing.

static double okapi::imeTurboTPR constexpr

The ticks per rotation of the 393 IME with turbo gearing.

static double okapi::ime269TPR constexpr

The ticks per rotation of the 269 IME.

static std::int32_t okapi::imev5RedTPR constexpr

The ticks per rotation of the V5 motor with a red gearset.

static std::int32_t okapi::imev5GreenTPR constexpr

The ticks per rotation of the V5 motor with a green gearset.

static std::int32_t okapi::imev5BlueTPR constexpr

The ticks per rotation of the V5 motor with a blue gearset.

static std::int32_t okapi::quadEncoderTPR constexpr

The ticks per rotation of the red quadrature encoders.

static double okapi::pi constexpr

The value of pi.

static double okapi::pi2 constexpr

The value of pi divided by 2.

static double okapi::gravity constexpr

The conventional value of gravity of Earth.

static auto okapi::OKAPI_PROS_ERR constexpr

Same as PROS_ERR.

static auto okapi::OKAPI_PROS_ERR_F constexpr

Same as PROS_ERR_F.

static double okapi::v5MotorMaxVoltage constexpr

The maximum voltage that can be sent to V5 motors.

static std::int8_t okapi::motorUpdateRate constexpr

The polling frequency of V5 motors in milliseconds.

static std::int8_t okapi::adiUpdateRate constexpr

The polling frequency of the ADI ports in milliseconds.