itom
Loading...
Searching...
No Matches
ito::AddInActuator Class Referenceabstract

base class for all actuator plugin classes More...

#include <addInInterface.h>

Inheritance diagram for ito::AddInActuator:
ito::AddInBase

Public Slots

virtual ito::RetVal calib (const int axis, ItomSharedSemaphore *waitCond=NULL)=0
 method to calibrate a single axis
 
virtual ito::RetVal calib (const QVector< int > axis, ItomSharedSemaphore *waitCond=NULL)=0
 method to calibrate a number of axis. The axis' numbers are given in the axis vector
 
virtual ito::RetVal setOrigin (const int axis, ItomSharedSemaphore *waitCond=NULL)=0
 method to set the origin of one axis to the current position
 
virtual ito::RetVal setOrigin (const QVector< int > axis, ItomSharedSemaphore *waitCond=NULL)=0
 method to set the origin of a number of axis to their current positions. The axis' numbers are given in the axis vector
 
virtual ito::RetVal getStatus (QSharedPointer< QVector< int > > status, ItomSharedSemaphore *waitCond)=0
 retrieve the status of the actuator
 
virtual ito::RetVal getStatus (const int axis, QSharedPointer< int > status, ItomSharedSemaphore *waitCond)
 retrieve the status of one axis of the actuator. By default, this method uses the general implementation of getStatus and returns the requested axis only.
 
virtual ito::RetVal getPos (const int axis, QSharedPointer< double > pos, ItomSharedSemaphore *waitCond)=0
 read the position of one axis
 
virtual ito::RetVal getPos (const QVector< int > axis, QSharedPointer< QVector< double > > pos, ItomSharedSemaphore *waitCond)=0
 read the position of a number of axis. The axis' numbers are given in the axis vector
 
virtual ito::RetVal setPosAbs (const int axis, const double pos, ItomSharedSemaphore *waitCond=NULL)=0
 move a single axis to a new absolute position
 
virtual ito::RetVal setPosAbs (const QVector< int > axis, QVector< double > pos, ItomSharedSemaphore *waitCond=NULL)=0
 move a number of axis to a new absolute position. The axis' numbers are given in the axis vector
 
virtual ito::RetVal setPosRel (const int axis, const double pos, ItomSharedSemaphore *waitCond=NULL)=0
 increment/decrement a single axis by position value
 
virtual ito::RetVal setPosRel (const QVector< int > axis, QVector< double > pos, ItomSharedSemaphore *waitCond=NULL)=0
 increment/decrement a number of axis by position values. The axis' numbers are given in the axis vector
 
virtual ito::RetVal requestStatusAndPosition (bool sendCurrentPos, bool sendTargetPos)
 overload this function to update the current status and position values, followed by calling sendStatusUpdate and/or sendTargetUpdate
 
- Public Slots inherited from ito::AddInBase
virtual ito::RetVal init (QVector< ito::ParamBase > *paramsMand, QVector< ito::ParamBase > *paramsOpt, ItomSharedSemaphore *waitCond=NULL)=0
 method for the initialisation of a new instance of the class (must be overwritten)
 
virtual ito::RetVal close (ItomSharedSemaphore *waitCond)=0
 method for closing an instance (must be overwritten)
 
virtual ito::RetVal getParam (QSharedPointer< ito::Param > val, ItomSharedSemaphore *waitCond=NULL)=0
 method for the retrieval of a parameter. The actual value is always passed as ito::Param (must be overwritten). See also setParam
 
virtual ito::RetVal setParam (QSharedPointer< ito::ParamBase > val, ItomSharedSemaphore *waitCond=NULL)=0
 method to set a parameter. The actual value is always passed as ito::ParamBase (must be overwritten). See also getParam
 
ito::RetVal setParamVector (const QVector< QSharedPointer< ito::ParamBase > > values, ItomSharedSemaphore *waitCond=NULL)
 method for setting various parameters (can be used instead of multiple calls to setParam, this can safe multiple invocations)
 
