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

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

#include <drotLcsIf.hpp>

Inheritance diagram for fcf::devmgr::drot::DrotLcsIf:
fcf::devmgr::motor::MotorLcsIf fcf::devmgr::motor::MotorBaseLcsIf fcf::devmgr::common::DeviceLcsIf

Public Member Functions

 DrotLcsIf (std::shared_ptr< fcf::devmgr::common::IDeviceConfig > config, fcf::devmgr::common::DataContext &data_ctx)
 drotLcsIf constructor. More...
 
virtual ~DrotLcsIf ()=default
 Default destructor. More...
 
virtual void InitObject ()
 Initialize object. More...
 
void MoveAngle (double angle)
 Move drot to a position angle. More...
 
void TrackOffset (double offset)
 Offset position during tracking. More...
 
bool IsTracking ()
 Check if drot is tracking. More...
 
void StartTrack (short mode, double angle)
 Start derotator tracking. More...
 
void StopTrack ()
 Stop derotator tracking. More...
 
void Listener (protocol::base::VectorVariant &params)
 Callback to manage changes on the monitored items. More...
 
virtual std::string GetRpcError (const short error_code) const
 
void ReadStatus (DrotControllerData &status)
 
- Public Member Functions inherited from fcf::devmgr::motor::MotorLcsIf
 MotorLcsIf (std::shared_ptr< fcf::devmgr::common::IDeviceConfig > config, fcf::devmgr::common::DataContext &data_ctx)
 MotorLcsIf constructor. More...
 
virtual ~MotorLcsIf ()
 Default destructor. More...
 
virtual void ReadStatus (MotorControllerData &status)
 Read status from the controller. More...
 
void Listener (protocol::base::VectorVariant &params)
 Callback to manage changes on the monitored items. More...
 
- Public Member Functions inherited from fcf::devmgr::motor::MotorBaseLcsIf
 MotorBaseLcsIf (std::shared_ptr< fcf::devmgr::common::IDeviceConfig > config, fcf::devmgr::common::DataContext &data_ctx)
 MotorLcsIf constructor. More...
 
virtual ~MotorBaseLcsIf ()
 Default destructor. More...
 
void MoveAbs (double position)
 Executes the MoveAbs RPC. More...
 
void MoveEncAbs (int encoders)
 Executes the MoveAbs RPC. More...
 
void MoveRel (double position)
 Executes the MoveRel RPC. More...
 
void MoveEncRel (int encoders)
 Executes the MoveRel RPC. More...
 
void MoveByName (std::string namedpos)
 Executes the MovePos RPC. More...
 
void MoveVel (double velocity)
 Executes the MoveVel RPC. More...
 
virtual bool IsDisabling ()
 Check if controller is disabling the motor. More...
 
bool IsMoving () const
 Check if motor is moving. More...
 
bool IsStandstill () const
 Check if motor is on. More...
 
bool IsInPosition () const
 Check if motor is in position. More...
 
bool IsMovingInRightDirection () const
 Check if motor is moving in the right direction. More...
 
void SetTargetNamedPosition (const std::string named_position)
 
const std::string GetTargetNamedPosition ()
 
- 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 Init ()
 Executes the Init RPC. 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 Attributes

double m_rotation {0.0}
 
double m_pupil {0.0}
 
short m_track_mode {0}
 
double m_angle_on_sky {0.0}
 
double m_track_offset {0.0}
 
- Protected Attributes inherited from fcf::devmgr::motor::MotorLcsIf
int m_mot_init_step {}
 
int m_mot_init_action {}
 
int m_mot_mode {}
 
short m_mot_axis_info1 {}
 
short m_mot_axis_info2 {}
 
bool m_mot_axis_ready {false}
 
bool m_mot_axis_enable {false}
 
bool m_mot_axis_brake {false}
 
bool m_mot_axis_lock {false}
 
bool m_mot_axis_inpos {false}
 
bool m_mot_signal_lstop {false}
 
bool m_mot_signal_lhw {false}
 
bool m_mot_signal_ref {false}
 
bool m_mot_signal_index {false}
 
bool m_mot_signal_uhw {false}
 
bool m_mot_signal_ustop {false}
 
- Protected Attributes inherited from fcf::devmgr::motor::MotorBaseLcsIf
double m_mot_actual_pos {0.0}
 
double m_mot_actual_enc {0.0}
 
std::string m_mot_target_name {""}
 
std::string m_mot_actual_name {""}
 
double m_mot_target_pos {0.0}
 
