itom 2.0.0
ito::threadActuator Class Reference

Helper class to give plugin-Developer an easy access to actuators in other threads. More...

#include <helperActuator.h>

List of all members.

Public Member Functions

 threadActuator (QVector< ito::ParamBase > *parameterVector, int paramNumber)
 ~threadActuator ()
ito::RetVal setPosRel (QVector< int > axisVec, QVector< double > stepSizeVec, int timeOutMS=PLUGINWAIT)
ito::RetVal setPosAbs (QVector< int > axisVec, QVector< double > posVec, int timeOutMS=PLUGINWAIT)
ito::RetVal setPosRel (int axis, double stepSize, int timeOutMS=PLUGINWAIT)
ito::RetVal setPosAbs (int axis, double pos, int timeOutMS=PLUGINWAIT)
ito::RetVal waitForSemaphore (int timeOutMS=PLUGINWAIT)
ito::RetVal getPos (QVector< int > axisVec, QVector< double > &posVec, int timeOutMS=PLUGINWAIT)
ito::RetVal getPos (int axis, double &pos, int timeOutMS=PLUGINWAIT)
ito::RetVal getParam (ito::Param &val, int timeOutMS=PLUGINWAIT)
ito::RetVal setParam (ito::ParamBase val, int timeOutMS=PLUGINWAIT)
ito::RetVal checkAxis (int axisNum)
ito::RetVal getErrorBuf (void)

Private Member Functions

ito::RetVal securityChecks ()

Private Attributes

int axisNumbers
ito::AddInActuatorpMyMotor
ito::RetVal errorBuffer
ItomSharedSemaphoreLocker pMySemaphoreLocker

Detailed Description

Helper class to give plugin-Developer an easy access to actuators in other threads.

The threadActuator-Class can be used in filters and algorithms when a actuator in another thread is neccessary. To enable a slight asynchron usage of different hardware and algorithms the wait-Function can be executed seperatly

Author:
Wolfram Lyda (ITO)
Date:
04.2012

Constructor & Destructor Documentation

ito::threadActuator::threadActuator ( QVector< ito::ParamBase > *  parameterVector,
int  paramNumber 
)

The constructor checks if parameterVector[paramNumber] is a valid actuator. If yes and if the actuator is accessable by getParam the actuatorhandle is stored in pMyMotor. The Semaphore for the invoke-method is also allocated here. If the actuator is invalid or not accessable the pMyMotor keeps beeing NULL.

Parameters:
[in]parameterVectoris the ParameterVector (optional or mandatory) of the filter / algorithm
[in]paramNumberis the zerobased number of the actuator in the parameterlist
Returns:
(void)
See also:
threadActuator
ito::threadActuator::~threadActuator ( )

< Constructor

The destructor. Deletes the semaphore after waiting a last time.

Returns:
(void)
See also:
threadActuator

Member Function Documentation

ito::RetVal ito::threadActuator::checkAxis ( int  axisNum)

< Set the parameter of the stage

Check if a specific axis is within the axisSpace of this actuator

Parameters:
[in]axisNumAxisnumber
Returns:
retOk or retError
See also:
threadActuator
ito::RetVal ito::threadActuator::getErrorBuf ( void  )

< Check if an axis is within the axis-range

Returns the last unrecieved errors and warnings and resets the internel errorBuffer.

Returns:
retOk or retError
See also:
threadActuator
ito::RetVal ito::threadActuator::getParam ( ito::Param val,
int  timeOutMS = PLUGINWAIT 
)

< Get the position of a single axis

Get any parameter of the actuator defined by val.name. val must be initialised and name must be correct. After correct execution, val has the correct value.

Parameters:
[in|out]val Initialised tParam (correct name | in)
[in]timeOutMSTimeOut for the semaphore-wait
Returns:
retOk or retError
See also:
threadActuator
ito::RetVal ito::threadActuator::getPos ( int  axis,
double &  pos,
int  timeOutMS = PLUGINWAIT 
)

< Get the position of more than one axis

Get the position of a single axis specified by axis.

Parameters:
[in]axisNumber of the axis
[out]posposition of the axis
[in]timeOutMSTimeOut for the semaphore-wait
Returns:
retOk or retError
See also:
threadActuator
ito::RetVal ito::threadActuator::getPos ( QVector< int >  axisVec,
QVector< double > &  posVec,
int  timeOutMS = PLUGINWAIT 
)

< Wait until actuator-thread has finished the last command

Get the position of a number of axis specified by axisVec.

Parameters:
[in]axisVecNumber of the axis
[out]posVecVecotr with position of the axis
[in]timeOutMSTimeOut for the semaphore-wait
Returns:
retOk or retError
See also:
threadActuator
ito::RetVal ito::threadActuator::securityChecks ( ) [inline, private]

< Handle to the semaphore needed for thread save communication. Allocated in constructor, deleted in destructor

This function is called by every subroutine of the threadActuator. It checks if the motor-handle and the semaphore handle is zero and if the semaphore has waited after last command. If the semaphore droppes or dropped to time-out it returns retError.