ito::RetVal getParamVector (const QVector< QSharedPointer< ito::Param > > values, ItomSharedSemaphore *waitCond=NULL)
 method for getting various parameters (can be used instead of multiple calls to getParam, this can safe multiple invocations)
 
virtual ito::RetVal execFunc (const QString funcName, QSharedPointer< QVector< ito::ParamBase > > paramsMand, QSharedPointer< QVector< ito::ParamBase > > paramsOpt, QSharedPointer< QVector< ito::ParamBase > > paramsOut, ItomSharedSemaphore *waitCond=NULL)
 overwrite this function if you registered exec funcs. Once the exec function is called, this method is executed.
 
ito::RetVal moveBackToApplicationThread (ItomSharedSemaphore *waitCond=NULL)
 method invoked by AddInManager if the plugin should be pulled back to the main thread of itom. (not for direct use in plugins)
 
void sendParameterRequest ()
 immediately emits the signal parametersChanged
 

Signals

void actuatorStatusChanged (QVector< int > status, QVector< double > actPosition)
 signal emitted if status or actual position of any axis has been changed.
 
void targetChanged (QVector< double > targetPositions)
 signal emitted if target position of any axis has changed.
 
- Signals inherited from ito::AddInBase
void parametersChanged (QMap< QString, ito::Param > params)
 This signal usually is emitted if the vector m_params is changed.
 

Public Member Functions

void setInterrupt ()
 set interrupt flag (thread-safe)
 
void resetInterrupt ()
 resets the interrupt flag (thread-safe)
 
ito::RetVal getLastSignalledStates (QVector< int > &status, QVector< double > &currentPos, QVector< double > &targetPos)
 put the latest signalled states (current status, position and target position) to the given arguments.
 
- Public Member Functions inherited from ito::AddInBase
const Param getParamRec (const QString name, bool *nameCheckOk=NULL) const
 method to retrieve a parameter from the parameter map (m_params)
 
AddInInterfaceBasegetBasePlugin (void) const
 returns the interface of this instance.
 
ito::RetVal MoveToThread (void)
 creates new thread for the class instance and moves this instance to the new thread
 
const ito::RetVal getParamList (QMap< QString, Param > **paramNames)
 returns a map with the parameters of this plugin.
 
const ito::RetVal getExecFuncList (QMap< QString, ExecFuncParams > **funcs)
 returns list of registered additional functions
 
int getID () const
 retrieve the uniqueID of this instance
 
QString getIdentifier () const
 retrieve the unique identifier of this instance
 
virtual int hasConfDialog (void)
 determine if a configuration dialog is available
 
virtual const ito::RetVal showConfDialog (void)
 open configuration dialog
 
int createdByGUI () const
 returns true if this instance has firstly been created by the GUI
 
void setCreatedByGUI (int value)
 method to set whether this instance has been firstly created by the GUI (true) or by any other component (Python, C++, other plugin,..) (false)
 
int getRefCount (void) const
 Returns the reference counter of this instance.
 
bool hasDockWidget (void) const
 Returns true if this plugin provides a dock widget, that can be shown in the main window.
 
QDockWidget * getDockWidget (void) const
 Returns the reference to the dock widget of this plugin or NULL, if no dock widget is provided or if it is already deleted.
 
virtual void dockWidgetDefaultStyle (bool &floating, bool &visible, Qt::DockWidgetArea &defaultArea) const
 returns default style properties for dock-widget of plugin
 
int isAlive (void)
 returns the alive-flag of this plugin
 
void setAlive (void)
 sets the alive-flag to 1 ("still alive")
 
bool isInitialized (void) const
 returns in a thread-safe way the status of the m_initialized-member variable. This variable should be set to true at the end of the init-method.
 
void setInitialized (bool initialized)
 sets in a thread-safe way the status of the m_initialized-member
 
