YAMS
Yet Another Mechanism System
Loading...
Searching...
No Matches
LQRUnits.hpp
Go to the documentation of this file.
1// Copyright (c) 2026 Yet Another Software Suite
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4#pragma once
5
6#include <numbers>
7
9
10namespace yams::telemetry {
11
21inline double LQRToSI(math::LQRConfig::LQRType type, bool position, double value) {
22 if (type == math::LQRConfig::LQRType::ELEVATOR) return value;
23 return position ? value * std::numbers::pi / 180.0 : value * 2.0 * std::numbers::pi / 60.0;
24}
25
34inline double LQRFromSI(math::LQRConfig::LQRType type, bool position, double value) {
35 if (type == math::LQRConfig::LQRType::ELEVATOR) return value;
36 return position ? value * 180.0 / std::numbers::pi : value * 60.0 / (2.0 * std::numbers::pi);
37}
38
39} // namespace yams::telemetry
LQRType
Definition LQRConfig.hpp:31
@ ELEVATOR
Elevator (2-state position+velocity model).
Definition LQRConfig.hpp:34
Definition SwerveDrive.hpp:872
double LQRToSI(math::LQRConfig::LQRType type, bool position, double value)
Definition LQRUnits.hpp:21
double LQRFromSI(math::LQRConfig::LQRType type, bool position, double value)
Definition LQRUnits.hpp:34