ifw-fcf 8.0.2
 
Loading...
Searching...
No Matches
maxisConfig.hpp
Go to the documentation of this file.
1
7
8#ifndef FCF_DEVMGR_DEVICE_MAXIS_CONFIG_HPP
9#define FCF_DEVMGR_DEVICE_MAXIS_CONFIG_HPP
10
11#include <string>
12#include <yaml-cpp/yaml.h>
13
14#include <ifw/core/utils/bat/logger.hpp>
19
20
22
23 constexpr auto LOGGER_NAME = "maxis";
24 // Constants for internal mapping
25 constexpr auto CI_MOTOR_MAP_FILE = "mapMotorFile";
26 constexpr auto CI_AXES = "motors";
27 constexpr auto CI_POSITIONS = "positions";
28 constexpr auto CI_POS_NAME = "name";
29 constexpr auto CI_POS_VALUES = "values";
30
31
32 // Specific MAxis RPC
33 constexpr auto RPC_MOVE_AXES = "rpcMoveAxes";
34
35
36 // Specific constant values for MAxis device state/substate
37
38 constexpr int SUBSTATE_RESETTING = 109;
39 constexpr int SUBSTATE_ENABLING = 110;
40
41
42
43 constexpr auto SUBSTATE_RESETTING_STR = "Resetting";
44 constexpr auto SUBSTATE_ENABLING_STR = "Enabling";
45
46
47
48
63
72
73 public:
74
80 MAxisConfig(const std::string filename,
81 const std::string name);
82
87 MAxisConfig(const std::string name);
88
92 virtual ~MAxisConfig() = default;
93
97 void Init();
98
106 virtual void GetConfig(
107 std::vector<std::pair<std::string, ifw::fnd::defs::Value>>& params) const override;
108
109
118 virtual void GetMotorConfig(
119 std::vector<std::pair<std::string, ifw::fnd::defs::Value>>& params) const;
120
121 virtual void GetMotorConfig(
122 const std::string motor,
123 std::vector<std::pair<std::string, ifw::fnd::defs::Value>>& params) const;
124
125 virtual void SetScaleFactor(const std::string motor, double scale_factor);
126
131 double GetNpTolerance() const;
132
142 virtual void GetConfigList(ifw::core::utils::bat::DbVector& cfg_list,
143 std::string prefix) const override;
144
145
150 virtual std::string GetMotorMapFile() const;
151
156 virtual std::string GetMotorType() const;
157
162 std::string GetMotorPrefix(const int& index) const;
163 std::string GetMotorPrefix(const std::string& motor) const;
164 std::optional<int> GetMotorIndex(const std::string& motor) const;
165 std::string GetMotorName(const int& index) const;
166
167 void GetMotorNames(std::vector<std::string>& motor_names) const;
168
169 void GetMotorPrefixes(std::vector<std::string>& motor_prefixes) const;
170
171 double GetMotorVelocity(const int axis_num) const;
172
173 double GetMotorNamedPositionValue(const int axis_num, const std::string& posname) const;
174
175 double GetMotorScaleFactor(const int axis_num) const;
176
177 double GetMotorScaleFactor(const std::string motor_name) const;
178
179
180 std::string GetMotorName(const std::string nodeid) const;
181
182 inline long unsigned int GetNumAxes() const {return m_num_axis;};
183
189 std::optional<std::string> GetNamedPosition(const int index) const;
190
196 std::optional<std::vector<double>> GetNamedPositionValues(const int index) const;
197 std::optional<std::vector<double>> GetNamedPositionValues(const std::string& name) const;
198
199
200
201 private:
202
204 int m_num_axis;
205
207 std::map<std::string, std::unique_ptr<ifw::fcf::devmgr::motor::MotorConfig>> m_motor_config_map;
208
209 // Map of motor named positions
210 std::unordered_map<std::string, std::vector<double>> m_named_positions;
211
214 std::map<std::string, std::string> m_motor_prefix_map;
215
216 private:
217 log4cplus::Logger m_logger;
218 };
219
220} //namespace
221
222#endif //FCF_DEVMGR_DEVICE_MAXIS_CONFIG_H
Device Configuration class.
Definition deviceConfig.hpp:124
double GetMotorNamedPositionValue(const int axis_num, const std::string &posname) const
Definition maxisConfig.cpp:322
double GetMotorScaleFactor(const int axis_num) const
Definition maxisConfig.cpp:357
MAxisConfig(const std::string filename, const std::string name)
DeviceConfig constructor.
Definition maxisConfig.cpp:28
std::optional< std::vector< double > > GetNamedPositionValues(const int index) const
GetNamedPositionValue.
Definition maxisConfig.cpp:137
double GetMotorVelocity(const int axis_num) const
Definition maxisConfig.cpp:293
std::optional< int > GetMotorIndex(const std::string &motor) const
Definition maxisConfig.cpp:238
std::optional< std::string > GetNamedPosition(const int index) const
GetNamedPosition.
Definition maxisConfig.cpp:120
virtual ~MAxisConfig()=default
DeviceConfig destructor.
virtual void GetConfigList(ifw::core::utils::bat::DbVector &cfg_list, std::string prefix) const override
Get configuration list.
Definition maxisConfig.cpp:169
double GetNpTolerance() const
Get named position tolerance.
Definition maxisConfig.cpp:404
virtual void GetConfig(std::vector< std::pair< std::string, ifw::fnd::defs::Value > > &params) const override
Obtain the list of configuration parameters.
Definition maxisConfig.cpp:95
virtual void GetMotorConfig(std::vector< std::pair< std::string, ifw::fnd::defs::Value > > &params) const
Obtain the list of ADC motor configuration parameters.
Definition maxisConfig.cpp:103
long unsigned int GetNumAxes() const
Definition maxisConfig.hpp:182
virtual std::string GetMotorMapFile() const
Definition maxisConfig.cpp:179
void Init()
Define configuration parameters for adc device.
Definition maxisConfig.cpp:45
std::string GetMotorName(const int &index) const
Definition maxisConfig.cpp:261
virtual std::string GetMotorType() const
Definition maxisConfig.cpp:197
virtual void SetScaleFactor(const std::string motor, double scale_factor)
Definition maxisConfig.cpp:285
void GetMotorPrefixes(std::vector< std::string > &motor_prefixes) const
Definition maxisConfig.cpp:278
void GetMotorNames(std::vector< std::string > &motor_names) const
Definition maxisConfig.cpp:271
std::string GetMotorPrefix(const int &index) const
Definition maxisConfig.cpp:208
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
MAxis class header file.
Definition maxis.hpp:18
const std::unordered_map< short, std::string > SUBSTATE_MAP
Definition maxisConfig.hpp:49
constexpr auto LOGGER_NAME
Definition maxisConfig.hpp:23
constexpr auto SUBSTATE_ENABLING_STR
Definition maxisConfig.hpp:44
constexpr auto CI_MOTOR_MAP_FILE
Definition maxisConfig.hpp:25
constexpr auto CI_AXES
Definition maxisConfig.hpp:26
constexpr int SUBSTATE_RESETTING
Definition maxisConfig.hpp:38
constexpr auto CI_POSITIONS
Definition maxisConfig.hpp:27
constexpr auto CI_POS_VALUES
Definition maxisConfig.hpp:29
constexpr auto SUBSTATE_RESETTING_STR
Definition maxisConfig.hpp:43
constexpr int SUBSTATE_ENABLING
Definition maxisConfig.hpp:39
constexpr auto CI_POS_NAME
Definition maxisConfig.hpp:28
constexpr auto RPC_MOVE_AXES
Definition maxisConfig.hpp:33
constexpr auto SUBSTATE_OP_STANDSTILL_STR
Definition motorBaseConfig.hpp:57
constexpr auto SUBSTATE_ABORTING_STR
Definition motorBaseConfig.hpp:56
constexpr int SUBSTATE_OP_STOPPING
Definition motorBaseConfig.hpp:53
constexpr auto SUBSTATE_OP_MOVING_STR
Definition motorBaseConfig.hpp:58
constexpr auto SUBSTATE_OP_STOPPING_STR
Definition motorBaseConfig.hpp:60
constexpr int SUBSTATE_OP_STANDSTILL
Definition motorBaseConfig.hpp:50
constexpr int SUBSTATE_ABORTING
Definition motorBaseConfig.hpp:49
constexpr int SUBSTATE_OP_MOVING
Definition motorBaseConfig.hpp:51
Definition __init__.py:1