QVector< ito::AddInBase::AddInRef * > * getArgAddIns (void)
 returns vector of AddInRef instances.
 
QMutex & getUserMutex ()
 returns the user mutex of this plugin, that can be used for user-defined purposes.
 

Protected Member Functions

bool isMotorMoving () const
 checks whether any axis is still moving (moving flag is set)
 
void sendStatusUpdate (const bool statusOnly=false)
 method emits the actuatorStatusChanged signal if any slot is connected to this signal.
 
void sendTargetUpdate ()
 method emits the targetChanged signal if any slot is connected to this signal.
 
virtual ito::RetVal waitForDone (const int timeoutMS=-1, const QVector< int > axis=QVector< int >(), const int flags=0)=0
 this method must be overwritten.
 
void setStatus (int &status, const int newFlags, const int keepMask=0)
 sets status flags of given status variable
 
void setStatus (const QVector< int > &axis, const int newFlags, const int keepMask=0)
 sets status flags of the status of the given axes
 
void replaceStatus (int &status, const int existingFlag, const int replaceFlag)
 changes the status bit of the given status value from one existing to a new value.
 
void replaceStatus (const QVector< int > &axis, const int existingFlag, const int replaceFlag)
 changes the status flags of the status of the given axes from one existing to a new value
 
void initStatusAndPositions (int numAxes, int status, double currentPosition=0.0, double targetPosition=0.0, bool sendUpdateSignals=true)
 initializes the current status, current position and target position vectors to the same size and the given start values
 
bool isInterrupted ()
 returns interrupt flag (thread-safe)
 
- Protected Member Functions inherited from ito::AddInBase
 AddInBase ()
 Constructor.
 
virtual ~AddInBase ()
 Destructor.
 
void setIdentifier (const QString &identifier)
 sets the identifier of the plugin. The slot AbstractAddInDockWidget::identifierChanged is invoked if a corresponding dock widget is available.
 
void createDockWidget (QString title, QDockWidget::DockWidgetFeatures features, Qt::DockWidgetAreas allowedAreas=Qt::AllDockWidgetAreas, QWidget *content=NULL)
 Creates the dock-widget for this plugin.
 
ito::RetVal registerExecFunc (const QString funcName, const QVector< ito::Param > &paramsMand, const QVector< ito::Param > &paramsOpt, const QVector< ito::Param > &paramsOut, const QString infoString)
 Registers an additional function with specific name and default parameters.
 
void setBasePlugin (AddInInterfaceBase *base)
 sets the interface of this instance to base.
 
bool hasGuiSupport ()
 check if we have gui support
 

Protected Attributes

QVector< int > m_currentStatus
 
QVector< double > m_currentPos
 
QVector< double > m_targetPos
 
- Protected Attributes inherited from ito::AddInBase
QMap< QString, Paramm_params
 map of the available parameters
 
QString m_identifier
 unique identifier (serial number, com-port...)
 

Private Member Functions

 Q_DECLARE_PRIVATE (AddInActuator)
 

Private Attributes

QScopedPointer< AddInActuatorPrivated_ptr
 

Additional Inherited Members

- Static Public Member Functions inherited from ito::AddInBase
static int getMaximumThreadCount ()
 
static RetVal setMaximumThreadCount (int threadCount)
 

Detailed Description

base class for all actuator plugin classes

This class is one step further down the line from AddInBase. Actuator plugins must be derived from this class which is derived from AddInBase. In this class only the methods specific to actuator plugins are declared.

Member Function Documentation

◆ actuatorStatusChanged

void ito::AddInActuator::actuatorStatusChanged ( QVector< int > status,
QVector< double > actPosition )
signal

signal emitted if status or actual position of any axis has been changed.

Usually this signal can be sent using the method sendStatusUpdate(...). This method firstly checks if any slot has been connected to this signal and only fires the signal of at least one slot is connected (e.g. any docking-widget).