double m_mot_pos_error {0.0}
 
double m_mot_target_vel {0.0}
 
double m_mot_actual_vel {0.0}
 
double m_mot_scale {1.0}
 
bool m_mot_initialised {false}
 
- 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::motor::MotorLcsIf
enum  {
  STAT_AXIS_BRAKE = MotorBaseLcsIf::STAT_MOTOR_BASE_END + 10 , STAT_AXIS_ENABLE , STAT_AXIS_LOCK , STAT_MODE ,
  STAT_AXIS_READY , STAT_AXIS_INPOS , STAT_AXIS_INFO1 , STAT_AXIS_INFO2 ,
  STAT_INIT_STEP , STAT_INIT_ACTION , STAT_SIGNAL_LSTOP , STAT_SIGNAL_LHW ,
  STAT_SIGNAL_REF , STAT_SIGNAL_INDEX , STAT_SIGNAL_UHW , STAT_SIGNAL_USTOP ,
  STAT_SCALE_FACTOR , STAT_MOTOR_END
}
 
- Public Types inherited from fcf::devmgr::motor::MotorBaseLcsIf
enum  {
  STAT_LOCAL = 1 , STAT_ERROR = 2 , STAT_HW_STATUS = 3 , STAT_STATE = 4 ,
  STAT_SUBSTATE = 5 , STAT_ACTUAL_POS = 6 , STAT_TARGET_POS = 7 , STAT_POS_ERROR = 8 ,
  STAT_ACTUAL_VEL = 9 , STAT_TARGET_VEL = 10 , STAT_INITIALISED = 11 , STAT_MOTOR_BASE_END
}
 
- 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
}
 
- Protected Member Functions inherited from fcf::devmgr::motor::MotorLcsIf
void StorePosition (const protocol::base::Variant &value, int attribute)
 Store Position. More...
 
- Protected Member Functions inherited from fcf::devmgr::motor::MotorBaseLcsIf
void MovePos (double position, double velocity, std::string move_type=RPC_MOVE_ABS)
 
- 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...
 

Detailed Description

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

This class manages the Drot 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

◆ DrotLcsIf()

fcf::devmgr::drot::DrotLcsIf::DrotLcsIf ( std::shared_ptr< fcf::devmgr::common::IDeviceConfig config,
fcf::devmgr::common::DataContext data_ctx 
)

drotLcsIf 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.

◆ ~DrotLcsIf()

virtual fcf::devmgr::drot::DrotLcsIf::~DrotLcsIf ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ GetRpcError()

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

Reimplemented from fcf::devmgr::motor::MotorLcsIf.

◆ InitObject()

void fcf::devmgr::drot::DrotLcsIf::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::motor::MotorLcsIf.

◆ IsTracking()

bool fcf::devmgr::drot::DrotLcsIf::IsTracking ( )

Check if drot is tracking.

◆ Listener()

void fcf::devmgr::drot::DrotLcsIf::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.

◆ MoveAngle()

void fcf::devmgr::drot::DrotLcsIf::MoveAngle ( double  angle)

Move drot to a position angle.

Parameters
angleposition angle.

◆ ReadStatus()

void fcf::devmgr::drot::DrotLcsIf::ReadStatus ( DrotControllerData status)

◆ StartTrack()

void fcf::devmgr::drot::DrotLcsIf::StartTrack ( short  mode,
double  angle 
)

Start derotator tracking.

Parameters
modetracking mode.
angleoffset rotation angle.

The controller is not setting alpha and delta. These parameters will be obtained from CCS (or CCS simulator).

◆ StopTrack()

void fcf::devmgr::drot::DrotLcsIf::StopTrack ( )

Stop derotator tracking.

◆ TrackOffset()

void fcf::devmgr::drot::DrotLcsIf::TrackOffset ( double  offset)

Offset position during tracking.

Parameters
offsetoffset value in deg.

Member Data Documentation

◆ m_angle_on_sky

double fcf::devmgr::drot::DrotLcsIf::m_angle_on_sky {0.0}
protected

◆ m_pupil

double fcf::devmgr::drot::DrotLcsIf::m_pupil {0.0}
protected

◆ m_rotation

double fcf::devmgr::drot::DrotLcsIf::m_rotation {0.0}
protected

◆ m_track_mode

short fcf::devmgr::drot::DrotLcsIf::m_track_mode {0}
protected

◆ m_track_offset

double fcf::devmgr::drot::DrotLcsIf::m_track_offset {0.0}
protected

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