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