summaryrefslogtreecommitdiff
path: root/src/sensor/calibration.hpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-03-21 13:00:36 +0100
committerHampusM <hampus@hampusmat.com>2022-03-21 13:00:36 +0100
commit757a29d0137b974fff6ddcc945d76e69ae120ecb (patch)
tree1fff46951e30eeae0402e99070e60901bd104eea /src/sensor/calibration.hpp
parent12e3713e7705e4353d306ae2ec03abfe8fcd5f55 (diff)
refactor: use MPU6050_light & clean up bloatHEADmaster
Diffstat (limited to 'src/sensor/calibration.hpp')
-rw-r--r--src/sensor/calibration.hpp76
1 files changed, 0 insertions, 76 deletions
diff --git a/src/sensor/calibration.hpp b/src/sensor/calibration.hpp
deleted file mode 100644
index c85d336..0000000
--- a/src/sensor/calibration.hpp
+++ /dev/null
@@ -1,76 +0,0 @@
-#pragma once
-
-#include "common/memory/shared_ptr.hpp"
-#include "sensor/sensor.hpp"
-#include "serial.hpp"
-
-// Calibration precision
-constexpr double ACCEL_CAL_X_MAX = 0.003;
-constexpr double ACCEL_CAL_X_MIN = -0.003;
-
-constexpr double ACCEL_CAL_Y_MAX = 0.003;
-constexpr double ACCEL_CAL_Y_MIN = -0.003;
-
-constexpr double ACCEL_CAL_Z_MAX = 0.003;
-constexpr double ACCEL_CAL_Z_MIN = -0.003;
-
-constexpr double GYRO_CAL_X_MAX = 0.003;
-constexpr double GYRO_CAL_X_MIN = -0.003;
-
-constexpr double GYRO_CAL_Y_MAX = 0.05;
-constexpr double GYRO_CAL_Y_MIN = -0.05;
-
-constexpr double GYRO_CAL_Z_MAX = 0.04;
-constexpr double GYRO_CAL_Z_MIN = -0.04;
-
-constexpr uint32_t CALIBRATION_TIMEOUT = 120000; // milliseconds
-
-constexpr uint32_t SENSOR_READ_CNT = 20;
-constexpr double SENSOR_VAL_ADJUST = 0.05;
-
-class SensorCalibratorValues
-{
-public:
- double accel_x = 0;
- double accel_y = 0;
- double accel_z = 0;
-
- double gyro_x = 0;
- double gyro_y = 0;
- double gyro_z = 0;
-};
-
-/**
- * Sensor calibrator.
- */
-class SensorCalibrator
-{
-public:
- /**
- * Sensor calibrator.
- *
- * @param sensor A sensor to calibrate
- * @param sout A Serial output stream
- */
- SensorCalibrator(common::SharedPtr<Sensor> sensor,
- common::SharedPtr<SerialStream> sout);
-
- /**
- * Calibrates the sensor.
- *
- * @param throttle_time The sensor's throttle time
- * @returns Whether or not the calibration succeeded. Will return false on
- * timeout.
- */
- bool calibrate(unsigned int throttle_time);
-
-private:
- void _updateValues(SensorCalibratorValues &values);
- void _adjustCalibrationWithValues(const SensorCalibratorValues &values);
-
- static void _adjustValues(SensorCalibratorValues &values);
- static bool _isValuesInRange(const SensorCalibratorValues &values);
-
- common::SharedPtr<Sensor> _sensor;
- common::SharedPtr<SerialStream> _sout;
-};