ifw-fcf 8.0.2
 
Loading...
Searching...
No Matches
maxisLcsIf.hpp
Go to the documentation of this file.
1
7
8#ifndef FCF_DEVMGR_DEVICE_MAXIS_IF_HPP
9#define FCF_DEVMGR_DEVICE_MAXIS_IF_HPP
10
11#include <unordered_map>
12
13#include <yaml-cpp/yaml.h>
17
18
20
21using VectorAttributes = std::vector <std::pair<std::string, unsigned int>>;
30 public:
32 virtual ~MAxisControllerData();
33
34 void SetData(const MAxisControllerData& data);
35
36 inline virtual std::string GetErrorText() const;
37 inline virtual std::string GetSubstateStr() const;
39 inline void ClearMotors();
40 inline void AddMotor(const std::string motor,
42 inline void GetMotorNames(std::vector<std::string>& motor_vector);
43
44 private:
45 std::map<std::string, fcf::devmgr::motor::MotorControllerData> m_motors;
46 };
47
62
63 // enumerations for MAxis status
64 enum {
65 STAT_LOCAL = 100,
66 STAT_ERROR = 101,
67 STAT_STATE = 102,
68 STAT_SUBSTATE = 103
69 };
70
71 public:
81 MAxisLcsIf(std::shared_ptr<ifw::fcf::devmgr::common::IDeviceConfig> config,
83
87 virtual ~MAxisLcsIf() {};
88
97 virtual void InitObject();
98
104 virtual void Init();
105
112 void MoveAbs(int axis_id, double position, double velocity, ::fcfif::MotorPosUnit unit = ::fcfif::MotorPosUnit::UU);
113
120 void MoveRel(int axis_id, double position, double velocity, ::fcfif::MotorPosUnit unit = ::fcfif::MotorPosUnit::UU);
121
127 void MoveEncAbs(int axis_id, long int encoders);
128
134 void MoveEncRel(int axis_id, long int encoders);
135
145 void MoveVel(int axis_id, double velocity);
146
147 void MoveAxesByName(std::string namedpos);
148
153 void MoveAxes(const std::vector<double>& positions);
154
159 bool IsMoving() const;
160
166 bool IsInPosition(const std::string& axis_name) const;
167
172 bool AreAllInPosition() const;
173
178 bool IsStandstill() const;
179
180
181
188
194 virtual void ReadStatus(MAxisControllerData& status);
195
207 void Listener(const ifw::fnd::defs::Notification& note);
208
214 virtual std::string GetRpcError(const short error_code) const;
215
223 std::string GetMotorMapValue(std::string motor, std::string category, std::string key);
224
231 std::optional<double> GetTargetInUserUnits(int axis_id, double value);
232
239 void UpdateTargetPosition(int axis_id, double position, std::string move_type);
240
245 void UpdateTargetPositions(const std::vector<double>& positions);
246
252 virtual void AddCustomAttributes();
253
254 protected:
255
261
269 void StoreMotorPosition(const std::string nodeid_prefix,
270 const ifw::fnd::defs::Value& value,
271 int attribute);
272
273 void StoreMotorAttribute(const std::string nodeid_prefix,
274 const ifw::fnd::defs::Value& value,
275 int attribute);
276
277 void MovePos(int axis_id, double position, double velocity,
278 std::string move_type=ifw::fcf::devmgr::motor::RPC_MOVE_ABS);
279
280 std::pair<std::string, std::string> GetObjectInfo(const std::string& map_value) const;
281
282 private:
284 std::vector<std::string> m_monitor_track_vector;
285 //std::map<std::string, int> m_motor_index;
289 std::unique_ptr<elt::configng::CiiConfigDocument> m_motor_map_doc;
290 short m_track_mode {};
291
292 std::map<std::string, fcf::devmgr::motor::MotorControllerData> m_motors_status;
293
294 private:
295 log4cplus::Logger m_logger;
296 };
297
298}
299
300#include "maxisLcsIf.ipp"
301
302#endif //FCF_DEVMGR_DEVICE_MAXIS_IF_HPP
Definition dataContext.hpp:86
Definition deviceLcsIf.hpp:91
virtual void ReadStatus(DeviceControllerData &status)
ReadStatus.
Definition deviceLcsIf.cpp:651
bool AreAllInPosition() const
Check whether all motors are in position.
Definition maxisLcsIf.cpp:561
virtual void ReadStatus(MAxisControllerData &status)
Read status from the controller.
Definition maxisLcsIf.cpp:506
void UpdateTargetPositions(const std::vector< double > &positions)
UpdateTargetPositions.
Definition maxisLcsIf.cpp:295
std::pair< std::string, std::string > GetObjectInfo(const std::string &map_value) const
Definition maxisLcsIf.cpp:493
std::string GetMotorMapValue(std::string motor, std::string category, std::string key)
GetMotorMapValue.
Definition maxisLcsIf.cpp:471
void ReadConfig()
Read the configuration.
void MoveAbs(int axis_id, double position, double velocity, ::fcfif::MotorPosUnit unit=::fcfif::MotorPosUnit::UU)
Executes the MoveAbs RPC.
Definition maxisLcsIf.cpp:310
virtual void Init()
Executes the Init RPC.
Definition maxisLcsIf.cpp:171
void MoveAxesByName(std::string namedpos)
Definition maxisLcsIf.cpp:423
virtual void InitObject()
Initialize object.
Definition maxisLcsIf.cpp:78
void LoadConfig()
Load the YAML configuration.
std::optional< double > GetTargetInUserUnits(int axis_id, double value)
GetTargetInUserUnits.
Definition maxisLcsIf.cpp:239
void MoveRel(int axis_id, double position, double velocity, ::fcfif::MotorPosUnit unit=::fcfif::MotorPosUnit::UU)
Executes the MoveRel RPC.
Definition maxisLcsIf.cpp:333
void UpdateTargetPosition(int axis_id, double position, std::string move_type)
UpdateTargetPosition.
Definition maxisLcsIf.cpp:275
void MoveVel(int axis_id, double velocity)
Executes the MoveVel RPC.
Definition maxisLcsIf.cpp:379
virtual void AddCustomAttributes()
Add custom attributes.
Definition maxisLcsIf.cpp:161
MAxisLcsIf(std::shared_ptr< ifw::fcf::devmgr::common::IDeviceConfig > config, ifw::fcf::devmgr::common::DataContext &data_ctx)
adcLcsIf constructor.
Definition maxisLcsIf.cpp:69
bool IsInPosition(const std::string &axis_name) const
IsInPosition.
Definition maxisLcsIf.cpp:540
virtual std::string GetRpcError(const short error_code) const
Definition maxisLcsIf.cpp:592
void MoveEncAbs(int axis_id, long int encoders)
Move a motor in absolute encoder units.
Definition maxisLcsIf.cpp:355
bool IsStandstill() const
IsStandstill.
Definition maxisLcsIf.cpp:582
bool IsMoving() const
IsMoving.
Definition maxisLcsIf.cpp:525
void Listener(const ifw::fnd::defs::Notification &note)
Callback to manage changes on the monitored items.
Definition maxisLcsIf.cpp:621
void StoreMotorPosition(const std::string nodeid_prefix, const ifw::fnd::defs::Value &value, int attribute)
Publish Position.
Definition maxisLcsIf.cpp:741
void MoveEncRel(int axis_id, long int encoders)
Move a motor in relative encoder units.
Definition maxisLcsIf.cpp:367
void StoreMotorAttribute(const std::string nodeid_prefix, const ifw::fnd::defs::Value &value, int attribute)
Definition maxisLcsIf.cpp:682
void MovePos(int axis_id, double position, double velocity, std::string move_type=ifw::fcf::devmgr::motor::RPC_MOVE_ABS)
Definition maxisLcsIf.cpp:399
virtual ~MAxisLcsIf()
Default destructor.
Definition maxisLcsIf.hpp:87
void MoveAxes(const std::vector< double > &positions)
MoveAxes.
Definition maxisLcsIf.cpp:442
MAxis class header file.
Definition maxis.hpp:18
std::vector< std::pair< std::string, unsigned int > > VectorAttributes
Definition maxisLcsIf.hpp:21
constexpr auto RPC_MOVE_ABS
Definition motorBaseConfig.hpp:45
Definition __init__.py:1
The DeviceControllerData struct.
Definition deviceLcsIf.hpp:49
The adcControllerData struct.
Definition maxisLcsIf.hpp:29
void GetMotorNames(std::vector< std::string > &motor_vector)
void SetData(const MAxisControllerData &data)
Definition maxisLcsIf.cpp:65
virtual ~MAxisControllerData()
Definition maxisLcsIf.cpp:62
virtual std::string GetErrorText() const
MAxisControllerData()
Definition maxisLcsIf.cpp:56
void AddMotor(const std::string motor, const fcf::devmgr::motor::MotorControllerData motor_data)
virtual std::string GetSubstateStr() const
fcf::devmgr::motor::MotorControllerData GetMotor(std::string motor) const
The MotorControllerData struct.
Definition motorLcsIf.hpp:32