Motion Master
Loading...
Searching...
No Matches
calibration_history Namespace Reference

Classes

struct  AmplitudeControlGain
 The raw values of the registers that hold ACGAIN and AFGAIN. More...
struct  Outcome
 How a run ended. More...
struct  Quality
 The quality of a run, taken from the validation iteration. More...
struct  ResidualOffsetError
 The residual offset errors of both tracks after the analysis, in LSB. More...
struct  RunRecord
struct  TrackAdjustments
 The adjustment values of one track, one element per iteration. More...
struct  UpdatedFile
 The content of a file after a run was added. More...

Functions

std::string fileName (uint8_t encoderOrdinal)
std::optional< int > qualityPercentage (const std::vector< int64_t > &curve, int64_t maxPermissiblePhaseError)
std::string verdict (double lowerPhaseMargin, double upperPhaseMargin)
bool isHealthMonitoringActive (uint8_t cfgew)
std::string encoderTypeName (CirculoEncoderType type)
 The name of a Circulo encoder type, for example CIRCULO_7_INNER.
std::string utcTimestamp (std::chrono::system_clock::time_point time)
 The time in UTC, for example 2026-11-04T10:15:00Z.
UpdatedFile prependRun (const std::optional< std::string > &existingContent, const RunRecord &run)

Variables

constexpr int kFileVersion = 1
 The version of the file format.
constexpr size_t kMaxRuns = 10
 The number of runs a file keeps. Older runs are dropped.
constexpr std::array< uint8_t, 33 > kKeyConfigurationRegisterAddresses

Detailed Description

The record of Circulo encoder calibration runs that Motion Master keeps on the drive's flash, one file per encoder ordinal. Every function here is pure, so the record can be built and tested without a drive.

Function Documentation

◆ encoderTypeName()

std::string calibration_history::encoderTypeName ( CirculoEncoderType type)

The name of a Circulo encoder type, for example CIRCULO_7_INNER.

◆ fileName()

std::string calibration_history::fileName ( uint8_t encoderOrdinal)

The name of the file for an encoder ordinal, for example circulo_integrated_encoder_1_calib.json. It follows circulo_integrated_encoder_1_config.bin and fits the 40-character file name limit of SOMANET firmware.

◆ isHealthMonitoringActive()

bool calibration_history::isHealthMonitoringActive ( uint8_t cfgew)

Whether register 0x0C (CFGEW) lets NON_CTR reach the error bit: bit 6 clear.

◆ prependRun()

UpdatedFile calibration_history::prependRun ( const std::optional< std::string > & existingContent,
const RunRecord & run )

Puts the run in front of the runs in the existing content and keeps at most kMaxRuns. Missing content starts a new file. Content that is not a history file of this version also starts a new file, and the result says so.

◆ qualityPercentage()

std::optional< int > calibration_history::qualityPercentage ( const std::vector< int64_t > & curve,
int64_t maxPermissiblePhaseError )

The quality percentage, computed exactly as OBLAC computes it: 100 - floor(max |sample| / maxPermissiblePhaseError * 100), clamped at 0. Empty when there are no samples or the limit is not positive.

◆ utcTimestamp()

std::string calibration_history::utcTimestamp ( std::chrono::system_clock::time_point time)

The time in UTC, for example 2026-11-04T10:15:00Z.

◆ verdict()

std::string calibration_history::verdict ( double lowerPhaseMargin,
double upperPhaseMargin )

EXCELLENT when both phase margins are above 25 %, MARGINAL when both are above 15 %, UNSAFE otherwise.

Variable Documentation

◆ kFileVersion

int calibration_history::kFileVersion = 1
inlineconstexpr

The version of the file format.

◆ kKeyConfigurationRegisterAddresses

std::array<uint8_t, 33> calibration_history::kKeyConfigurationRegisterAddresses
inlineconstexpr
Initial value:
= {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
0x16, 0x17, 0x18, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59}

The RAM addresses of the 33 key configuration registers, in the order of circuloIntegratedEncoderKeyConfigurationRegisterAddresses in oblac.

◆ kMaxRuns

size_t calibration_history::kMaxRuns = 10
inlineconstexpr

The number of runs a file keeps. Older runs are dropped.