itom 2.0.0
ito::AddInActuator Class Reference

base class for all actuator plugin classes More...

#include <addInInterface.h>

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

List of all members.

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

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.

Public Member Functions

void setInterrupt ()
 set interrupt flag (thread-safe)

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
bool isInterrupted ()
 returns interrupt flag (thread-safe)

Protected Attributes

QVector< int > m_currentStatus
QVector< double > m_currentPos
QVector< double > m_targetPos

Private Attributes

int m_nrOfStatusChangedConnections
int m_nrOfTargetChangedConnections
bool m_interruptFlag
QMutex m_interruptMutex

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

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.

status is a vector with the length of the number of axis and each value contains a OR-combination of ito::tActuatorStatus 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.

bool ito::AddInActuator::isInterrupted ( ) [inline, 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
void ito::AddInActuator::replaceStatus ( const QVector< int > &  axis,
const int  existingFlag,
const int  replaceFlag 
) [inline, 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
void ito::AddInActuator::replaceStatus ( int &  status,
const int  existingFlag,
const int  replaceFlag 
) [inline, 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
ito::RetVal ito::AddInActuator::requestStatusAndPosition ( bool  sendActPosition,
bool  sendTargetPos 
) [virtual, slot]

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.

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

void ito::AddInActuator::setInterrupt ( ) [inline]

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 continously be checked in waitForDone using the method isInterrupted, since this method only sets the flag without initiating further actions.

See also:
waitForDone, isInterrupted
void ito::AddInActuator::setStatus ( const QVector< int > &  axis,
const int  newFlags,
const int  keepMask = 0 
) [inline, 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
void ito::AddInActuator::setStatus ( int &  status,
const int  newFlags,
const int  keepMask = 0 
) [inline, 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 whithin 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
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.

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

virtual ito::RetVal ito::AddInActuator::waitForDone ( const int  timeoutMS = -1,
const QVector< int >  axis = QVector< int >(),
const int  flags = 0 
) [protected, pure 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

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)

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.

interrupt flag (true if interrupt is requested, default: false)

mutex providing a thread-safe handling of the interrupt flag (internal use only)

number of signal-slot connections which are conntected to the signal "actuatorStatusChanged"

number of signal-slot connections which are conntected to the signal "targetChanged"

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:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends