Obs_Calibration_Vector.hpp 2.07 KB
Newer Older
Achim Morschhauser's avatar
Achim Morschhauser committed
1
2
3
4
#ifndef INCLUDE_OBS_CALIBRATION_VECTOR_HPP_
#define INCLUDE_OBS_CALIBRATION_VECTOR_HPP_

#include <vector>
5
#include <string>           // String
Achim Morschhauser's avatar
Achim Morschhauser committed
6
7
8
9

#include <data_obs_vector.hpp>
#include <data_obs_scalar.hpp>
#include <Obs_Calibration.hpp>
10
#include <unordered_map>
Achim Morschhauser's avatar
Achim Morschhauser committed
11

12
class Obs_Calibration_Vector {
Achim Morschhauser's avatar
Achim Morschhauser committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

	//
	// Private class variables
	//

private:

	/** The offset */
	double offset[3];
	/** The scale value */
	double scale[3];


	/** Non-zero calibration constants */
	char do_cal;

29
30
31
32
33
34
35
36
37
        /** ADC calibration constant */
        struct adc_cal {
            std::string offset;
            std::string scale;
        };
        
        /** Map containing the ADC calibration key-value pairs */
        std::unordered_map<std::string, struct adc_cal> map_ADC;
        
Achim Morschhauser's avatar
Achim Morschhauser committed
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
	/** ADC Offsets */
	std::vector<int> adc_offset;
	/** ADC scale values */
	std::vector<int> adc_scale;
	/** ADC configuration */
	std::vector<int> adc_config;

	//
	// Constructors
	//

public:

	/** Constructor with single values */
	Obs_Calibration_Vector(double offset=0, double scale=1);

	/** Constructor with vector values */
	Obs_Calibration_Vector(double* offset, double* scale);

57
        /** Constructor with individual values */
Achim Morschhauser's avatar
Achim Morschhauser committed
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
	Obs_Calibration_Vector(double scale_X, double scale_Y, double scale_Z,
			double offset_X=0, double offset_Y=0, double offset_Z=0);


	//
	// Public Methods
	//

public:

	/** Calibrate the vector data */
	int calibrate(data_obs_vector* vdata);

	/** Calibrate the scalar data */
	int calibrate(data_obs_scalar* sdata);

	/** Get the calibration constants for the ADC */
75
76
	int get_adc_calibrate(std::string config, std::string* offset,
                std::string* scale);
Achim Morschhauser's avatar
Achim Morschhauser committed
77
78

	/** Add a calibration constant for the ADC */
79
80
81
82
83
84
85
86
	int add_adc_calibrate(std::string config, std::string offset,
                std::string scale);
        
        /** Save the calibration constants to file */
        int save_adc_calibrate(std::string filename);
        
        /** Read the calibration constants from file */
        int read_adc_calibrate(std::string filename);
Achim Morschhauser's avatar
Achim Morschhauser committed
87
88
89
90
91


};

#endif /* INCLUDE_OBS_CALIBRATION_VECTOR_HPP_ */