Returns:
retOk or retError
See also:
threadActuator
ito::RetVal ito::threadActuator::setParam ( ito::ParamBase  val,
int  timeOutMS = PLUGINWAIT 
)

< Get the parameter of the stage

Get the parameter of the actuator defined by val.name to the value of val.

Parameters:
[in]valInitialised tParam (correct name | value)
[in]timeOutMSTimeOut for the semaphore-wait
Returns:
retOk or retError
See also:
threadActuator
ito::RetVal ito::threadActuator::setPosAbs ( int  axis,
double  pos,
int  timeOutMS = PLUGINWAIT 
)

< Move a single axis relativ to current position

Move a single axis specified by axis to the position pos. After the invoke-command this thread must wait / synchronize with the actuator-thread. Therefore the semaphore->wait is called via the function threadActuator::waitForSemaphore(timeOutMS) To enable the algorithm to process data during movement, the waitForSemaphore(timeOutMS) can be skipped by callWait = false. The threadActuator::waitForSemaphore(timeOutMS)-function must than be called by the algorithms afterwards / before the next command is send to the actuator.

Parameters:
[in]axisNumber of the axis
[in]posNew position of the axis
[in]timeOutMSTimeOut for the semaphore-wait, if (0) the waitForSemaphore is not called and must be called seperate by the algorithm
Returns:
retOk or retError
See also:
threadActuator
ito::RetVal ito::threadActuator::setPosAbs ( QVector< int >  axisVec,
QVector< double >  posVec,
int  timeOutMS = PLUGINWAIT 
)

< Move more than on axis relativ to current position

Move the axis in axisVec to the positions given in posVec. The axisVec and posVec must be same size. After the invoke-command this thread must wait / synchronize with the actuator-thread. Therefore the semaphore->wait is called via the function threadActuator::waitForSemaphore(timeOutMS) To enable the algorithm to process data during movement, the waitForSemaphore(timeOutMS) can be skipped by callWait = false. The threadActuator::waitForSemaphore(timeOutMS)-function must than be called by the algorithms afterwards / before the next command is send to the actuator.

Parameters:
[in]axisVecVector with the axis to move
[in]posVecVector with the new absolute positions
[in]timeOutMSTimeOut for the semaphore-wait, if (0) the waitForSemaphore is not called and must be called seperate by the algorithm
Returns:
retOk or retError
See also:
threadActuator
ito::RetVal ito::threadActuator::setPosRel ( int  axis,
double  stepSize,
int  timeOutMS = PLUGINWAIT 
)

< Move more than on axis absolute

Move a single axis specified by axis with a distance defined in stepSize relative to current position. After the invoke-command this thread must wait / synchronize with the actuator-thread. Therefore the semaphore->wait is called via the function threadActuator::waitForSemaphore(timeOutMS) To enable the algorithm to process data during movement, the waitForSemaphore(timeOutMS) can be skipped by callWait = false. The threadActuator::waitForSemaphore(timeOutMS)-function must than be called by the algorithms afterwards / before the next command is send to the actuator.

Parameters:
[in]axisNumber of the axis
[in]stepSizeDistances from current position
[in]timeOutMSTimeOut for the semaphore-wait, if (0) the waitForSemaphore is not called and must be called seperate by the algorithm
Returns:
retOk or retError
See also:
threadActuator
ito::RetVal ito::threadActuator::setPosRel ( QVector< int >  axisVec,
QVector< double >  stepSizeVec,
int  timeOutMS = PLUGINWAIT 
)

< Desctructor

Move the axis in axisVec with a distance defined in stepSizeVec relative to current position. The axisVec and stepSizeVec must be same size. After the invoke-command this thread must wait / synchronize with the actuator-thread. Therefore the semaphore->wait is called via the function threadActuator::waitForSemaphore(timeOutMS) To enable the algorithm to process data during movement, the waitForSemaphore(timeOutMS) can be skipped by callWait = false. The threadActuator::waitForSemaphore(timeOutMS)-function must than be called by the algorithms afterwards / before the next command is send to the actuator.

Parameters:
[in]axisVecVector with the axis to move
[in]stepSizeVecVector with the distances for every axis
[in]timeOutMSTimeOut for the semaphore-wait, if (0) the waitForSemaphore is not called and must be called seperate by the algorithm
Returns:
retOk or retError
See also:
threadActuator
ito::RetVal ito::threadActuator::waitForSemaphore ( int  timeOutMS = PLUGINWAIT)

< Move a single axi absolute

After the invoke-command this thread must wait / be synchronize with the actuator-thread. Therefore the wait-Function of pMySemaphore is called. If the actuator do not answer within timeOutMS and the pMyMotor is not alive anymore, the function returns a timeout.

Parameters:
[in]timeOutMSTimeOut for the semaphore-wait
Returns:
retOk or retError
See also:
threadActuator

Member Data Documentation

< Handle to the actuator

< Number of axis of the actuator

< Buffer containing unrecieved errors from the semaphore


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends