ifw-fcf 6.0.0
Loading...
Searching...
No Matches
maxisConfig.hpp
Go to the documentation of this file.
1
9#ifndef FCF_DEVMGR_DEVICE_MAXIS_CONFIG_HPP
10#define FCF_DEVMGR_DEVICE_MAXIS_CONFIG_HPP
11
12#include <string>
13#include <yaml-cpp/yaml.h>
14
15#include <utils/bat/logger.hpp>
20
21namespace fcf::devmgr::maxis {
22
23 constexpr auto LOGGER_NAME = "maxis";
24 // Constants for internal mapping
25 constexpr auto CI_MOTOR_MAP_FILE = "mapMotorFile";
26
27 constexpr auto CI_AXES = "motors";
28 constexpr auto CI_FOCUS_SIGN = "focus_sign";
29 constexpr auto CI_DIR_SIGN = "dir_sign";
30 constexpr auto CI_STAT_REF = "off_ref";
31 constexpr auto CI_STAT_AUTO = "auto_ref";
32 constexpr auto CI_MODES = "modes";
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 // Specific MAxis RPC
40 constexpr auto RPC_MOVE_ANGLE = "rpcMoveAngle";
41 constexpr auto RPC_START_TRACK = "rpcStartTrack";
42 constexpr auto RPC_STOP_TRACK = "rpcStopTrack";
43 constexpr auto RPC_TRACK_OFFSET = "rpcTrackOffset";
44
45
46 // Specific constant values for MAxis device state/substate
47
48 constexpr int SUBSTATE_RESETTING = 109;
49 constexpr int SUBSTATE_ENABLING = 110;
50
51 constexpr int SUBSTATE_OP_TRACKING = 220;
52 constexpr int SUBSTATE_OP_PRESETTING = 221;
53
54 constexpr auto SUBSTATE_RESETTING_STR = "Resetting";
55 constexpr auto SUBSTATE_ENABLING_STR = "Enabling";
56 constexpr auto SUBSTATE_OP_TRACKING_STR = "Tracking";
57 constexpr auto SUBSTATE_OP_PRESETTING_STR = "Presetting";
58
59
60
61 const std::unordered_map<short, std::string> SubstateMap = {
76 };
77
78 constexpr short TRK_MODE_ENG = 0;
79 constexpr short TRK_MODE_OFF = 1;
80 constexpr short TRK_MODE_AUTO = 2;
81
82
83 constexpr auto TRK_MODE_ENG_STR = "eng";
84 constexpr auto TRK_MODE_OFF_STR = "off";
85 constexpr auto TRK_MODE_AUTO_STR = "auto";
86
87
88 const std::unordered_map<short, std::string> TrkModeMap = {
92 };
93
94 constexpr auto CI_STAT_TRACK_MODE = "track_mode";
95
104
105 public:
106
112 MAxisConfig(const std::string filename,
113 const std::string name);
114
119 MAxisConfig(const std::string name);
120
124 virtual ~MAxisConfig() = default;
125
129 void Init();
130
138 virtual void GetConfig(protocol::base::VectorVariant& params) const override;
139
140
149 virtual void GetMotorConfig(protocol::base::VectorVariant& params) const;
150
151 virtual void GetMotorConfig(const std::string motor, protocol::base::VectorVariant& params) const;
152
153 virtual void SetScaleFactor(const std::string motor, double scale_factor);
154
159 double GetNpTolerance() const;
160 std::optional<short> GetModeIndex(const std::string& name) const;
161 std::optional<std::string> GetModeStr(const short& mode) const;
162 bool FindMode(const std::string& name) const;
163
173 virtual void GetConfigList(utils::bat::DbVector& cfg_list,
174 std::string prefix) const override;
175
176
181 virtual std::string GetMotorMapFile() const;
182
187 virtual std::string GetMotorType() const;
188
193 std::string GetMotorPrefix(const int& index) const;
194 std::string GetMotorPrefix(const std::string& motor) const;
195 std::optional<int> GetMotorIndex(const std::string& motor) const;
196 std::string GetMotorName(const int& index) const;
197
198 void GetMotorNames(std::vector<std::string>& motor_names) const;
199
200 void GetMotorPrefixes(std::vector<std::string>& motor_prefixes) const;
201
202 double GetMotorVelocity(const int axis_num) const;
203
204 double GetMotorScaleFactor(const int axis_num) const;
205
206 double GetMotorScaleFactor(const std::string motor_name) const;
207
208 std::string GetMotorName(const std::string nodeid) const;
209
210 protected:
211
214
216 std::map<std::string, std::unique_ptr<fcf::devmgr::motor::MotorConfig>> m_motor_config_map;
217
220 std::map<std::string, std::string> m_motor_prefix_map;
221
222 private:
223 log4cplus::Logger m_logger;
224 };
225
226} //namespace
227
228#endif //FCF_DEVMGR_DEVICE_MAXIS_CONFIG_H
Device Configuration class.
Definition: deviceConfig.hpp:126
adc Configuration class
Definition: maxisConfig.hpp:103
std::string GetMotorName(const int &index) const
Definition: maxisConfig.cpp:193
bool FindMode(const std::string &name) const
Definition: maxisConfig.cpp:328
std::map< std::string, std::unique_ptr< fcf::devmgr::motor::MotorConfig > > m_motor_config_map
Maps of multi axis configuration.
Definition: maxisConfig.hpp:216
double GetNpTolerance() const
Get named position tolerance.
Definition: maxisConfig.cpp:338
void GetMotorPrefixes(std::vector< std::string > &motor_prefixes) const
Definition: maxisConfig.cpp:210
void Init()
Define configuration parameters for adc device.
Definition: maxisConfig.cpp:44
std::optional< short > GetModeIndex(const std::string &name) const
Definition: maxisConfig.cpp:301
virtual void SetScaleFactor(const std::string motor, double scale_factor)
Definition: maxisConfig.cpp:217
double GetMotorVelocity(const int axis_num) const
Definition: maxisConfig.cpp:225
std::string GetMotorPrefix(const int &index) const
Definition: maxisConfig.cpp:144
virtual ~MAxisConfig()=default
DeviceConfig destructor.
int m_num_axis
Store number of axes. The number comes from the configuration of the device.
Definition: maxisConfig.hpp:213
virtual void GetMotorConfig(protocol::base::VectorVariant &params) const
Obtain the list of ADC motor configuration parameters.
Definition: maxisConfig.cpp:88
virtual void GetConfig(protocol::base::VectorVariant &params) const override
Obtain the list of configuration parameters.
Definition: maxisConfig.cpp:79
virtual void GetConfigList(utils::bat::DbVector &cfg_list, std::string prefix) const override
Get configuration list.
Definition: maxisConfig.cpp:105
double GetMotorScaleFactor(const int axis_num) const
Definition: maxisConfig.cpp:254
virtual std::string GetMotorType() const
Definition: maxisConfig.cpp:133
virtual std::string GetMotorMapFile() const
Definition: maxisConfig.cpp:115
void GetMotorNames(std::vector< std::string > &motor_names) const
Definition: maxisConfig.cpp:203
std::optional< int > GetMotorIndex(const std::string &motor) const
Definition: maxisConfig.cpp:174
std::map< std::string, std::string > m_motor_prefix_map
Definition: maxisConfig.hpp:220
std::optional< std::string > GetModeStr(const short &mode) const
Definition: maxisConfig.cpp:315
DataContext class header file.
MAxisHwErrors header file.
MAxisRpcErrors header file.
MotorConfig class header file.
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
Definition: maxis.hpp:18
constexpr auto SUBSTATE_RESETTING_STR
Definition: maxisConfig.hpp:54
constexpr auto CI_MODES
Definition: maxisConfig.hpp:32
constexpr auto CI_DIR_SIGN
Definition: maxisConfig.hpp:29
constexpr short TRK_MODE_OFF
Definition: maxisConfig.hpp:79
constexpr auto CI_AXES
Definition: maxisConfig.hpp:27
constexpr auto SUBSTATE_ENABLING_STR
Definition: maxisConfig.hpp:55
constexpr auto CI_TRK_THRESHOLD
Definition: maxisConfig.hpp:37
constexpr auto RPC_MOVE_ANGLE
Definition: maxisConfig.hpp:40
constexpr auto LOGGER_NAME
Definition: maxisConfig.hpp:23
constexpr auto CI_MOTOR_MAP_FILE
Definition: maxisConfig.hpp:25
constexpr auto CI_LONGITUDE
Definition: maxisConfig.hpp:35
constexpr auto CI_STAT_REF
Definition: maxisConfig.hpp:30
constexpr auto RPC_TRACK_OFFSET
Definition: maxisConfig.hpp:43
constexpr int SUBSTATE_OP_PRESETTING
Definition: maxisConfig.hpp:52
constexpr short TRK_MODE_ENG
Definition: maxisConfig.hpp:78
constexpr auto SUBSTATE_OP_TRACKING_STR
Definition: maxisConfig.hpp:56
constexpr auto CI_STAT_TRACK_MODE
Definition: maxisConfig.hpp:94
constexpr int SUBSTATE_OP_TRACKING
Definition: maxisConfig.hpp:51
constexpr auto RPC_START_TRACK
Definition: maxisConfig.hpp:41
constexpr auto CI_FOCUS_SIGN
Definition: maxisConfig.hpp:28
const std::unordered_map< short, std::string > SubstateMap
Definition: maxisConfig.hpp:61
constexpr auto RPC_STOP_TRACK
Definition: maxisConfig.hpp:42
constexpr int SUBSTATE_ENABLING
Definition: maxisConfig.hpp:49
constexpr int SUBSTATE_RESETTING
Definition: maxisConfig.hpp:48
constexpr auto SUBSTATE_OP_PRESETTING_STR
Definition: maxisConfig.hpp:57
constexpr auto CI_TRK_PERIOD
Definition: maxisConfig.hpp:36
constexpr auto TRK_MODE_OFF_STR
Definition: maxisConfig.hpp:84
constexpr auto TRK_MODE_ENG_STR
Definition: maxisConfig.hpp:83
constexpr auto CI_LATITUDE
Definition: maxisConfig.hpp:34
constexpr short TRK_MODE_AUTO
Definition: maxisConfig.hpp:80
constexpr auto CI_STAT_AUTO
Definition: maxisConfig.hpp:31
const std::unordered_map< short, std::string > TrkModeMap
Definition: maxisConfig.hpp:88
constexpr auto TRK_MODE_AUTO_STR
Definition: maxisConfig.hpp:85
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