ifw-fcf 7.1.4
Loading...
Searching...
No Matches
maxisConfig.hpp
Go to the documentation of this file.
1
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(ifw::core::protocol::base::VectorVariant& params) const override;
107
108
117 virtual void GetMotorConfig(ifw::core::protocol::base::VectorVariant& params) const;
118
119 virtual void GetMotorConfig(const std::string motor, ifw::core::protocol::base::VectorVariant& params) const;
120
121 virtual void SetScaleFactor(const std::string motor, double scale_factor);
122
127 double GetNpTolerance() const;
128
138 virtual void GetConfigList(ifw::core::utils::bat::DbVector& cfg_list,
139 std::string prefix) const override;
140
141
146 virtual std::string GetMotorMapFile() const;
147
152 virtual std::string GetMotorType() const;
153
158 std::string GetMotorPrefix(const int& index) const;
159 std::string GetMotorPrefix(const std::string& motor) const;
160 std::optional<int> GetMotorIndex(const std::string& motor) const;
161 std::string GetMotorName(const int& index) const;
162
163 void GetMotorNames(std::vector<std::string>& motor_names) const;
164
165 void GetMotorPrefixes(std::vector<std::string>& motor_prefixes) const;
166
167 double GetMotorVelocity(const int axis_num) const;
168
169 double GetMotorScaleFactor(const int axis_num) const;
170
171 double GetMotorScaleFactor(const std::string motor_name) const;
172
173 std::string GetMotorName(const std::string nodeid) const;
174
175 inline long unsigned int GetNumAxes() const {return m_num_axis;};
176
182 std::optional<std::string> GetNamedPosition(const int index) const;
183
189 std::optional<std::vector<double>> GetNamedPositionValues(const int index) const;
190 std::optional<std::vector<double>> GetNamedPositionValues(const std::string& name) const;
191
192
193
194 private:
195
197 int m_num_axis;
198
200 std::map<std::string, std::unique_ptr<ifw::fcf::devmgr::motor::MotorConfig>> m_motor_config_map;
201
202 // Map of motor named positions
203 std::unordered_map<std::string, std::vector<double>> m_named_positions;
204
207 std::map<std::string, std::string> m_motor_prefix_map;
208
209 private:
210 log4cplus::Logger m_logger;
211 };
212
213} //namespace
214
215#endif //FCF_DEVMGR_DEVICE_MAXIS_CONFIG_H
Device Configuration class.
Definition deviceConfig.hpp:124
adc Configuration class
Definition maxisConfig.hpp:71
double GetMotorScaleFactor(const int axis_num) const
Definition maxisConfig.cpp:322
MAxisConfig(const std::string filename, const std::string name)
DeviceConfig constructor.
Definition maxisConfig.cpp:27
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:369
long unsigned int GetNumAxes() const
Definition maxisConfig.hpp:175
virtual std::string GetMotorMapFile() const
Definition maxisConfig.cpp:179
void Init()
Define configuration parameters for adc device.
Definition maxisConfig.cpp:44
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
virtual void GetConfig(ifw::core::protocol::base::VectorVariant &params) const override
Obtain the list of configuration parameters.
Definition maxisConfig.cpp:94
virtual void GetMotorConfig(ifw::core::protocol::base::VectorVariant &params) const
Obtain the list of ADC motor configuration parameters.
Definition maxisConfig.cpp:103
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: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