Usually the status and positions are taken from the member variables m_currentStatus and m_currentPos.

\params status is a vector with the length of the number of axis and each value contains a OR-combination of ito::tActuatorStatus \params actPosition is a vector with the length of the number of axis containing the actual axis positions, or length 0, if no actual positions are sended.

◆ getLastSignalledStates()

ito::RetVal ito::AddInActuator::getLastSignalledStates ( QVector< int > & status,
QVector< double > & currentPos,
QVector< double > & targetPos )

put the latest signalled states (current status, position and target position) to the given arguments.

"last signalled" signifies that whenever the signal targetChanged or actuatorStatusChanged is emitted, the current value of these states is stored and can be obtained by this method.

The call to this method is thread-safe.

Returns
ito::retOk if all states could be read, ito::retError if no status or position value has been reported up to now.

◆ initStatusAndPositions()

void ito::AddInActuator::initStatusAndPositions ( int numAxes,
int status,
double currentPosition = 0.0,
double targetPosition = 0.0,
bool sendUpdateSignals = true )
protected

initializes the current status, current position and target position vectors to the same size and the given start values

If sendUpdateSignals is true, the signals targetChanged and actuatorStatusChanged are emitted with the new size and content. In any case, the last signalled states are set to these initial values, too.

◆ isInterrupted()

bool ito::AddInActuator::isInterrupted ( )
protected

returns interrupt flag (thread-safe)

This methods returns true if the interrupt flag has been set using setInterrupt. Once this method is called, the interrupt flag is reset.

Returns
true if interrupt flag has been set, else false.
See also
setInterrupt

◆ Q_DECLARE_PRIVATE()

ito::AddInActuator::Q_DECLARE_PRIVATE ( AddInActuator )
private

‍self-managed pointer to the private class container (deletes itself if d_ptr is destroyed)

◆ replaceStatus() [1/2]

void ito::AddInActuator::replaceStatus ( const QVector< int > & axis,
const int existingFlag,
const int replaceFlag )
protected

changes the status flags of the status of the given axes from one existing to a new value

This method calls replaceStatus for the status of every given axis-number. The status is directly changed in the member variable m_currentStatus. For further information see the description of method replaceStatus (for one single status variable)

Parameters
[in]axisis the vector with axis-numbers.
[in]existingFlagis the bitmask which must be set and is replace by replaceFlag
[in]replaceFlagis the bitmask which is used for the replacement.
See also
replaceStatus

◆ replaceStatus() [2/2]

void ito::AddInActuator::replaceStatus ( int & status,
const int existingFlag,
const int replaceFlag )
protected

changes the status bit of the given status value from one existing to a new value.

If the given existingFlag bitmask of the status-value is set, it is completely replaced by the flags set by replaceFlag.

Parameters
[in,out]statusis the status variable which is changed.
[in]existingFlagis the bitmask which must be set and is replace by replaceFlag
[in]replaceFlagis the bitmask which is used for the replacement.
See also
tActuatorStatus

◆ requestStatusAndPosition

ito::RetVal ito::AddInActuator::requestStatusAndPosition ( bool sendActPosition,
bool sendTargetPos )
virtualslot

overload this function to update the current status and position values, followed by calling sendStatusUpdate and/or sendTargetUpdate

method invoked in order to force a re-emitation of the current status, the current positions (if desired) and the target positions (if desired)

This method is mainly invoked by a dock widget of the actuator such that the plugin re-emits the current values, that are then received by the dock widget.

Overload this method if you want to update the values before emitting them.

◆ resetInterrupt()

void ito::AddInActuator::resetInterrupt ( )

resets the interrupt flag (thread-safe)

call this method (even direct call from different thread is possible) if you want to reset the interrupt flag. This method is called if setOrigin, setPosAbs or setPosRel is called from Python since the interrupt flag can be set if a Python script is interrupted (depending on itom property).

