libstp
Robotics library for Botball
Loading...
Searching...
No Matches
CalibrationStore.hpp
Go to the documentation of this file.
1//
2// Created by eternalRose on 1/15/26.
3//
4
5#pragma once
6
7#ifdef SAFETY_CHECKS_ENABLED
8#include <set>
9#endif
10#include <string>
11#include <vector>
12
13#include "CalibrationType.hpp"
14
17 class CalibrationStore final {
18 CalibrationStore() = default;
19 ~CalibrationStore();
21 std::string FILE_PATH = "./racoon.calibration.yml";
22 public:
23 CalibrationStore(const CalibrationStore&) = delete;
24 CalibrationStore& operator=(const CalibrationStore&) = delete;
25 CalibrationStore(CalibrationStore&&) = delete;
26 CalibrationStore& operator=(CalibrationStore&&) = delete;
27
29 [[nodiscard]] bool doesFileExist() const;
30
32 static CalibrationStore& instance();
33
35 void storeReading(float black_tresh, float white_tresh, CalibrationType type,
36 const std::string& set_name = "default") const;
37
39 [[nodiscard]] bool hasReadings(CalibrationType type,
40 const std::string& set_name = "default") const;
41
43 [[nodiscard]] std::vector<float> getReadings(CalibrationType type,
44 const std::string& set_name = "default") const;
45
47 [[nodiscard]] std::vector<std::string> getSetNames(CalibrationType type) const;
48 };
49}
CalibrationStore & operator=(CalibrationStore &&)=delete
bool doesFileExist() const
Check whether the backing YAML file exists.
CalibrationStore(CalibrationStore &&)=delete
CalibrationStore(const CalibrationStore &)=delete
static CalibrationStore & instance()
Return the singleton store instance.
CalibrationStore & operator=(const CalibrationStore &)=delete
void storeReading(float black_tresh, float white_tresh, CalibrationType type, const std::string &set_name="default") const
Persist one black/white threshold pair for the given calibration type and set.
bool hasReadings(CalibrationType type, const std::string &set_name="default") const
Report whether both expected values are present for the given type and set.
std::vector< float > getReadings(CalibrationType type, const std::string &set_name="default") const
Return {white_tresh, black_tresh} or {0.0, 0.0} when no reading exists.
std::vector< std::string > getSetNames(CalibrationType type) const
Return the names of all calibration sets stored for the given type.
CalibrationType
Supported calibration families persisted by CalibrationStore.