ifw-fcf  5.0.0
motorLcsIf.hpp
Go to the documentation of this file.
1 
9 #ifndef FCF_DEVMGR_DEVICE_MOTOR_IF_HPP
10 #define FCF_DEVMGR_DEVICE_MOTOR_IF_HPP
11 
12 // System headers
13 #include <unordered_map>
14 
15 // Third party headers
16 #include <yaml-cpp/yaml.h>
17 
21 
22 #include <Fcfif.hpp>
23 #include <rad/mal/publisher.hpp>
24 
25 namespace fcf::devmgr::motor {
26 
35  public:
37  virtual ~MotorControllerData();
38 
39  inline double GetScaleFactor() const;
40  inline void SetScaleFactor(double scale);
41 
42  inline bool GetBrakeFlag() const;
43  inline void SetBrakeFlag(bool flag);
44 
45  inline bool GetEnableFlag() const;
46  inline void SetEnableFlag(bool flag);
47 
48  inline bool GetLockFlag() const;
49  inline void SetLockFlag(bool flag);
50 
51  inline int GetMode() const;
52  inline void SetMode(int mode);
53 
54  inline bool GetReadyFlag() const;
55  inline void SetReadyFlag(bool flag);
56 
57  inline bool GetInPositionFlag() const;
58  inline void SetInPositionFlag(bool flag);
59 
60  inline short GetInfoData1() const;
61  inline void SetInfoData1(short info);
62 
63  inline short GetInfoData2() const;
64  inline void SetInfoData2(short info);
65 
66  inline bool GetSignalFlag(Signal signal) const;
67  inline void SetSignalFlag(Signal signal, bool flag);
68 
69  inline virtual std::string GetErrorText() const;
70 
71  void SetData(const MotorControllerData& data);
72 
73  protected:
74  double m_scale_factor {1};
75  bool m_brake {false};
76  bool m_enabled {false};
77  bool m_locked {false};
78  int m_mode {};
79  bool m_ready {false};
80  bool m_in_position {false};
81  int m_info_data1 {};
82  int m_info_data2 {};
83  std::vector<bool> m_signals;
84  };
85 
100  {
101  public:
102  enum {
122  };
123 
124  public:
125 
134  MotorLcsIf(std::shared_ptr<fcf::devmgr::common::IDeviceConfig> config,
136 
140  virtual ~MotorLcsIf() {};
141 
142 
151  virtual void InitObject();
152 
162  virtual void ReadStatus(MotorControllerData& status);
163 
175  void Listener(protocol::base::VectorVariant& params);
176 
182  virtual std::string GetRpcError(const short error_code) const;
183 
184 
185  protected:
186 
195  void StorePosition(const protocol::base::Variant& value,
196  int attribute);
197 
198 
199  protected:
200 
203  int m_mot_mode {};
206  bool m_mot_axis_ready {false};
207  bool m_mot_axis_enable {false};
208  bool m_mot_axis_brake {false};
209  bool m_mot_axis_lock {false};
210  bool m_mot_axis_inpos {false};
211  bool m_mot_signal_lstop {false};
212  bool m_mot_signal_lhw {false};
213  bool m_mot_signal_ref {false};
214  bool m_mot_signal_index {false};
215  bool m_mot_signal_uhw {false};
216  bool m_mot_signal_ustop {false};
217 
218  private:
219  log4cplus::Logger m_logger;
220 
221 
222  };
223 
224 }
225 
226 #include "motorLcsIf.ipp"
227 
228 #endif //FCF_DEVMGR_DEVICE_MOTOR_IF_HPP
Definition: dataContext.hpp:90
Motor Local Control System (LCS) Interface (IF) class.
Definition: motorBaseLcsIf.hpp:78
@ STAT_MOTOR_BASE_END
Definition: motorBaseLcsIf.hpp:92
Motor Local Control System (LCS) Interface (IF) class.
Definition: motorLcsIf.hpp:100
bool m_mot_signal_ustop
Definition: motorLcsIf.hpp:216
bool m_mot_axis_enable
Definition: motorLcsIf.hpp:207
bool m_mot_signal_uhw
Definition: motorLcsIf.hpp:215
void Listener(protocol::base::VectorVariant &params)
Callback to manage changes on the monitored items.
Definition: motorLcsIf.cpp:99
short m_mot_axis_info2
Definition: motorLcsIf.hpp:205
virtual void ReadStatus(MotorControllerData &status)
Read status from the controller.
Definition: motorLcsIf.cpp:81
int m_mot_mode
Definition: motorLcsIf.hpp:203
bool m_mot_signal_index
Definition: motorLcsIf.hpp:214
bool m_mot_axis_inpos
Definition: motorLcsIf.hpp:210
virtual void InitObject()
Initialize object.
Definition: motorLcsIf.cpp:38
bool m_mot_axis_ready
Definition: motorLcsIf.hpp:206
bool m_mot_signal_lstop
Definition: motorLcsIf.hpp:211
@ STAT_SIGNAL_INDEX
Definition: motorLcsIf.hpp:116
@ STAT_SIGNAL_LSTOP
Definition: motorLcsIf.hpp:113
@ STAT_AXIS_LOCK
Definition: motorLcsIf.hpp:105
@ STAT_USER_UNIT
Definition: motorLcsIf.hpp:120
@ STAT_INIT_ACTION
Definition: motorLcsIf.hpp:112
@ STAT_SIGNAL_USTOP
Definition: motorLcsIf.hpp:118
@ STAT_MODE
Definition: motorLcsIf.hpp:106
@ STAT_AXIS_INPOS
Definition: motorLcsIf.hpp:108
@ STAT_AXIS_READY
Definition: motorLcsIf.hpp:107
@ STAT_SCALE_FACTOR
Definition: motorLcsIf.hpp:119
@ STAT_AXIS_INFO2
Definition: motorLcsIf.hpp:110
@ STAT_INIT_STEP
Definition: motorLcsIf.hpp:111
@ STAT_MOTOR_END
Definition: motorLcsIf.hpp:121
@ STAT_AXIS_ENABLE
Definition: motorLcsIf.hpp:104
@ STAT_SIGNAL_REF
Definition: motorLcsIf.hpp:115
@ STAT_AXIS_INFO1
Definition: motorLcsIf.hpp:109
@ STAT_SIGNAL_UHW
Definition: motorLcsIf.hpp:117
@ STAT_AXIS_BRAKE
Definition: motorLcsIf.hpp:103
@ STAT_SIGNAL_LHW
Definition: motorLcsIf.hpp:114
bool m_mot_axis_lock
Definition: motorLcsIf.hpp:209
bool m_mot_signal_lhw
Definition: motorLcsIf.hpp:212
bool m_mot_axis_brake
Definition: motorLcsIf.hpp:208
int m_mot_init_action
Definition: motorLcsIf.hpp:202
void StorePosition(const protocol::base::Variant &value, int attribute)
Store Position.
Definition: motorLcsIf.cpp:331
MotorLcsIf(std::shared_ptr< fcf::devmgr::common::IDeviceConfig > config, fcf::devmgr::common::DataContext &data_ctx)
MotorLcsIf constructor.
Definition: motorLcsIf.cpp:28
bool m_mot_signal_ref
Definition: motorLcsIf.hpp:213
short m_mot_axis_info1
Definition: motorLcsIf.hpp:204
virtual ~MotorLcsIf()
Default destructor.
Definition: motorLcsIf.hpp:140
virtual std::string GetRpcError(const short error_code) const
Definition: motorLcsIf.cpp:298
int m_mot_init_step
Definition: motorLcsIf.hpp:201
DataContext class header file.
ShutterLcsIf class header file.
MotorConfig class header file.
Definition: motor.hpp:18
Signal
Definition: motorConfig.hpp:126
The MotorBaseControllerData struct.
Definition: motorBaseLcsIf.hpp:34
The MotorControllerData struct.
Definition: motorLcsIf.hpp:34
MotorControllerData()
Definition: motorLcsIf.cpp:4
virtual std::string GetErrorText() const
bool GetSignalFlag(Signal signal) const
bool m_locked
Definition: motorLcsIf.hpp:77
int m_mode
Definition: motorLcsIf.hpp:78
virtual ~MotorControllerData()
Definition: motorLcsIf.cpp:20
double m_scale_factor
Definition: motorLcsIf.hpp:74
void SetSignalFlag(Signal signal, bool flag)
bool m_in_position
Definition: motorLcsIf.hpp:80
bool m_brake
Definition: motorLcsIf.hpp:75
bool m_ready
Definition: motorLcsIf.hpp:79
int m_info_data1
Definition: motorLcsIf.hpp:81
int m_info_data2
Definition: motorLcsIf.hpp:82
bool m_enabled
Definition: motorLcsIf.hpp:76
std::vector< bool > m_signals
Definition: motorLcsIf.hpp:83
void SetData(const MotorControllerData &data)
Definition: motorLcsIf.cpp:23