9 #ifndef DEVMGR_DEVICE_MOTOR_IF_HPP
10 #define DEVMGR_DEVICE_MOTOR_IF_HPP
13 #include <unordered_map>
16 #include <yaml-cpp/yaml.h>
18 #include <devmgr/common/deviceLcsIf.hpp>
19 #include <devmgr/devices/motorConfig.hpp>
20 #include <devmgr/common/dataContext.hpp>
126 STAT_TARGET_VEL = 10,
127 STAT_AXIS_BRAKE = 11,
128 STAT_AXIS_ENABLE = 12,
131 STAT_AXIS_READY = 15,
132 STAT_AXIS_INPOS = 16,
133 STAT_AXIS_INFO1 = 17,
134 STAT_AXIS_INFO2 = 18,
135 STAT_INITIALISED = 19,
137 STAT_INIT_ACTION = 21,
138 STAT_SIGNAL_LSTOP = 22,
139 STAT_SIGNAL_LHW = 23,
140 STAT_SIGNAL_REF = 24,
141 STAT_SIGNAL_INDEX = 25,
142 STAT_SIGNAL_UHW = 26,
143 STAT_SIGNAL_USTOP = 27
152 MotorLcsIf(std::shared_ptr<devmgr::common::IDeviceConfig> config,
187 void MoveAbs(
double position,
double velocity);
195 void MoveRel(
double position,
double velocity);
239 virtual void ReadStatus(MotorControllerData& status);
272 void Listener(fcf::common::VectorVariant& params);
296 void PublishState(
const fcf::common::Variant&
value);
305 void PublishSubstate(
const fcf::common::Variant&
value);
318 void StoreAttribute(
const std::string key,
319 const fcf::common::Variant&
value,
330 void PublishPosition(
const fcf::common::Variant&
value,
344 static std::timed_mutex m_mutex;
346 std::shared_ptr<MotorConfig> m_motor_config;
349 void MovePos(
double position,
double velocity, std::string move_type=
RPC_MOVE_ABS);
354 #include "motorLcsIf.inline"
356 #endif //DEVMGR_DEVICE_MOTOR_IF_HPP
std::vector< std::string > m_monitor_vector
Definition: motorLcsIf.hpp:341
double value
Definition: easylogging++.h:814
virtual bool IsReady()
Check if controller is in Standby/Ready state.
Definition: motorLcsIf.cpp:406
Device Local Control System (LCS) Interface (IF) class.
Definition: deviceLcsIf.hpp:69
const std::string RPC_MOVE_ABS
Definition: motorConfig.hpp:112
void StopMonitoring()
Stop monitoring of controller attributes.
Definition: motorLcsIf.cpp:601
virtual std::string GetHwError(int &error_code, const bool update=false)
Get error message.
Definition: motorLcsIf.cpp:770
std::string GetErrorText() const
short GetInfoData1() const
void SetData(const MotorControllerData &data)
Definition: motorLcsIf.cpp:56
int m_mode
Definition: motorLcsIf.hpp:92
double GetTargetPos() const
void SetBrakeFlag(bool flag)
double m_target_vel
Definition: motorLcsIf.hpp:87
The DeviceControllerData struct.
Definition: deviceLcsIf.hpp:30
Signal
Definition: motorConfig.hpp:187
double GetScaleFactor() const
void SetReadyFlag(bool flag)
bool IsMoving()
Check if motor is moving.
Definition: motorLcsIf.cpp:442
virtual bool IsDisabling()
Check if controller is disabling the motor.
Definition: motorLcsIf.cpp:330
void SetInfoData1(short info)
double m_scale_factor
Definition: motorLcsIf.hpp:88
bool m_ready
Definition: motorLcsIf.hpp:93
bool GetEnableFlag() const
bool m_enabled
Definition: motorLcsIf.hpp:90
double m_actual_pos
Definition: motorLcsIf.hpp:84
void SetActualPos(double position)
double GetPosError() const
void SetSignalFlag(Signal signal, bool flag)
optional double pos_error
Definition: topics.proto:64
bool IsHwFailure()
Check if motor is in hardware error.
Definition: motorLcsIf.cpp:479
double m_actual_vel
Definition: motorLcsIf.hpp:86
double GetTargetVel() const
void MoveVel(double velocity)
Executes the MoveVel RPC.
Definition: motorLcsIf.cpp:339
double GetActualPos() const
bool m_in_position
Definition: motorLcsIf.hpp:94
bool IsStandstill()
Check if motor is on.
Definition: motorLcsIf.cpp:461
void SetActualVel(double velocity)
virtual ~MotorControllerData()
Definition: motorLcsIf.cpp:53
void Listener(fcf::common::VectorVariant ¶ms)
Callback to manage changes on the monitored items.
Definition: motorLcsIf.cpp:612
bool GetBrakeFlag() const
bool m_brake
Definition: motorLcsIf.hpp:89
double GetActualVel() const
virtual void ReadStatus(MotorControllerData &status)
Read status from the controller.
Definition: motorLcsIf.cpp:497
Definition: dataContext.hpp:73
int m_info_data2
Definition: motorLcsIf.hpp:96
void SetPosError(double pos_error)
int m_info_data1
Definition: motorLcsIf.hpp:95
std::vector< bool > m_signals
Definition: motorLcsIf.hpp:97
virtual std::string GetRpcError(const short error_code) const
Definition: motorLcsIf.cpp:741
bool GetInPositionFlag() const
void SetEnableFlag(bool flag)
virtual bool IsNotReady()
Check if controller is in Standby/NotReady state.
Definition: motorLcsIf.cpp:386
void SetTargetVel(double velocity)
virtual bool IsOperational()
Check if controller is in Operational.
Definition: motorLcsIf.cpp:426
void SetInPositionFlag(bool flag)
optional int32 error_code
Definition: topics.proto:14
bool GetSignalFlag(Signal signal) const
double m_pos_error
Definition: motorLcsIf.hpp:85
void ReadConfig()
Read the configuration.
Definition: motorLcsIf.cpp:220
void MoveAbs(double position, double velocity)
Executes the MoveAbs RPC.
Definition: motorLcsIf.cpp:268
void SetInfoData2(short info)
short GetInfoData2() const
void StartMonitoring()
Start monitoring of controller attributes.
Definition: motorLcsIf.cpp:590
void SetLockFlag(bool flag)
double m_target_pos
Definition: motorLcsIf.hpp:83
bool GetReadyFlag() const
void SetScaleFactor(double scale)
MotorLcsIf(std::shared_ptr< devmgr::common::IDeviceConfig > config, devmgr::common::DataContext &data_ctx)
MotorLcsIf constructor.
void MoveRel(double position, double velocity)
Executes the MoveRel RPC.
Definition: motorLcsIf.cpp:273
void SetTargetPos(double position)
MotorControllerData()
Definition: motorLcsIf.cpp:33
std::unordered_map< std::string, short > m_status_map
Definition: motorLcsIf.hpp:337
bool m_locked
Definition: motorLcsIf.hpp:91