itom 2.0.0
|
Helper class to give plugin-Developer an easy access to actuators in other threads. More...
#include <helperActuator.h>
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::AddInActuator * | pMyMotor |
ito::RetVal | errorBuffer |
ItomSharedSemaphoreLocker | pMySemaphoreLocker |
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
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.
[in] | parameterVector | is the ParameterVector (optional or mandatory) of the filter / algorithm |
[in] | paramNumber | is the zerobased number of the actuator in the parameterlist |
ito::threadActuator::~threadActuator | ( | ) |
< Constructor
The destructor. Deletes the semaphore after waiting a last time.
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
[in] | axisNum | Axisnumber |
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.
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.
[in|out] | val Initialised tParam (correct name | in) | |
[in] | timeOutMS | TimeOut for the semaphore-wait |
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.
[in] | axis | Number of the axis |
[out] | pos | position of the axis |
[in] | timeOutMS | TimeOut for the semaphore-wait |
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.
[in] | axisVec | Number of the axis |
[out] | posVec | Vecotr with position of the axis |
[in] | timeOutMS | TimeOut for the semaphore-wait |
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.
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.
[in] | val | Initialised tParam (correct name | value) |
[in] | timeOutMS | TimeOut for the semaphore-wait |
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.
[in] | axis | Number of the axis |
[in] | pos | New position of the axis |
[in] | timeOutMS | TimeOut for the semaphore-wait, if (0) the waitForSemaphore is not called and must be called seperate by the algorithm |
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.
[in] | axisVec | Vector with the axis to move |
[in] | posVec | Vector with the new absolute positions |
[in] | timeOutMS | TimeOut for the semaphore-wait, if (0) the waitForSemaphore is not called and must be called seperate by the algorithm |
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.
[in] | axis | Number of the axis |
[in] | stepSize | Distances from current position |
[in] | timeOutMS | TimeOut for the semaphore-wait, if (0) the waitForSemaphore is not called and must be called seperate by the algorithm |
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.
[in] | axisVec | Vector with the axis to move |
[in] | stepSizeVec | Vector with the distances for every axis |
[in] | timeOutMS | TimeOut for the semaphore-wait, if (0) the waitForSemaphore is not called and must be called seperate by the algorithm |
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.
[in] | timeOutMS | TimeOut for the semaphore-wait |
ito::RetVal ito::threadActuator::errorBuffer [private] |
< Handle to the actuator
ito::AddInActuator* ito::threadActuator::pMyMotor [private] |
< Number of axis of the actuator
< Buffer containing unrecieved errors from the semaphore