ifw-fcf  5.0.0-pre2
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
fcf::devmgr::adc::AdcLcsIf Class Reference

Adc Local Control System (LCS) Interface (IF) class. More...

#include <adcLcsIf.hpp>

Inheritance diagram for fcf::devmgr::adc::AdcLcsIf:
fcf::devmgr::common::DeviceLcsIf

Public Member Functions

 AdcLcsIf (std::shared_ptr< fcf::devmgr::common::IDeviceConfig > config, fcf::devmgr::common::DataContext &data_ctx)
 adcLcsIf constructor. More...
 
virtual ~AdcLcsIf ()
 Default destructor. More...
 
virtual void InitObject ()
 Initialize object. More...
 
virtual void Init ()
 Executes the Init RPC. More...
 
void UpdateTargetPosition (int axis_id, double position, std::string move_type)
 
void MoveAbs (int axis_id, double position, double velocity)
 Executes the MoveAbs RPC. More...
 
void MoveRel (int axis_id, double position, double velocity)
 Executes the MoveRel RPC. More...
 
void MoveEncAbs (int axis_id, long int encoders)
 
void MoveEncRel (int axis_id, long int encoders)
 
void MoveVel (int axis_id, double velocity)
 Executes the MoveVel RPC. More...
 
void StartTrack (const double &angle)
 Start ADC tracking. More...
 
void StopTrack ()
 StopTrack. More...
 
void MoveAngle (const double &angle)
 MoveAngle. More...
 
bool IsTracking () const
 IsTracking. More...
 
bool IsMoving () const
 IsMoving. More...
 
bool IsInPosition (const int axis=-1) const
 IsInPosition. More...
 
bool IsStandstill () const
 IsStandstill. More...
 
void ReadConfig ()
 Read the configuration. More...
 
std::string GetMotorMapValue (std::string motor, std::string category, std::string key)
 
virtual void ReadStatus (AdcControllerData &status)
 Read status from the controller. More...
 
void StartTrackMonitoring ()
 
void StopTrackMonitoring ()
 
void Listener (protocol::base::VectorVariant &params)
 Callback to manage changes on the monitored items. More...
 
virtual std::string GetRpcError (const short error_code) const
 
- Public Member Functions inherited from fcf::devmgr::common::DeviceLcsIf
 DeviceLcsIf (std::shared_ptr< IDeviceConfig > config, DataContext &data_ctx)
 DeviceLcsIf constructor. More...
 
virtual void RegisterComm (std::shared_ptr< protocol::base::IComm > comm_if, protocol::base::Dispatcher<> &failure, protocol::base::Dispatcher<> &normal)
 Register a communication interface. More...
 
virtual void Connect ()
 Connect to the controller or simulator. More...
 
virtual void Disconnect ()
 Disconnect from the controller of simulator. More...
 
virtual bool IsNotReady () const
 Check if controller is in Standby/NotReady state. More...
 
virtual bool IsReady () const
 Check if controller is in Standby/Ready state. More...
 
virtual bool IsDisabling () const
 Check if controller is in Disabling state. More...
 
virtual bool IsOperational () const
 Check if controller is in Operational. More...
 
virtual bool IsHwFailure () const
 Check if controller is in Hardware Failure. More...
 
virtual void Enable ()
 Executes the Enable RPC. More...
 
virtual void Disable ()
 Executes the Disable RPC. More...
 
virtual void Stop ()
 Executes the Stop RPC. More...
 
virtual void Reset ()
 Executes the Reset RPC. More...
 
virtual void StartMonitoring ()
 Start monitoring of controller attributes. More...
 
virtual void StopMonitoring ()
 Stop monitoring of controller attributes. More...
 
virtual void ReadStatus (DeviceControllerData &status)
 ReadStatus. More...
 
virtual std::string GetHwError (int &error_code, const bool update=false)
 Get error message. More...
 
std::string GetMapValue (const std::string &category, const std::string &key) const
 Get mapping value. More...
 
protocol::base::Dispatcher< protocol::base::VectorVariant & > & GetDispatcher ()
 
bool IsConfigLoaded () const
 Check if configuration was loaded. More...
 
bool IsConnected () const
 Check is the communication was established. More...
 
virtual std::shared_ptr< IDeviceConfigGetDeviceConfig () const
 Get a pointer of device configuration. More...
 
const elt::configng::CiiConfigInstanceNamespace & GetCfgInstance () const
 
virtual void GetStates (int &state, int &substate)
 Get states (state and substate) of the controller. More...
 

Protected Member Functions

void LoadConfig ()
 Load the YAML configuration. More...
 
- Protected Member Functions inherited from fcf::devmgr::common::DeviceLcsIf
void LoadConfig ()
 Load the YAML configuration. More...
 
void ExecuteRpc (const std::string &obj, const std::string &proc, protocol::base::VectorVariant &attr_list)
 
int ReadErrorCode ()
 
