ifw-fcf  4.1.0-pre2
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 #include "fcf/common/iComm.hpp"
15 
16 #include <utils/bat/logger.hpp>
22 
23 namespace fcf::devmgr::adc {
24 
25 
26  constexpr auto LOGGER_NAME = "adc";
27  // Constants for internal mapping
28  // Specifics Adc status values
29  constexpr auto CI_MOTOR_MAP_FILE = "mapMotorFile";
30 
31  constexpr auto CI_AXES = "motors";
32  constexpr auto CI_FOCUS_SIGN = "focus_sign";
33  constexpr auto CI_DIR_SIGN = "dir_sign";
34  constexpr auto CI_STAT_REF = "off_ref";
35  constexpr auto CI_STAT_AUTO = "auto_ref";
36 
37  constexpr auto CI_LATITUDE = "latitude";
38  constexpr auto CI_LONGITUDE = "longitude";
39  constexpr auto CI_TRK_PERIOD = "trk_period";
40  constexpr auto CI_TRK_THRESHOLD = "trk_threshold";
41 
42  constexpr auto CI_PSLOPE = "pslope";
43  constexpr auto CI_POFFSET = "poffset";
44  constexpr auto CI_TSLOPE = "tslope";
45  constexpr auto CI_TOFFSET = "toffset";
46  constexpr auto CI_AFACTOR = "afactor";
47  constexpr auto CI_ZDLIMIT = "zdlimit";
48  constexpr auto CI_MINELEV = "minelev";
49 
50  constexpr auto CI_MOT1_SIGN_OFF = "mot1_signoff";
51  constexpr auto CI_MOT2_SIGN_OFF = "mot2_signoff";
52  constexpr auto CI_MOT1_SIGN_AUTO = "mot1_signauto";
53  constexpr auto CI_MOT2_SIGN_AUTO = "mot2_signauto";
54  constexpr auto CI_MOT1_SIGN_PHI = "mot1_signphi";
55  constexpr auto CI_MOT2_SIGN_PHI = "mot2_signphi";
56  constexpr auto CI_MOT1_REF_OFF = "mot1_refoff";
57  constexpr auto CI_MOT2_REF_OFF = "mot2_refoff";
58  constexpr auto CI_MOT1_REF_AUTO = "mot1_refauto";
59  constexpr auto CI_MOT2_REF_AUTO = "mot2_refauto";
60  constexpr auto CI_MOT1_COFFSET = "mot1_coffset";
61  constexpr auto CI_MOT2_COFFSET = "mot2_coffset";
62  constexpr auto CI_MOT1_POSOFFSET = "mot1_poffset";
63  constexpr auto CI_MOT2_POSOFFSET = "mot2_poffset";
64  constexpr auto CI_MOT1_DROTFACTOR = "mot1_drotfactor";
65  constexpr auto CI_MOT2_DROTFACTOR = "mot2_drotfactor";
66 
67 
68  // Specific Adc RPC
69  constexpr auto RPC_MOVE_ANGLE = "rpcMoveAngle";
70  constexpr auto RPC_START_TRACK = "rpcStartTrack";
71  constexpr auto RPC_STOP_TRACK = "rpcStopTrack";
72 
73 
74  // Specific constant values for Adc device state/substate
75 
76  constexpr int SUBSTATE_RESETTING = 109;
77  constexpr int SUBSTATE_ENABLING = 110;
78 
79  constexpr int SUBSTATE_OP_TRACKING = 220;
80  constexpr int SUBSTATE_OP_PRESETTING = 221;
81 
82  constexpr auto SUBSTATE_RESETTING_STR = "Resetting";
83  constexpr auto SUBSTATE_ENABLING_STR = "Enabling";
84  constexpr auto SUBSTATE_OP_TRACKING_STR = "Tracking";
85  constexpr auto SUBSTATE_OP_PRESETTING_STR = "Presetting";
86 
87 
88 
89  const std::unordered_map<short, std::string> SubstateMap = {
104  };
105 
106  constexpr short TRK_MODE_ENG = 0;
107  constexpr short TRK_MODE_OFF = 1;
108  constexpr short TRK_MODE_AUTO = 2;
109 
110 
111  constexpr auto TRK_MODE_ENG_STR = "eng";
112  constexpr auto TRK_MODE_OFF_STR = "off";
113  constexpr auto TRK_MODE_AUTO_STR = "auto";
114 
115 
116  const std::unordered_map<short, std::string> TrkModeMap = {
120  };
121 
122  constexpr auto CI_STAT_TRACK_MODE = "track_mode";
123  constexpr auto CI_STAT_ALPHA = "alpha";
124  constexpr auto CI_STAT_DELTA = "delta";
125 
126 
127 
128 
137 
138  public:
139 
145  AdcConfig(const std::string filename,
146  const std::string name);
147 
152  AdcConfig(const std::string name);
153 
157  virtual ~AdcConfig() = default;
158 
162  void Init();
163 
171  virtual void GetConfig(fcf::common::VectorVariant& params) const override;
172 
173 
182  virtual void GetMotorConfig(fcf::common::VectorVariant& params) const;
183 
184  virtual void GetMotorConfig(const std::string motor, fcf::common::VectorVariant& params) const;
185 
186  virtual void SetScaleFactor(const std::string motor, double scale_factor);
187 
188 
193  double GetNpTolerance() const;
194 
204  virtual void GetConfigList(utils::bat::DbVector& cfg_list,
205  std::string prefix) const override;
206 
207 
212  virtual std::string GetMotorMapFile() const;
213 
218  virtual std::string GetMotorType() const;
219 
224  std::string GetMotorPrefix(const int& index) const;
225  std::string GetMotorPrefix(const std::string& motor) const;
226  std::string GetMotorName(const int& index) const;
227 
228  void GetMotorNames(std::vector<std::string>& motor_names) const;
229 
230  void GetMotorPrefixes(std::vector<std::string>& motor_prefixes) const;
231 
232  double GetMotorVelocity(const int axis_num) const;
233 
234  double GetMotorScaleFactor(const int axis_num) const;
235 
236  double GetMotorScaleFactor(const std::string motor_name) const;
237 
238  std::string GetMotorName(const std::string nodeid) const;
239 
240  protected:
241 
242 
244 
245 
246 
248  std::map<std::string, std::unique_ptr<fcf::devmgr::motor::MotorConfig>> m_motor_config_map;
249 
252  std::map<std::string, std::string> m_motor_prefix_map;
253 
254  private:
255  log4cplus::Logger m_logger;
256  };
257 
258 } //namespace
259 
260 #endif //FCF_DEVMGR_DEVICE_ADC_CONFIG_H
fcf::devmgr::motor::SUBSTATE_OP_MOVING_STR
constexpr auto SUBSTATE_OP_MOVING_STR
Definition: motorBaseConfig.hpp:66
fcf::devmgr::adc::CI_MOT2_SIGN_AUTO
constexpr auto CI_MOT2_SIGN_AUTO
Definition: adcConfig.hpp:53
fcf::devmgr::adc::CI_MOT1_SIGN_PHI
constexpr auto CI_MOT1_SIGN_PHI
Definition: adcConfig.hpp:54
fcf::devmgr::adc::SUBSTATE_OP_PRESETTING
constexpr int SUBSTATE_OP_PRESETTING
Definition: adcConfig.hpp:80
dataContext.hpp
DataContext class header file.
fcf::devmgr::adc::AdcConfig::m_motor_prefix_map
std::map< std::string, std::string > m_motor_prefix_map
Definition: adcConfig.hpp:252
fcf::devmgr::adc::CI_MINELEV
constexpr auto CI_MINELEV
Definition: adcConfig.hpp:48
fcf::devmgr::adc::CI_MOT1_REF_OFF
constexpr auto CI_MOT1_REF_OFF
Definition: adcConfig.hpp:56
fcf::devmgr::adc::AdcConfig
adc Configuration class
Definition: adcConfig.hpp:136
fcf::devmgr::adc::AdcConfig::~AdcConfig
virtual ~AdcConfig()=default
DeviceConfig destructor.
fcf::devmgr::adc::AdcConfig::GetNpTolerance
double GetNpTolerance() const
Get named position tolerance.
Definition: adcConfig.cpp:304
fcf::devmgr::adc::AdcConfig::GetConfigList
virtual void GetConfigList(utils::bat::DbVector &cfg_list, std::string prefix) const override
Get configuration list.
Definition: adcConfig.cpp:120
fcf::devmgr::adc::AdcConfig::GetMotorConfig
virtual void GetMotorConfig(fcf::common::VectorVariant &params) const
Obtain the list of ADC motor configuration parameters.
Definition: adcConfig.cpp:103
fcf::devmgr::adc::CI_MOT2_COFFSET
constexpr auto CI_MOT2_COFFSET
Definition: adcConfig.hpp:61
fcf::devmgr::adc::AdcConfig::m_motor_config_map
std::map< std::string, std::unique_ptr< fcf::devmgr::motor::MotorConfig > > m_motor_config_map
Maps of ADC axes configuration.
Definition: adcConfig.hpp:248
fcf::devmgr::adc::CI_ZDLIMIT
constexpr auto CI_ZDLIMIT
Definition: adcConfig.hpp:47
fcf::devmgr::adc::AdcConfig::GetMotorNames
void GetMotorNames(std::vector< std::string > &motor_names) const
Definition: adcConfig.cpp:207
fcf::devmgr::common::SUBSTATE_OP_DISABLING_STR
constexpr auto SUBSTATE_OP_DISABLING_STR
Definition: deviceConfig.hpp:111
fcf::devmgr::adc::CI_MOT2_SIGN_PHI
constexpr auto CI_MOT2_SIGN_PHI
Definition: adcConfig.hpp:55
fcf::devmgr::adc::CI_TRK_PERIOD
constexpr auto CI_TRK_PERIOD
Definition: adcConfig.hpp:39
fcf::devmgr::adc::AdcConfig::GetMotorName
std::string GetMotorName(const int &index) const
Definition: adcConfig.cpp:196
fcf::devmgr::motor::SUBSTATE_OP_MOVING
constexpr int SUBSTATE_OP_MOVING
Definition: motorBaseConfig.hpp:59
fcf::devmgr::adc::CI_MOT2_REF_OFF
constexpr auto CI_MOT2_REF_OFF
Definition: adcConfig.hpp:57
fcf::devmgr::adc::AdcConfig::GetMotorPrefixes
void GetMotorPrefixes(std::vector< std::string > &motor_prefixes) const
Definition: adcConfig.cpp:214
fcf::devmgr::adc::LOGGER_NAME
constexpr auto LOGGER_NAME
Definition: adcConfig.hpp:26
fcf::devmgr::adc::CI_STAT_AUTO
constexpr auto CI_STAT_AUTO
Definition: adcConfig.hpp:35
fcf::devmgr::adc::CI_MOT2_DROTFACTOR
constexpr auto CI_MOT2_DROTFACTOR
Definition: adcConfig.hpp:65
fcf::devmgr::adc::AdcConfig::GetMotorType
virtual std::string GetMotorType() const
Definition: adcConfig.cpp:154
fcf::devmgr::adc::AdcConfig::AdcConfig
AdcConfig(const std::string filename, const std::string name)
DeviceConfig constructor.
Definition: adcConfig.cpp:29
fcf::devmgr::adc::AdcConfig::GetConfig
virtual void GetConfig(fcf::common::VectorVariant &params) const override
Obtain the list of configuration parameters.
Definition: adcConfig.cpp:92
fcf::devmgr::motor::SUBSTATE_ABORTING
constexpr int SUBSTATE_ABORTING
Definition: motorBaseConfig.hpp:57
fcf::devmgr::adc::TrkModeMap
const std::unordered_map< short, std::string > TrkModeMap
Definition: adcConfig.hpp:116
fcf::devmgr::adc::CI_TSLOPE
constexpr auto CI_TSLOPE
Definition: adcConfig.hpp:44
fcf::devmgr::adc::CI_STAT_REF
constexpr auto CI_STAT_REF
Definition: adcConfig.hpp:34
fcf::devmgr::adc::SUBSTATE_RESETTING_STR
constexpr auto SUBSTATE_RESETTING_STR
Definition: adcConfig.hpp:82
fcf::devmgr::adc::CI_PSLOPE
constexpr auto CI_PSLOPE
Definition: adcConfig.hpp:42
fcf::devmgr::adc::CI_MOT1_SIGN_AUTO
constexpr auto CI_MOT1_SIGN_AUTO
Definition: adcConfig.hpp:52
fcf::devmgr::adc::SUBSTATE_OP_PRESETTING_STR
constexpr auto SUBSTATE_OP_PRESETTING_STR
Definition: adcConfig.hpp:85
fcf::devmgr::motor::SUBSTATE_OP_STANDSTILL_STR
constexpr auto SUBSTATE_OP_STANDSTILL_STR
Definition: motorBaseConfig.hpp:65
fcf::devmgr::adc::CI_AXES
constexpr auto CI_AXES
Definition: adcConfig.hpp:31
fcf::devmgr::adc::CI_STAT_TRACK_MODE
constexpr auto CI_STAT_TRACK_MODE
Definition: adcConfig.hpp:122
fcf::devmgr::common::SUBSTATE_OP_DISABLING
constexpr int SUBSTATE_OP_DISABLING
Definition: deviceConfig.hpp:108
fcf::devmgr::adc::SUBSTATE_ENABLING
constexpr int SUBSTATE_ENABLING
Definition: adcConfig.hpp:77
fcf::devmgr::adc::CI_MOT2_SIGN_OFF
constexpr auto CI_MOT2_SIGN_OFF
Definition: adcConfig.hpp:51
fcf::devmgr::adc
Definition: adc.cpp:20
fcf::devmgr::adc::TRK_MODE_ENG
constexpr short TRK_MODE_ENG
Definition: adcConfig.hpp:106
fcf::devmgr::adc::CI_TRK_THRESHOLD
constexpr auto CI_TRK_THRESHOLD
Definition: adcConfig.hpp:40
fcf::devmgr::adc::CI_LONGITUDE
constexpr auto CI_LONGITUDE
Definition: adcConfig.hpp:38
fcf::devmgr::common::SUBSTATE_NOTREADY_STR
constexpr auto SUBSTATE_NOTREADY_STR
Definition: deviceConfig.hpp:103
configSet.hpp
configSet class header file.
fcf::devmgr::adc::CI_MOT1_POSOFFSET
constexpr auto CI_MOT1_POSOFFSET
Definition: adcConfig.hpp:62
fcf::devmgr::common::SUBSTATE_INITIALISING_STR
constexpr auto SUBSTATE_INITIALISING_STR
Definition: deviceConfig.hpp:104
fcf::devmgr::adc::CI_MOT1_SIGN_OFF
constexpr auto CI_MOT1_SIGN_OFF
Definition: adcConfig.hpp:50
fcf::devmgr::adc::CI_MOT2_POSOFFSET
constexpr auto CI_MOT2_POSOFFSET
Definition: adcConfig.hpp:63
fcf::devmgr::adc::TRK_MODE_OFF_STR
constexpr auto TRK_MODE_OFF_STR
Definition: adcConfig.hpp:112
fcf::devmgr::adc::CI_MOT1_DROTFACTOR
constexpr auto CI_MOT1_DROTFACTOR
Definition: adcConfig.hpp:64
fcf::devmgr::common::SUBSTATE_NOTREADY
constexpr int SUBSTATE_NOTREADY
Definition: deviceConfig.hpp:98
fcf::devmgr::adc::CI_STAT_DELTA
constexpr auto CI_STAT_DELTA
Definition: adcConfig.hpp:124
fcf::devmgr::common::SUBSTATE_INITIALISING
constexpr int SUBSTATE_INITIALISING
Definition: deviceConfig.hpp:100
fcf::devmgr::adc::CI_MOT1_COFFSET
constexpr auto CI_MOT1_COFFSET
Definition: adcConfig.hpp:60
motor
Definition: __init__.py:1
fcf::devmgr::adc::SUBSTATE_OP_TRACKING_STR
constexpr auto SUBSTATE_OP_TRACKING_STR
Definition: adcConfig.hpp:84
fcf::devmgr::adc::RPC_STOP_TRACK
constexpr auto RPC_STOP_TRACK
Definition: adcConfig.hpp:71
fcf::devmgr::adc::TRK_MODE_AUTO_STR
constexpr auto TRK_MODE_AUTO_STR
Definition: adcConfig.hpp:113
fcf::devmgr::common::SUBSTATE_OP_ERROR
constexpr int SUBSTATE_OP_ERROR
Definition: deviceConfig.hpp:109
fcf::devmgr::adc::SUBSTATE_RESETTING
constexpr int SUBSTATE_RESETTING
Definition: adcConfig.hpp:76
fcf::devmgr::adc::CI_AFACTOR
constexpr auto CI_AFACTOR
Definition: adcConfig.hpp:46
fcf::devmgr::common::SUBSTATE_OP_ERROR_STR
constexpr auto SUBSTATE_OP_ERROR_STR
Definition: deviceConfig.hpp:112
fcf::devmgr::adc::CI_FOCUS_SIGN
constexpr auto CI_FOCUS_SIGN
Definition: adcConfig.hpp:32
fcf::devmgr::adc::TRK_MODE_AUTO
constexpr short TRK_MODE_AUTO
Definition: adcConfig.hpp:108
fcf::devmgr::adc::CI_TOFFSET
constexpr auto CI_TOFFSET
Definition: adcConfig.hpp:45
fcf::devmgr::adc::SubstateMap
const std::unordered_map< short, std::string > SubstateMap
Definition: adcConfig.hpp:89
fcf::devmgr::adc::CI_MOT1_REF_AUTO
constexpr auto CI_MOT1_REF_AUTO
Definition: adcConfig.hpp:58
fcf::devmgr::common::SUBSTATE_ERROR
constexpr int SUBSTATE_ERROR
Definition: deviceConfig.hpp:101
fcf::devmgr::adc::CI_LATITUDE
constexpr auto CI_LATITUDE
Definition: adcConfig.hpp:37
fcf::devmgr::adc::SUBSTATE_OP_TRACKING
constexpr int SUBSTATE_OP_TRACKING
Definition: adcConfig.hpp:79
fcf::devmgr::adc::TRK_MODE_ENG_STR
constexpr auto TRK_MODE_ENG_STR
Definition: adcConfig.hpp:111
fcf::devmgr::motor::SUBSTATE_ABORTING_STR
constexpr auto SUBSTATE_ABORTING_STR
Definition: motorBaseConfig.hpp:64
fcf::devmgr::adc::AdcConfig::Init
void Init()
Define configuration parameters for adc device.
Definition: adcConfig.cpp:48
fcf::devmgr::common::DeviceConfig
Device Configuration class.
Definition: deviceConfig.hpp:127
fcf::devmgr::adc::TRK_MODE_OFF
constexpr short TRK_MODE_OFF
Definition: adcConfig.hpp:107
fcf::devmgr::adc::AdcConfig::GetMotorScaleFactor
double GetMotorScaleFactor(const int axis_num) const
Definition: adcConfig.cpp:258
fcf::devmgr::adc::AdcConfig::SetScaleFactor
virtual void SetScaleFactor(const std::string motor, double scale_factor)
Definition: adcConfig.cpp:221
fcf::devmgr::adc::AdcConfig::GetMotorPrefix
std::string GetMotorPrefix(const int &index) const
Definition: adcConfig.cpp:165
fcf::devmgr::adc::AdcConfig::GetMotorVelocity
double GetMotorVelocity(const int axis_num) const
Definition: adcConfig.cpp:229
fcf::devmgr::adc::CI_POFFSET
constexpr auto CI_POFFSET
Definition: adcConfig.hpp:43
fcf::devmgr::common::SUBSTATE_READY_STR
constexpr auto SUBSTATE_READY_STR
Definition: deviceConfig.hpp:105
adcHwErrors.hpp
AdcHwErrors header file.
fcf::devmgr::common::SUBSTATE_READY
constexpr int SUBSTATE_READY
Definition: deviceConfig.hpp:99
adcRpcErrors.hpp
AdcRpcErrors header file.
fcf::devmgr::adc::SUBSTATE_ENABLING_STR
constexpr auto SUBSTATE_ENABLING_STR
Definition: adcConfig.hpp:83
fcf::devmgr::adc::AdcConfig::m_num_axis
int m_num_axis
Definition: adcConfig.hpp:243
fcf::devmgr::motor::SUBSTATE_OP_STOPPING
constexpr int SUBSTATE_OP_STOPPING
Definition: motorBaseConfig.hpp:61
fcf::devmgr::motor::SUBSTATE_OP_STOPPING_STR
constexpr auto SUBSTATE_OP_STOPPING_STR
Definition: motorBaseConfig.hpp:68
fcf::devmgr::common::SUBSTATE_ERROR_STR
constexpr auto SUBSTATE_ERROR_STR
Definition: deviceConfig.hpp:106
fcf::devmgr::adc::CI_MOTOR_MAP_FILE
constexpr auto CI_MOTOR_MAP_FILE
Definition: adcConfig.hpp:29
fcf::devmgr::adc::CI_STAT_ALPHA
constexpr auto CI_STAT_ALPHA
Definition: adcConfig.hpp:123
motorConfig.hpp
MotorConfig class header file.
fcf::devmgr::adc::AdcConfig::GetMotorMapFile
virtual std::string GetMotorMapFile() const
Definition: adcConfig.cpp:136
fcf::devmgr::adc::RPC_MOVE_ANGLE
constexpr auto RPC_MOVE_ANGLE
Definition: adcConfig.hpp:69
fcf::devmgr::adc::CI_DIR_SIGN
constexpr auto CI_DIR_SIGN
Definition: adcConfig.hpp:33
fcf::devmgr::motor::SUBSTATE_OP_STANDSTILL
constexpr int SUBSTATE_OP_STANDSTILL
Definition: motorBaseConfig.hpp:58
fcf::devmgr::adc::RPC_START_TRACK
constexpr auto RPC_START_TRACK
Definition: adcConfig.hpp:70
fcf::devmgr::adc::CI_MOT2_REF_AUTO
constexpr auto CI_MOT2_REF_AUTO
Definition: adcConfig.hpp:59