ifw-fcf 6.0.0
Loading...
Searching...
No Matches
adcConfig.hpp
Go to the documentation of this file.
1
9#ifndef FCF_DEVMGR_DEVICE_ADC_CONFIG_HPP
10#define FCF_DEVMGR_DEVICE_ADC_CONFIG_HPP
11
12#include <string>
13#include <yaml-cpp/yaml.h>
14
15#include <utils/bat/logger.hpp>
20
21namespace fcf::devmgr::adc {
22
23
24 constexpr auto LOGGER_NAME = "adc";
25 // Constants for internal mapping
26 // Specifics Adc status values
27 constexpr auto CI_MOTOR_MAP_FILE = "mapMotorFile";
28
29 constexpr auto CI_AXES = "motors";
30 constexpr auto CI_FOCUS_SIGN = "focus_sign";
31 constexpr auto CI_DIR_SIGN = "dir_sign";
32 constexpr auto CI_STAT_REF = "off_ref";
33 constexpr auto CI_STAT_AUTO = "auto_ref";
34
35 constexpr auto CI_LATITUDE = "latitude";
36 constexpr auto CI_LONGITUDE = "longitude";
37 constexpr auto CI_TRK_PERIOD = "trk_period";
38 constexpr auto CI_TRK_THRESHOLD = "trk_threshold";
39
40 constexpr auto CI_PSLOPE = "pslope";
41 constexpr auto CI_POFFSET = "poffset";
42 constexpr auto CI_TSLOPE = "tslope";
43 constexpr auto CI_TOFFSET = "toffset";
44 constexpr auto CI_AFACTOR = "afactor";
45 constexpr auto CI_ZDLIMIT = "zdlimit";
46 constexpr auto CI_MINELEV = "minelev";
47
48 constexpr auto CI_MOT1_SIGN_OFF = "mot1_signoff";
49 constexpr auto CI_MOT2_SIGN_OFF = "mot2_signoff";
50 constexpr auto CI_MOT1_SIGN_AUTO = "mot1_signauto";
51 constexpr auto CI_MOT2_SIGN_AUTO = "mot2_signauto";
52 constexpr auto CI_MOT1_SIGN_PHI = "mot1_signphi";
53 constexpr auto CI_MOT2_SIGN_PHI = "mot2_signphi";
54 constexpr auto CI_MOT1_REF_OFF = "mot1_refoff";
55 constexpr auto CI_MOT2_REF_OFF = "mot2_refoff";
56 constexpr auto CI_MOT1_REF_AUTO = "mot1_refauto";
57 constexpr auto CI_MOT2_REF_AUTO = "mot2_refauto";
58 constexpr auto CI_MOT1_COFFSET = "mot1_coffset";
59 constexpr auto CI_MOT2_COFFSET = "mot2_coffset";
60 constexpr auto CI_MOT1_POSOFFSET = "mot1_poffset";
61 constexpr auto CI_MOT2_POSOFFSET = "mot2_poffset";
62 constexpr auto CI_MOT1_DROTFACTOR = "mot1_drotfactor";
63 constexpr auto CI_MOT2_DROTFACTOR = "mot2_drotfactor";
64
65
66 // Specific Adc RPC
67 constexpr auto RPC_MOVE_ANGLE = "rpcMoveAngle";
68 constexpr auto RPC_START_TRACK = "rpcStartTrack";
69 constexpr auto RPC_STOP_TRACK = "rpcStopTrack";
70
71
72 // Specific constant values for Adc device state/substate
73
74 constexpr int SUBSTATE_RESETTING = 109;
75 constexpr int SUBSTATE_ENABLING = 110;
76
77 constexpr int SUBSTATE_OP_TRACKING = 220;
78 constexpr int SUBSTATE_OP_PRESETTING = 221;
79
80 constexpr auto SUBSTATE_RESETTING_STR = "Resetting";
81 constexpr auto SUBSTATE_ENABLING_STR = "Enabling";
82 constexpr auto SUBSTATE_OP_TRACKING_STR = "Tracking";
83 constexpr auto SUBSTATE_OP_PRESETTING_STR = "Presetting";
84
85
86
87 const std::unordered_map<short, std::string> SubstateMap = {
102 };
103
104 constexpr short TRK_MODE_ENG = 0;
105 constexpr short TRK_MODE_OFF = 1;
106 constexpr short TRK_MODE_AUTO = 2;
107
108
109 constexpr auto TRK_MODE_ENG_STR = "eng";
110 constexpr auto TRK_MODE_OFF_STR = "off";
111 constexpr auto TRK_MODE_AUTO_STR = "auto";
112
113
114 const std::unordered_map<short, std::string> TrkModeMap = {
118 };
119
120 constexpr auto CI_STAT_TRACK_MODE = "track_mode";
121 constexpr auto CI_STAT_ALPHA = "alpha";
122 constexpr auto CI_STAT_DELTA = "delta";
123
124
125
126
135
136 public:
137
143 AdcConfig(const std::string filename,
144 const std::string name);
145
150 AdcConfig(const std::string name);
151
155 virtual ~AdcConfig() = default;
156
160 void Init();
161
169 virtual void GetConfig(protocol::base::VectorVariant& params) const override;
170
171
180 virtual void GetMotorConfig(protocol::base::VectorVariant& params) const;
181
182 virtual void GetMotorConfig(const std::string motor, protocol::base::VectorVariant& params) const;
183
184 virtual void SetScaleFactor(const std::string motor, double scale_factor);
185
186
191 double GetNpTolerance() const;
192
202 virtual void GetConfigList(utils::bat::DbVector& cfg_list,
203 std::string prefix) const override;
204
205
210 virtual std::string GetMotorMapFile() const;
211
216 virtual std::string GetMotorType() const;
217
222 std::string GetMotorPrefix(const int& index) const;
223 std::string GetMotorPrefix(const std::string& motor) const;
224 std::string GetMotorName(const int& index) const;
225
226 void GetMotorNames(std::vector<std::string>& motor_names) const;
227
228 void GetMotorPrefixes(std::vector<std::string>& motor_prefixes) const;
229
230 double GetMotorVelocity(const int axis_num) const;
231
232 double GetMotorScaleFactor(const int axis_num) const;
233
234 double GetMotorScaleFactor(const std::string motor_name) const;
235
236 std::string GetMotorName(const std::string nodeid) const;
237
238 protected:
239
240
242
243
244
246 std::map<std::string, std::unique_ptr<fcf::devmgr::motor::MotorConfig>> m_motor_config_map;
247
250 std::map<std::string, std::string> m_motor_prefix_map;
251
252 private:
253 log4cplus::Logger m_logger;
254 };
255
256} //namespace
257
258#endif //FCF_DEVMGR_DEVICE_ADC_CONFIG_H
AdcHwErrors header file.
AdcRpcErrors header file.
adc Configuration class
Definition: adcConfig.hpp:134
double GetMotorVelocity(const int axis_num) const
Definition: adcConfig.cpp:227
virtual ~AdcConfig()=default
DeviceConfig destructor.
std::map< std::string, std::unique_ptr< fcf::devmgr::motor::MotorConfig > > m_motor_config_map
Maps of ADC axes configuration.
Definition: adcConfig.hpp:246
virtual std::string GetMotorType() const
Definition: adcConfig.cpp:152
void Init()
Define configuration parameters for adc device.
Definition: adcConfig.cpp:46
double GetNpTolerance() const
Get named position tolerance.
Definition: adcConfig.cpp:302
void GetMotorNames(std::vector< std::string > &motor_names) const
Definition: adcConfig.cpp:205
virtual void GetMotorConfig(protocol::base::VectorVariant &params) const
Obtain the list of ADC motor configuration parameters.
Definition: adcConfig.cpp:101
virtual void GetConfigList(utils::bat::DbVector &cfg_list, std::string prefix) const override
Get configuration list.
Definition: adcConfig.cpp:118
virtual void SetScaleFactor(const std::string motor, double scale_factor)
Definition: adcConfig.cpp:219
std::map< std::string, std::string > m_motor_prefix_map
Definition: adcConfig.hpp:250
std::string GetMotorName(const int &index) const
Definition: adcConfig.cpp:194
int m_num_axis
Definition: adcConfig.hpp:241
double GetMotorScaleFactor(const int axis_num) const
Definition: adcConfig.cpp:256
virtual void GetConfig(protocol::base::VectorVariant &params) const override
Obtain the list of configuration parameters.
Definition: adcConfig.cpp:90
std::string GetMotorPrefix(const int &index) const
Definition: adcConfig.cpp:163
virtual std::string GetMotorMapFile() const
Definition: adcConfig.cpp:134
void GetMotorPrefixes(std::vector< std::string > &motor_prefixes) const
Definition: adcConfig.cpp:212
Device Configuration class.
Definition: deviceConfig.hpp:126
DataContext class header file.
MotorConfig class header file.
Definition: adc.cpp:20
constexpr auto CI_MOT2_COFFSET
Definition: adcConfig.hpp:59
constexpr auto CI_STAT_AUTO
Definition: adcConfig.hpp:33
constexpr auto CI_MOT1_REF_OFF
Definition: adcConfig.hpp:54
constexpr auto CI_STAT_DELTA
Definition: adcConfig.hpp:122
constexpr auto CI_MOT1_COFFSET
Definition: adcConfig.hpp:58
constexpr auto CI_MOT2_SIGN_OFF
Definition: adcConfig.hpp:49
constexpr auto CI_TSLOPE
Definition: adcConfig.hpp:42
constexpr auto CI_AFACTOR
Definition: adcConfig.hpp:44
constexpr auto SUBSTATE_OP_PRESETTING_STR
Definition: adcConfig.hpp:83
constexpr int SUBSTATE_ENABLING
Definition: adcConfig.hpp:75
constexpr auto CI_MOT2_DROTFACTOR
Definition: adcConfig.hpp:63
constexpr short TRK_MODE_AUTO
Definition: adcConfig.hpp:106
const std::unordered_map< short, std::string > SubstateMap
Definition: adcConfig.hpp:87
constexpr auto CI_LONGITUDE
Definition: adcConfig.hpp:36
constexpr auto CI_MINELEV
Definition: adcConfig.hpp:46
constexpr auto SUBSTATE_RESETTING_STR
Definition: adcConfig.hpp:80
constexpr auto SUBSTATE_OP_TRACKING_STR
Definition: adcConfig.hpp:82
constexpr auto CI_TRK_THRESHOLD
Definition: adcConfig.hpp:38
constexpr short TRK_MODE_ENG
Definition: adcConfig.hpp:104
constexpr auto CI_MOT1_SIGN_PHI
Definition: adcConfig.hpp:52
constexpr auto RPC_START_TRACK
Definition: adcConfig.hpp:68
constexpr int SUBSTATE_RESETTING
Definition: adcConfig.hpp:74
constexpr auto CI_STAT_TRACK_MODE
Definition: adcConfig.hpp:120
constexpr auto CI_AXES
Definition: adcConfig.hpp:29
constexpr int SUBSTATE_OP_TRACKING
Definition: adcConfig.hpp:77
constexpr auto CI_DIR_SIGN
Definition: adcConfig.hpp:31
constexpr auto TRK_MODE_AUTO_STR
Definition: adcConfig.hpp:111
constexpr auto RPC_MOVE_ANGLE
Definition: adcConfig.hpp:67
constexpr auto CI_MOT2_POSOFFSET
Definition: adcConfig.hpp:61
constexpr auto CI_STAT_ALPHA
Definition: adcConfig.hpp:121
constexpr auto CI_ZDLIMIT
Definition: adcConfig.hpp:45
constexpr int SUBSTATE_OP_PRESETTING
Definition: adcConfig.hpp:78
constexpr auto CI_MOT2_REF_OFF
Definition: adcConfig.hpp:55
const std::unordered_map< short, std::string > TrkModeMap
Definition: adcConfig.hpp:114
constexpr auto CI_MOT1_DROTFACTOR
Definition: adcConfig.hpp:62
constexpr auto CI_MOT1_REF_AUTO
Definition: adcConfig.hpp:56
constexpr auto CI_MOT2_SIGN_PHI
Definition: adcConfig.hpp:53
constexpr auto RPC_STOP_TRACK
Definition: adcConfig.hpp:69
constexpr auto CI_PSLOPE
Definition: adcConfig.hpp:40
constexpr short TRK_MODE_OFF
Definition: adcConfig.hpp:105
constexpr auto CI_MOT1_SIGN_AUTO
Definition: adcConfig.hpp:50
constexpr auto CI_MOTOR_MAP_FILE
Definition: adcConfig.hpp:27
constexpr auto SUBSTATE_ENABLING_STR
Definition: adcConfig.hpp:81
constexpr auto CI_FOCUS_SIGN
Definition: adcConfig.hpp:30
constexpr auto CI_MOT2_REF_AUTO
Definition: adcConfig.hpp:57
constexpr auto LOGGER_NAME
Definition: adcConfig.hpp:24
constexpr auto CI_MOT1_SIGN_OFF
Definition: adcConfig.hpp:48
constexpr auto CI_TRK_PERIOD
Definition: adcConfig.hpp:37
constexpr auto CI_POFFSET
Definition: adcConfig.hpp:41
constexpr auto CI_LATITUDE
Definition: adcConfig.hpp:35
constexpr auto CI_MOT2_SIGN_AUTO
Definition: adcConfig.hpp:51
constexpr auto TRK_MODE_OFF_STR
Definition: adcConfig.hpp:110
constexpr auto CI_MOT1_POSOFFSET
Definition: adcConfig.hpp:60
constexpr auto CI_STAT_REF
Definition: adcConfig.hpp:32
constexpr auto TRK_MODE_ENG_STR
Definition: adcConfig.hpp:109
constexpr auto CI_TOFFSET
Definition: adcConfig.hpp:43
constexpr int SUBSTATE_OP_ERROR
Definition: deviceConfig.hpp:108
constexpr int SUBSTATE_INITIALISING
Definition: deviceConfig.hpp:99
constexpr int SUBSTATE_READY
Definition: deviceConfig.hpp:98
constexpr auto SUBSTATE_OP_ERROR_STR
Definition: deviceConfig.hpp:111
constexpr auto SUBSTATE_ERROR_STR
Definition: deviceConfig.hpp:105
constexpr int SUBSTATE_ERROR
Definition: deviceConfig.hpp:100
constexpr int SUBSTATE_NOTREADY
Definition: deviceConfig.hpp:97
constexpr auto SUBSTATE_NOTREADY_STR
Definition: deviceConfig.hpp:102
constexpr auto SUBSTATE_READY_STR
Definition: deviceConfig.hpp:104
constexpr int SUBSTATE_OP_DISABLING
Definition: deviceConfig.hpp:107
constexpr auto SUBSTATE_INITIALISING_STR
Definition: deviceConfig.hpp:103
constexpr auto SUBSTATE_OP_DISABLING_STR
Definition: deviceConfig.hpp:110
constexpr auto SUBSTATE_OP_MOVING_STR
Definition: motorBaseConfig.hpp:64
constexpr auto SUBSTATE_OP_STANDSTILL_STR
Definition: motorBaseConfig.hpp:63
constexpr auto SUBSTATE_OP_STOPPING_STR
Definition: motorBaseConfig.hpp:66
constexpr auto SUBSTATE_ABORTING_STR
Definition: motorBaseConfig.hpp:62
constexpr int SUBSTATE_OP_STANDSTILL
Definition: motorBaseConfig.hpp:56
constexpr int SUBSTATE_OP_STOPPING
Definition: motorBaseConfig.hpp:59
constexpr int SUBSTATE_ABORTING
Definition: motorBaseConfig.hpp:55
constexpr int SUBSTATE_OP_MOVING
Definition: motorBaseConfig.hpp:57