void StoreUaNames (const std::vector< std::pair< std::string, unsigned int >> &ualist)
 StoreUaNames. More...
 
void StoreAttribute (const std::string key, const protocol::base::Variant &value, int attribute)
 Store the updated into the DB. More...
 

Protected Attributes

std::vector< std::string > m_monitor_track_vector
 Special monitor vector of attributes to be monitored only in tracking mode. More...
 
std::unique_ptr< elt::configng::CiiConfigDocument > m_motor_map_doc
 Config document for mapping file. More...
 
double m_mot_actual_pos {0.0}
 
double m_mot_actual_pos_axis [2] {0.0,0.0}
 
double m_alpha {}
 
double m_delta {}
 
short m_track_mode {}
 
std::map< std::string, fcf::devmgr::motor::MotorControllerDatam_motors_status
 
- Protected Attributes inherited from fcf::devmgr::common::DeviceLcsIf
std::unique_ptr< elt::configng::CiiConfigDocument > m_config_doc
 Config document for mapping file. More...
 
std::shared_ptr< protocol::base::IComm > m_comm
 Shared pointer to the communication object. More...
 
std::shared_ptr< IDeviceConfigm_config
 Shared pointer to the device config object. More...
 
protocol::base::Dispatcher< protocol::base::VectorVariant & > m_dispatcher
 Dispatcher for managing subscription events. More...
 
protocol::base::Dispatcher m_failure
 Dispatcher for managing failures in the communication. More...
 
protocol::base::Dispatcher m_normal
 Dispatcher for managing recovery of communication failures. More...
 
int m_state {}
 Actual controller state. More...
 
int m_substate {}
 Actual controller substate. More...
 
bool m_local {false}
 Actual local flag. More...
 
bool m_error_code {false}
 Actual error code. More...
 
bool m_config_loaded {false}
 Flag indicating whether the configuration was successfully loaded. More...
 
bool m_connected {false}
 Flag indicating whether the LCS is connected. More...
 
fcf::devmgr::common::DataContextm_data_ctx
 
std::string m_lcs_prefix
 Store the prefix for storing keys in the database. More...
 
std::unordered_map< std::string, short > m_ua_status_map
 
std::vector< std::string > m_ua_monitor_vector
 
std::unordered_map< short, std::string > m_hw_errors
 

Additional Inherited Members

- Public Types inherited from fcf::devmgr::common::DeviceLcsIf
enum  {
  STAT_LOCAL = 1 , STAT_ERROR = 2 , STAT_HW_STATUS = 3 , STAT_STATE = 4 ,
  STAT_SUBSTATE = 5
}
 

Detailed Description

Adc Local Control System (LCS) Interface (IF) class.

This class manages the Adc connection to the LCS encapsulating all basic communication with the controller or the simulator.

Each RPC call is synchronous but it only starts the action in the controller. The controller will return successfully if the action can be started, not that the action was completed.

The completion of the action must be monitored by reading the status of the controller but this is out of the scope of this class.

Constructor & Destructor Documentation

◆ AdcLcsIf()

fcf::devmgr::adc::AdcLcsIf::AdcLcsIf ( std::shared_ptr< fcf::devmgr::common::IDeviceConfig config,
fcf::devmgr::common::DataContext data_ctx 
)

adcLcsIf constructor.

Parameters
[in,out]configShared pointer to the device configuration.
[in,out]data_ctxReference to the data context object.
[in]initialiseFlag to control the initialization. This flag is used when using child classes.
[in]with_publisherFlag to be used in unit tests to avoid crash of CII.

◆ ~AdcLcsIf()

virtual fcf::devmgr::adc::AdcLcsIf::~AdcLcsIf ( )
inlinevirtual

Default destructor.

Member Function Documentation

◆ GetMotorMapValue()

std::string fcf::devmgr::adc::AdcLcsIf::GetMotorMapValue ( std::string  motor,
std::string  category,
std::string  key 
)

◆ GetRpcError()

std::string fcf::devmgr::adc::AdcLcsIf::GetRpcError ( const short  error_code) const
virtual
Parameters
error_codeError code
Returns
Associated error text to the passed error code.

Implements fcf::devmgr::common::DeviceLcsIf.

◆ Init()

void fcf::devmgr::adc::AdcLcsIf::Init ( )
virtual

Executes the Init RPC.

Exceptions
anexception if an error ocurrs.

Reimplemented from fcf::devmgr::common::DeviceLcsIf.

◆ InitObject()

void fcf::devmgr::adc::AdcLcsIf::InitObject ( )
virtual

Initialize object.

Exceptions
anexception if an error ocurrs.

This method carries out basic object initialization. It is done in a separate method to allow overriden this functionality in children classes.

Reimplemented from fcf::devmgr::common::DeviceLcsIf.

◆ IsInPosition()

bool fcf::devmgr::adc::AdcLcsIf::IsInPosition ( const int  axis = -1) const

IsInPosition.

Parameters
axis
Returns

◆ IsMoving()

