[sysid] Make constexpr variables outside class scope inline (#6145)

This commit is contained in:
Tyler Veness
2024-01-03 14:27:51 -08:00
committed by GitHub
parent 73c7d87db7
commit 44db3e0ac0
6 changed files with 52 additions and 51 deletions

View File

@@ -99,10 +99,10 @@ void AnalysisManager::PrepareGeneralData() {
wpi::StringMap<std::vector<PreparedData>> preparedData;
// Store the raw data columns.
static constexpr size_t kTimeCol = 0;
static constexpr size_t kVoltageCol = 1;
static constexpr size_t kPosCol = 2;
static constexpr size_t kVelCol = 3;
constexpr size_t kTimeCol = 0;
constexpr size_t kVoltageCol = 1;
constexpr size_t kPosCol = 2;
constexpr size_t kVelCol = 3;
WPI_INFO(m_logger, "{}", "Reading JSON data.");
// Get the major components from the JSON and store them inside a StringMap.
@@ -176,15 +176,15 @@ void AnalysisManager::PrepareAngularDrivetrainData() {
wpi::StringMap<std::vector<PreparedData>> preparedData;
// Store the relevant raw data columns.
static constexpr size_t kTimeCol = 0;
static constexpr size_t kLVoltageCol = 1;
static constexpr size_t kRVoltageCol = 2;
static constexpr size_t kLPosCol = 3;
static constexpr size_t kRPosCol = 4;
static constexpr size_t kLVelCol = 5;
static constexpr size_t kRVelCol = 6;
static constexpr size_t kAngleCol = 7;
static constexpr size_t kAngularRateCol = 8;
constexpr size_t kTimeCol = 0;
constexpr size_t kLVoltageCol = 1;
constexpr size_t kRVoltageCol = 2;
constexpr size_t kLPosCol = 3;
constexpr size_t kRPosCol = 4;
constexpr size_t kLVelCol = 5;
constexpr size_t kRVelCol = 6;
constexpr size_t kAngleCol = 7;
constexpr size_t kAngularRateCol = 8;
WPI_INFO(m_logger, "{}", "Reading JSON data.");
// Get the major components from the JSON and store them inside a StringMap.
@@ -293,13 +293,13 @@ void AnalysisManager::PrepareLinearDrivetrainData() {
wpi::StringMap<std::vector<PreparedData>> preparedData;
// Store the relevant raw data columns.
static constexpr size_t kTimeCol = 0;
static constexpr size_t kLVoltageCol = 1;
static constexpr size_t kRVoltageCol = 2;
static constexpr size_t kLPosCol = 3;
static constexpr size_t kRPosCol = 4;
static constexpr size_t kLVelCol = 5;
static constexpr size_t kRVelCol = 6;
constexpr size_t kTimeCol = 0;
constexpr size_t kLVoltageCol = 1;
constexpr size_t kRVoltageCol = 2;
constexpr size_t kLPosCol = 3;
constexpr size_t kRPosCol = 4;
constexpr size_t kLVelCol = 5;
constexpr size_t kRVelCol = 6;
// Get the major components from the JSON and store them inside a StringMap.
WPI_INFO(m_logger, "{}", "Reading JSON data.");

View File

@@ -20,17 +20,17 @@
#include "sysid/analysis/AnalysisType.h"
// Sizes of the arrays for new sysid data.
static constexpr size_t kDrivetrainSize = 9;
static constexpr size_t kGeneralSize = 4;
inline constexpr size_t kDrivetrainSize = 9;
inline constexpr size_t kGeneralSize = 4;
// Indices for the old data.
static constexpr size_t kTimestampCol = 0;
static constexpr size_t kLVoltsCol = 3;
static constexpr size_t kRVoltsCol = 4;
static constexpr size_t kLPosCol = 5;
static constexpr size_t kRPosCol = 6;
static constexpr size_t kLVelCol = 7;
static constexpr size_t kRVelCol = 8;
inline constexpr size_t kTimestampCol = 0;
inline constexpr size_t kLVoltsCol = 3;
inline constexpr size_t kRVoltsCol = 4;
inline constexpr size_t kLPosCol = 5;
inline constexpr size_t kRPosCol = 6;
inline constexpr size_t kLVelCol = 7;
inline constexpr size_t kRVelCol = 8;
static wpi::json GetJSON(std::string_view path, wpi::Logger& logger) {
std::error_code ec;