◆ sendStatusUpdate()

void ito::AddInActuator::sendStatusUpdate ( const bool statusOnly = false)
protected

method emits the actuatorStatusChanged signal if any slot is connected to this signal.

The emitted values are the member variables m_currentStatus and m_currentPos (optional).

Parameters
[in]statusOnlyindicates whether the status only should be emitted or the current position vector, too. In case of status only, the current position vector is empty, hence has a length of zero. This should be considered by the slot.

◆ sendTargetUpdate()

void ito::AddInActuator::sendTargetUpdate ( )
protected

method emits the targetChanged signal if any slot is connected to this signal.

The emitted values is the member variable m_targetPos

◆ setInterrupt()

void ito::AddInActuator::setInterrupt ( )

set interrupt flag (thread-safe)

call this method (even direct call from different thread is possible) if you want to set the interrupt flag in order to stop a moving actuator. This flag has to be continuously be checked in waitForDone using the method isInterrupted, since this method only sets the flag without initiating further actions.

See also
waitForDone, isInterrupted

◆ setStatus() [1/2]

void ito::AddInActuator::setStatus ( const QVector< int > & axis,
const int newFlags,
const int keepMask = 0 )
protected

sets status flags of the status of the given axes

This method calls setStatus for the status of every given axis-number. The status is directly changed in the member variable m_currentStatus. For further information see the description of method setStatus (for one single status variable)

Parameters
[in]axisis the vector with axis-numbers.
[in]newFlagsis an OR-combination of ito::tActuatorStatus which is assigned to status.
[in]keepMaskis a mask whose bits are not deleted if they are not contained in newFlags.
See also
setStatus

◆ setStatus() [2/2]

void ito::AddInActuator::setStatus ( int & status,
const int newFlags,
const int keepMask = 0 )
protected

sets status flags of given status variable

Use this small inline method in order to set the status of given status variable. The status is an OR-combination of the enumeration ito::tActuatorStatus. You can assign a mask (keepMask). Bits within this mask will be unchanged.

Parameters
[in,out]statusis the status variable which is changed.
[in]newFlagsis an OR-combination of ito::tActuatorStatus which is assigned to status.
[in]keepMaskis a mask whose bits are not deleted if they are not contained in newFlags.
See also
tActuatorStatus

◆ targetChanged

void ito::AddInActuator::targetChanged ( QVector< double > targetPositions)
signal

signal emitted if target position of any axis has changed.

Usually this signal can be sent using the method sendTargetUpdate(). This method firstly checks if any slot has been connected to this signal and only fires the signal of at least one slot is connected (e.g. any docking-widget).

Usually the target is taken from the member variable m_targetPos.

\params targetPositions is a vector with the length of the number of axis containing the desired target positions for ALL axis.

◆ waitForDone()

virtual ito::RetVal ito::AddInActuator::waitForDone ( const int timeoutMS = -1,
const QVector< int > axis = QVector< int >(),
const int flags = 0 )
protectedpure virtual

this method must be overwritten.

WaitForDone should wait for a moving motor until the indicated axes (or all axes of nothing is indicated) have stopped or a timeout or user interruption occurred. The timeout can be given in milliseconds, or -1 if no timeout should be considered. The flag-parameter can be used for your own purpose.

Member Data Documentation

◆ m_currentPos

QVector<double> ito::AddInActuator::m_currentPos
protected

vector (same length than number of axes) containing the current position (mm or degree) of every axis. The current position should be updated with a reasonable frequency (depending on the actuator and situation)

◆ m_currentStatus

QVector<int> ito::AddInActuator::m_currentStatus
protected

vector (same length than number of axes) containing the status of every axis. The status is a combination of enumeration ito::tActuatorStatus.

◆ m_targetPos

QVector<double> ito::AddInActuator::m_targetPos
protected

vector (same length than number of axes) containing the target position (mm or degree) of every axis


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