bool fcf::devmgr::adc::AdcLcsIf::IsMoving ( ) const

IsMoving.

Returns

◆ IsStandstill()

bool fcf::devmgr::adc::AdcLcsIf::IsStandstill ( ) const

IsStandstill.

Returns

◆ IsTracking()

bool fcf::devmgr::adc::AdcLcsIf::IsTracking ( ) const

IsTracking.

Returns

◆ Listener()

void fcf::devmgr::adc::AdcLcsIf::Listener ( protocol::base::VectorVariant &  params)
virtual

Callback to manage changes on the monitored items.

Parameters
[in]paramsVector containing the list of atributes that have changed

This method implement the actions associated to the events originated from the monitoring of attributes.

This method is storing in the database the values that have changed. It also publish the events for the clients via zeroMQ.

Reimplemented from fcf::devmgr::common::DeviceLcsIf.

◆ LoadConfig()

void fcf::devmgr::adc::AdcLcsIf::LoadConfig ( )
protected

Load the YAML configuration.

Exceptions
rad::runtime_errorin case of error

◆ MoveAbs()

void fcf::devmgr::adc::AdcLcsIf::MoveAbs ( int  axis_id,
double  position,
double  velocity 
)

Executes the MoveAbs RPC.

Exceptions
anexception if an error ocurrs.

This RPC call make the motor move in absolute user units.

◆ MoveAngle()

void fcf::devmgr::adc::AdcLcsIf::MoveAngle ( const double &  angle)

MoveAngle.

Parameters
angle

◆ MoveEncAbs()

void fcf::devmgr::adc::AdcLcsIf::MoveEncAbs ( int  axis_id,
long int  encoders 
)

◆ MoveEncRel()

void fcf::devmgr::adc::AdcLcsIf::MoveEncRel ( int  axis_id,
long int  encoders 
)

◆ MoveRel()

void fcf::devmgr::adc::AdcLcsIf::MoveRel ( int  axis_id,
double  position,
double  velocity 
)

Executes the MoveRel RPC.

Exceptions
anexception if an error ocurrs.

This RPC call make the motor move in relative user units.

◆ MoveVel()

void fcf::devmgr::adc::AdcLcsIf::MoveVel ( int  axis_id,
double  velocity 
)

Executes the MoveVel RPC.

Parameters
axis_idAxis identifier.
velocitySpeed in which the motor will be moved.
Exceptions
anexception if an error ocurrs.

This RPC call make the motor move in velocity mode.

◆ ReadConfig()

void fcf::devmgr::adc::AdcLcsIf::ReadConfig ( )

Read the configuration.

This class reads the mapping configuration of the device.

◆ ReadStatus()

void fcf::devmgr::adc::AdcLcsIf::ReadStatus ( AdcControllerData status)
virtual

Read status from the controller.

Parameters
statusstructure containing the status of the controller.
Warning
: The unpacking of the data shall follow the proper order or there is the risk of having an exception related to the boost conversion to variant.

◆ StartTrack()

void fcf::devmgr::adc::AdcLcsIf::StartTrack ( const double &  angle)

Start ADC tracking.

Parameters
angleoffset position angle.

◆ StartTrackMonitoring()

void fcf::devmgr::adc::AdcLcsIf::StartTrackMonitoring ( )

◆ StopTrack()

void fcf::devmgr::adc::AdcLcsIf::StopTrack ( )

StopTrack.

◆ StopTrackMonitoring()

void fcf::devmgr::adc::AdcLcsIf::StopTrackMonitoring ( )

◆ UpdateTargetPosition()

void fcf::devmgr::adc::AdcLcsIf::UpdateTargetPosition ( int  axis_id,
double  position,
std::string  move_type 
)

Member Data Documentation

◆ m_alpha

double fcf::devmgr::adc::AdcLcsIf::m_alpha {}
protected

◆ m_delta

double fcf::devmgr::adc::AdcLcsIf::m_delta {}
protected

◆ m_monitor_track_vector

std::vector<std::string> fcf::devmgr::adc::AdcLcsIf::m_monitor_track_vector
protected

Special monitor vector of attributes to be monitored only in tracking mode.

◆ m_mot_actual_pos

double fcf::devmgr::adc::AdcLcsIf::m_mot_actual_pos {0.0}
protected

◆ m_mot_actual_pos_axis

double fcf::devmgr::adc::AdcLcsIf::m_mot_actual_pos_axis[2] {0.0,0.0}
protected

◆ m_motor_map_doc

std::unique_ptr<elt::configng::CiiConfigDocument> fcf::devmgr::adc::AdcLcsIf::m_motor_map_doc
protected

Config document for mapping file.

◆ m_motors_status

std::map<std::string, fcf::devmgr::motor::MotorControllerData> fcf::devmgr::adc::AdcLcsIf::m_motors_status
protected

◆ m_track_mode

short fcf::devmgr::adc::AdcLcsIf::m_track_mode {}
protected

The documentation for this class was generated from the following files: