9 #ifndef FCF_DEVMGR_DEVICE_MOTOR_IF_HPP
10 #define FCF_DEVMGR_DEVICE_MOTOR_IF_HPP
13 #include <unordered_map>
16 #include <yaml-cpp/yaml.h>
23 #include <rad/mal/publisher.hpp>
25 namespace fcf::devmgr::motor {
115 template<
typename TOPIC_TYPE>
158 MotorLcsIf(std::shared_ptr<fcf::devmgr::common::IDeviceConfig> config,
172 void MoveAbs(
double position,
double velocity);
180 void MoveRel(
double position,
double velocity);
231 void Listener(fcf::common::VectorVariant& params);
238 virtual std::string
GetRpcError(
const short error_code)
const;
255 const fcf::common::Variant& value,
271 void MovePos(
double position,
double velocity, std::string move_type=
RPC_MOVE_ABS);
280 static std::timed_mutex m_mutex;
289 #include "motorLcsIf.ipp"
291 #endif //FCF_DEVMGR_DEVICE_MOTOR_IF_HPP
double GetTargetPos() const
bool GetEnableFlag() const
Definition: motorLcsIf.hpp:145
double m_target_pos
Definition: motorLcsIf.hpp:85
virtual ~MotorControllerData()
Definition: motorLcsIf.cpp:26
void PublishPosition(const fcf::common::Variant &value, int attribute)
Publish Position.
void SetInfoData1(short info)
Definition: motorLcsIf.hpp:129
virtual std::string GetSubstateStr() const
Definition: motorLcsIf.hpp:146
double GetActualPos() const
int m_info_data2
Definition: motorLcsIf.hpp:98
void MoveVel(double velocity)
Executes the MoveVel RPC.
Definition: motorLcsIf.hpp:128
virtual bool IsDisabling()
Check if controller is disabling the motor.
MotorLcsIf(std::shared_ptr< fcf::devmgr::common::IDeviceConfig > config, fcf::devmgr::common::DataContext &data_ctx, bool initialise=true)
MotorLcsIf constructor.
bool IsMoving()
Check if motor is moving.
The DeviceControllerData struct.
Definition: deviceLcsIf.hpp:31
Definition: motorLcsIf.hpp:147
void MoveAbs(double position, double velocity)
Executes the MoveAbs RPC.
void SetInfoData2(short info)
double m_pos_error
Definition: motorLcsIf.hpp:87
bool m_enabled
Definition: motorLcsIf.hpp:92
Definition: motorLcsIf.hpp:122
void StoreAttribute(const std::string key, const fcf::common::Variant &value, bool publish, int attribute)
Store the updated into the DB.
void SetSignalFlag(Signal signal, bool flag)
Definition: motorLcsIf.hpp:131
Definition: motorLcsIf.hpp:142
double GetTargetVel() const
void SetBrakeFlag(bool flag)
Definition: motorLcsIf.hpp:121
Definition: motorLcsIf.hpp:135
bool GetReadyFlag() const
double GetActualVel() const
void MoveRel(double position, double velocity)
Executes the MoveRel RPC.
Definition: motorLcsIf.hpp:126
double m_target_vel
Definition: motorLcsIf.hpp:89
int m_info_data1
Definition: motorLcsIf.hpp:97
double m_scale_factor
Definition: motorLcsIf.hpp:90
bool GetSignalFlag(Signal signal) const
Definition: motorLcsIf.hpp:141
Signal
Definition: motorConfig.hpp:173
double m_actual_vel
Definition: motorLcsIf.hpp:88
void SetData(const MotorControllerData &data)
Definition: motorLcsIf.cpp:29
bool GetInPositionFlag() const
virtual std::string GetRpcError(const short error_code) const
void SetActualVel(double velocity)
constexpr auto RPC_MOVE_ABS
Definition: motorConfig.hpp:110
Definition: motorLcsIf.hpp:143
bool m_ready
Definition: motorLcsIf.hpp:95
Motor Local Control System (LCS) Interface (IF) class.
Definition: motorLcsIf.hpp:116
Definition: motorLcsIf.hpp:138
Definition: motorLcsIf.hpp:139
Definition: motorLcsIf.hpp:140
virtual void ReadStatus(MotorControllerData &status)
Read status from the controller.
bool GetBrakeFlag() const
void SetEnableFlag(bool flag)
Definition: motorLcsIf.hpp:130
DataContext class header file.
The MotorControllerData struct.
Definition: motorLcsIf.hpp:34
void SetTargetVel(double velocity)
bool m_locked
Definition: motorLcsIf.hpp:93
void SetLockFlag(bool flag)
Definition: motorLcsIf.hpp:127
double GetPosError() const
bool IsStandstill()
Check if motor is on.
void SetScaleFactor(double scale)
Definition: dataContext.hpp:81
virtual ~MotorLcsIf()
Default destructor.
Definition: motorLcsIf.hpp:164
short GetInfoData1() const
void Listener(fcf::common::VectorVariant ¶ms)
Callback to manage changes on the monitored items.
Definition: motorLcsIf.hpp:134
Definition: motorLcsIf.hpp:132
bool m_brake
Definition: motorLcsIf.hpp:91
deviceLcsIf class header file.
Definition: motorLcsIf.hpp:136
MotorControllerData()
Definition: motorLcsIf.cpp:4
bool m_in_position
Definition: motorLcsIf.hpp:96
double m_actual_pos
Definition: motorLcsIf.hpp:86
Definition: motorLcsIf.hpp:120
Definition: motorLcsIf.hpp:125
Definition: motorLcsIf.hpp:124
Definition: motorLcsIf.hpp:133
short GetInfoData2() const
std::unique_ptr< rad::cii::Publisher< fcfif::MotorPositionTopic > > m_motor_publisher
Definition: motorLcsIf.hpp:275
double GetScaleFactor() const
Definition: motorLcsIf.hpp:144
Definition: motorLcsIf.hpp:137
MotorConfig class header file.
Definition: motorLcsIf.hpp:123
int m_mode
Definition: motorLcsIf.hpp:94
void SetTargetPos(double position)
std::vector< bool > m_signals
Definition: motorLcsIf.hpp:99
virtual std::string GetErrorText() const
Definition: deviceLcsIf.hpp:72
std::unique_ptr< rad::cii::Publisher< TOPIC_TYPE > > m_publisher
Definition: motorLcsIf.hpp:276
void SetInPositionFlag(bool flag)
void SetReadyFlag(bool flag)
void SetActualPos(double position)
void SetPosError(double pos_error)