Updated turboPmac version
This commit is contained in:
@ -157,17 +157,8 @@ asynStatus detectorTowerAngleAxis::init() {
|
||||
}
|
||||
|
||||
// Initialize the motorStatusMoving flag
|
||||
status = setIntegerParam(pC_->motorStatusMoving(), 0);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusMoving_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
status = setIntegerParam(pC_->changeStateRBV(), positionState == 2);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "changeStateRBV", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorStatusMoving, false);
|
||||
setAxisParamChecked(this, changeStateRBV, positionState == 2);
|
||||
|
||||
return callParamCallbacks();
|
||||
}
|
||||
@ -181,13 +172,7 @@ asynStatus detectorTowerAngleAxis::poll(bool *moving) {
|
||||
if (axisNo() < liftAxis()->axisNo() && axisNo() < supportAxis()->axisNo()) {
|
||||
status = pC_->pollDetectorAxes(moving, this, liftAxis(), supportAxis());
|
||||
} else {
|
||||
status = pC_->getIntegerParam(axisNo(), pC_->motorStatusMoving(),
|
||||
(int *)moving);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusMoving",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
getAxisParamChecked(this, motorStatusMoving, &moving);
|
||||
}
|
||||
setWasMoving(*moving);
|
||||
return status;
|
||||
@ -206,13 +191,7 @@ asynStatus detectorTowerAngleAxis::doMove(double position, int relative,
|
||||
double max_velocity,
|
||||
double acceleration) {
|
||||
double motorRecResolution = 0.0;
|
||||
asynStatus plStatus = pC_->getDoubleParam(
|
||||
axisNo_, pC_->motorRecResolution(), &motorRecResolution);
|
||||
if (plStatus != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(plStatus, "motorRecResolution_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
getAxisParamChecked(this, motorRecResolution, &motorRecResolution);
|
||||
|
||||
// Signal to the deferredMovementCollectorLoop that a movement should be
|
||||
// started to the defined target position.
|
||||
@ -237,12 +216,7 @@ asynStatus detectorTowerAngleAxis::startCombinedMove() {
|
||||
|
||||
// =========================================================================
|
||||
|
||||
plStatus =
|
||||
pC_->getIntegerParam(axisNo_, pC_->positionStateRBV(), &positionState);
|
||||
if (plStatus != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(plStatus, "positionStateRBV_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
getAxisParamChecked(this, positionStateRBV, &positionState);
|
||||
|
||||
// If the axis is in changer position, it must be moved into working
|
||||
// position before any move can be started.
|
||||
@ -259,20 +233,9 @@ asynStatus detectorTowerAngleAxis::startCombinedMove() {
|
||||
pC_->getMsgPrintControl().getSuffix());
|
||||
}
|
||||
if (isInChangerPos) {
|
||||
|
||||
plStatus = setStringParam(pC_->motorMessageText(),
|
||||
setAxisParamChecked(this, motorMessageText,
|
||||
"Move the axis to working state first.");
|
||||
if (plStatus != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(plStatus, "motorMessageText",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
plStatus = setIntegerParam(pC_->motorStatusProblem(), true);
|
||||
if (plStatus != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(plStatus, "motorStatusProblem_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorStatusProblem, true);
|
||||
|
||||
callParamCallbacks();
|
||||
startingDeferredMovement_ = false;
|
||||
@ -301,12 +264,7 @@ asynStatus detectorTowerAngleAxis::startCombinedMove() {
|
||||
"target position %lf failed.\n",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
motorCoordinatesPosition);
|
||||
plStatus = setIntegerParam(pC_->motorStatusProblem(), true);
|
||||
if (plStatus != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(plStatus, "motorStatusProblem_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorStatusProblem, true);
|
||||
callParamCallbacks();
|
||||
}
|
||||
|
||||
@ -334,12 +292,7 @@ asynStatus detectorTowerAngleAxis::stop(double acceleration) {
|
||||
"failed.\n",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||
|
||||
plStatus = setIntegerParam(pC_->motorStatusProblem(), true);
|
||||
if (plStatus != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(plStatus, "motorStatusProblem_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorStatusProblem, true);
|
||||
return asynError;
|
||||
}
|
||||
|
||||
@ -352,11 +305,7 @@ asynStatus detectorTowerAngleAxis::stop(double acceleration) {
|
||||
|
||||
// The detector tower axis uses absolute encoders
|
||||
asynStatus detectorTowerAngleAxis::readEncoderType() {
|
||||
asynStatus status = setStringParam(pC_->encoderType(), AbsoluteEncoder);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "encoderType_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, encoderType, AbsoluteEncoder);
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
@ -368,9 +317,6 @@ detectorTowerAngleAxis::toggleWorkingChangerState(bool toChangingPosition) {
|
||||
// Status of read-write-operations of ASCII commands to the controller
|
||||
asynStatus rwStatus = asynSuccess;
|
||||
|
||||
// Status of parameter library operations
|
||||
asynStatus plStatus = asynSuccess;
|
||||
|
||||
bool moving = false;
|
||||
int positionState = 0;
|
||||
|
||||
@ -381,12 +327,7 @@ detectorTowerAngleAxis::toggleWorkingChangerState(bool toChangingPosition) {
|
||||
return rwStatus;
|
||||
}
|
||||
|
||||
plStatus =
|
||||
pC_->getIntegerParam(axisNo_, pC_->positionStateRBV(), &positionState);
|
||||
if (plStatus != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(plStatus, "positionStateRBV_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
getAxisParamChecked(this, positionStateRBV, &positionState);
|
||||
|
||||
if (moving) {
|
||||
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||
@ -396,21 +337,10 @@ detectorTowerAngleAxis::toggleWorkingChangerState(bool toChangingPosition) {
|
||||
toChangingPosition ? "changer" : "working",
|
||||
pC_->getMsgPrintControl().getSuffix());
|
||||
|
||||
plStatus = setStringParam(
|
||||
pC_->motorMessageText(),
|
||||
setAxisParamChecked(
|
||||
this, motorMessageText,
|
||||
"Axis cannot be moved to changer position while it is moving.");
|
||||
if (plStatus != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(plStatus, "motorMessageText_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
plStatus = setIntegerParam(pC_->changeStateRBV(), !toChangingPosition);
|
||||
if (plStatus != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(plStatus, "changeStateRBV",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, changeStateRBV, !toChangingPosition);
|
||||
|
||||
return asynError;
|
||||
}
|
||||
@ -428,12 +358,7 @@ detectorTowerAngleAxis::toggleWorkingChangerState(bool toChangingPosition) {
|
||||
pC_->getMsgPrintControl().getSuffix());
|
||||
|
||||
// Update the PV anyway, even though nothing changed.
|
||||
plStatus = setIntegerParam(pC_->changeStateRBV(), toChangingPosition);
|
||||
if (plStatus != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(plStatus, "changeStateRBV",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, changeStateRBV, toChangingPosition);
|
||||
|
||||
return asynSuccess;
|
||||
}
|
||||
@ -445,22 +370,8 @@ detectorTowerAngleAxis::toggleWorkingChangerState(bool toChangingPosition) {
|
||||
rwStatus = pC_->writeRead(axisNo_, "P350=3", response, 0);
|
||||
}
|
||||
|
||||
if (plStatus != asynSuccess) {
|
||||
plStatus = setIntegerParam(pC_->changeStateRBV(), !toChangingPosition);
|
||||
if (plStatus != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(plStatus, "changeStateRBV",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
plStatus = setIntegerParam(pC_->changeStateRBV(), toChangingPosition);
|
||||
if (plStatus != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(plStatus, "changeStateRBV", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
return rwStatus;
|
||||
setAxisParamChecked(this, changeStateRBV, toChangingPosition);
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
asynStatus detectorTowerAngleAxis::adjustOrigin(double newOrigin) {
|
||||
@ -472,12 +383,7 @@ asynStatus detectorTowerAngleAxis::adjustOrigin(double newOrigin) {
|
||||
|
||||
// =========================================================================
|
||||
|
||||
status =
|
||||
pC_->getIntegerParam(axisNo_, pC_->positionStateRBV(), &positionState);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "positionStateRBV_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
getAxisParamChecked(this, positionStateRBV, &positionState);
|
||||
|
||||
// If the axis is in changer position, it must be moved into working
|
||||
// position before any move can be started.
|
||||
@ -506,12 +412,7 @@ asynStatus detectorTowerAngleAxis::adjustOrigin(double newOrigin) {
|
||||
"angle origin %lf failed.\n",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
newOrigin);
|
||||
status = setIntegerParam(pC_->motorStatusProblem(), true);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusProblem_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorStatusProblem, true);
|
||||
}
|
||||
|
||||
return status;
|
||||
@ -523,12 +424,7 @@ asynStatus detectorTowerAngleAxis::doReset() {
|
||||
asynStatus plStatus = asynSuccess;
|
||||
int positionState = 0;
|
||||
|
||||
plStatus =
|
||||
pC_->getIntegerParam(axisNo_, pC_->positionStateRBV(), &positionState);
|
||||
if (plStatus != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(plStatus, "positionStateRBV_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
getAxisParamChecked(this, positionStateRBV, &positionState);
|
||||
|
||||
// Reset the deferred movement flags
|
||||
startingDeferredMovement_ = false;
|
||||
|
@ -1,12 +1,12 @@
|
||||
#ifndef detectorTowerAngleAxis_H
|
||||
#define detectorTowerAngleAxis_H
|
||||
#include "detectorTowerController.h"
|
||||
#include "turboPmacAxis.h"
|
||||
#include <errlog.h>
|
||||
|
||||
// Forward declaration of the controller class to resolve the cyclic dependency
|
||||
// between the controller and the axis .h-file. See
|
||||
// https://en.cppreference.com/w/cpp/language/class.
|
||||
class detectorTowerController;
|
||||
class detectorTowerLiftAxis;
|
||||
class detectorTowerSupportAxis;
|
||||
|
||||
@ -164,6 +164,11 @@ class detectorTowerAngleAxis : public turboPmacAxis {
|
||||
*/
|
||||
int error_;
|
||||
|
||||
/**
|
||||
* @brief Return a pointer to the axis controller
|
||||
*/
|
||||
virtual detectorTowerController *pController() override { return pC_; };
|
||||
|
||||
protected:
|
||||
detectorTowerController *pC_;
|
||||
detectorTowerLiftAxis *liftAxis_;
|
||||
|
@ -336,37 +336,13 @@ asynStatus detectorTowerController::pollDetectorAxes(
|
||||
|
||||
The motorStatusProblem_ field changes the motor record fields SEVR and STAT.
|
||||
*/
|
||||
plStatus = angleAxis->setIntegerParam(motorStatusProblem(), false);
|
||||
if (plStatus != asynSuccess) {
|
||||
paramLibAccessFailed(plStatus, "motorStatusProblem_", angleAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = liftAxis->setIntegerParam(motorStatusProblem(), false);
|
||||
if (plStatus != asynSuccess) {
|
||||
paramLibAccessFailed(plStatus, "motorStatusProblem_", liftAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = supportAxis->setIntegerParam(motorStatusProblem(), false);
|
||||
if (plStatus != asynSuccess) {
|
||||
paramLibAccessFailed(plStatus, "motorStatusProblem_", supportAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis, motorStatusProblem, false);
|
||||
setAxisParamChecked(liftAxis, motorStatusProblem, false);
|
||||
setAxisParamChecked(supportAxis, motorStatusProblem, false);
|
||||
|
||||
plStatus = angleAxis->setIntegerParam(motorStatusCommsError(), false);
|
||||
if (plStatus != asynSuccess) {
|
||||
paramLibAccessFailed(plStatus, "motorStatusCommsError_", angleAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = liftAxis->setIntegerParam(motorStatusCommsError(), false);
|
||||
if (plStatus != asynSuccess) {
|
||||
paramLibAccessFailed(plStatus, "motorStatusCommsError_", liftAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = supportAxis->setIntegerParam(motorStatusCommsError(), false);
|
||||
if (plStatus != asynSuccess) {
|
||||
paramLibAccessFailed(plStatus, "motorStatusCommsError_", supportAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis, motorStatusCommsError, false);
|
||||
setAxisParamChecked(liftAxis, motorStatusCommsError, false);
|
||||
setAxisParamChecked(supportAxis, motorStatusCommsError, false);
|
||||
|
||||
// Read the previous motor positions
|
||||
plStatus = angleAxis->motorPosition(&prevAngle);
|
||||
@ -427,20 +403,12 @@ asynStatus detectorTowerController::pollDetectorAxes(
|
||||
*/
|
||||
|
||||
// Angle
|
||||
plStatus = getDoubleParam(angleAxisNo, motorLimitsOffset(), &limitsOffset);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorLimitsOffset_", angleAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
getAxisParamChecked(angleAxis, motorLimitsOffset, &limitsOffset);
|
||||
angleHighLimit = angleHighLimit - limitsOffset;
|
||||
angleLowLimit = angleLowLimit + limitsOffset;
|
||||
|
||||
// Lift
|
||||
plStatus = getDoubleParam(liftAxisNo, motorLimitsOffset(), &limitsOffset);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorLimitsOffset_", liftAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
getAxisParamChecked(liftAxis, motorLimitsOffset, &limitsOffset);
|
||||
liftHighLimit = liftHighLimit - limitsOffset;
|
||||
liftLowLimit = liftLowLimit + limitsOffset;
|
||||
|
||||
@ -812,258 +780,84 @@ asynStatus detectorTowerController::pollDetectorAxes(
|
||||
Does the paramLib already contain an error message? If either this is the
|
||||
case or if error != 0, report a status problem for all axes.
|
||||
*/
|
||||
getStringParam(angleAxisNo, motorMessageText(), sizeof(waitingErrorMessage),
|
||||
waitingErrorMessage);
|
||||
getAxisParamChecked(angleAxis, motorMessageText, &waitingErrorMessage);
|
||||
|
||||
if (error != 0 || errorMessage[0] != '\0' ||
|
||||
waitingErrorMessage[0] != '\0') {
|
||||
|
||||
plStatus = angleAxis->setIntegerParam(motorStatusProblem(), true);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorStatusProblem_",
|
||||
angleAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
plStatus = liftAxis->setIntegerParam(motorStatusProblem(), true);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorStatusProblem_",
|
||||
liftAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
plStatus = supportAxis->setIntegerParam(motorStatusProblem(), true);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorStatusProblem_",
|
||||
supportAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis, motorStatusProblem, true);
|
||||
setAxisParamChecked(liftAxis, motorStatusProblem, true);
|
||||
setAxisParamChecked(supportAxis, motorStatusProblem, true);
|
||||
}
|
||||
|
||||
// Update the error message text with the one created in this poll (in case
|
||||
// it is not empty).
|
||||
if (errorMessage[0] != '\0') {
|
||||
plStatus = angleAxis->setStringParam(motorMessageText(), errorMessage);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorMessageText_",
|
||||
angleAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
plStatus = liftAxis->setStringParam(motorMessageText(), errorMessage);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorMessageText_",
|
||||
liftAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
plStatus =
|
||||
supportAxis->setStringParam(motorMessageText(), errorMessage);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorMessageText_",
|
||||
supportAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis, motorMessageText, errorMessage);
|
||||
setAxisParamChecked(liftAxis, motorMessageText, errorMessage);
|
||||
setAxisParamChecked(supportAxis, motorMessageText, errorMessage);
|
||||
}
|
||||
|
||||
// Update the working position state PV
|
||||
plStatus = angleAxis->setIntegerParam(positionStateRBV(), positionState);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "positionStateRBV_", angleAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = liftAxis->setIntegerParam(positionStateRBV(), positionState);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "positionStateRBV_", liftAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = supportAxis->setIntegerParam(positionStateRBV(), positionState);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "positionStateRBV_",
|
||||
supportAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis, positionStateRBV, positionState);
|
||||
setAxisParamChecked(liftAxis, positionStateRBV, positionState);
|
||||
setAxisParamChecked(supportAxis, positionStateRBV, positionState);
|
||||
|
||||
// The axes are always enabled
|
||||
plStatus = angleAxis->setIntegerParam(motorEnableRBV(), 1);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorEnableRBV_", angleAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = liftAxis->setIntegerParam(motorEnableRBV(), 1);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorEnableRBV_", liftAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = supportAxis->setIntegerParam(motorEnableRBV(), 1);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorEnableRBV_", supportAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis, motorEnableRBV, true);
|
||||
setAxisParamChecked(liftAxis, motorEnableRBV, true);
|
||||
setAxisParamChecked(supportAxis, motorEnableRBV, true);
|
||||
|
||||
// Are the axes currently moving?
|
||||
plStatus = angleAxis->setIntegerParam(motorStatusMoving(), *moving);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorStatusMoving_", angleAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = liftAxis->setIntegerParam(motorStatusMoving(), *moving);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorStatusMoving_", liftAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = supportAxis->setIntegerParam(motorStatusMoving(), *moving);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorStatusMoving_",
|
||||
supportAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis, motorStatusMoving, *moving);
|
||||
setAxisParamChecked(liftAxis, motorStatusMoving, *moving);
|
||||
setAxisParamChecked(supportAxis, motorStatusMoving, *moving);
|
||||
|
||||
// Is the axis movement done?
|
||||
plStatus = angleAxis->setIntegerParam(motorStatusDone(), !(*moving));
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorStatusDone_", angleAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = liftAxis->setIntegerParam(motorStatusDone(), !(*moving));
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorStatusDone_", liftAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = supportAxis->setIntegerParam(motorStatusDone(), !(*moving));
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorStatusDone_", supportAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis, motorStatusDone, !(*moving));
|
||||
setAxisParamChecked(liftAxis, motorStatusDone, !(*moving));
|
||||
setAxisParamChecked(supportAxis, motorStatusDone, !(*moving));
|
||||
|
||||
// In which direction are the axes currently moving?
|
||||
plStatus = angleAxis->setIntegerParam(motorStatusDirection(), angleDir);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorStatusDirection_",
|
||||
angleAxisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = liftAxis->setIntegerParam(motorStatusDirection(), liftDir);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorStatusDirection_",
|
||||
liftAxisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis, motorStatusDirection, angleDir);
|
||||
setAxisParamChecked(liftAxis, motorStatusDirection, liftDir);
|
||||
// Using the lift direction for the support axis is done on purpose!
|
||||
plStatus = supportAxis->setIntegerParam(motorStatusDirection(), liftDir);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorStatusDirection_",
|
||||
supportAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(supportAxis, motorStatusDirection, liftDir);
|
||||
|
||||
// High limits from hardware
|
||||
plStatus =
|
||||
setDoubleParam(angleAxisNo, motorHighLimitFromDriver(), angleHighLimit);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorHighLimitFromDriver",
|
||||
angleAxisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus =
|
||||
setDoubleParam(liftAxisNo, motorHighLimitFromDriver(), liftHighLimit);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorHighLimitFromDriver",
|
||||
liftAxisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis, motorHighLimitFromDriver, angleHighLimit);
|
||||
setAxisParamChecked(liftAxis, motorHighLimitFromDriver, liftHighLimit);
|
||||
// Using the lift high limit for the support axis is done on purpose!
|
||||
plStatus = setDoubleParam(supportAxisNo, motorHighLimitFromDriver(),
|
||||
liftHighLimit);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorHighLimitFromDriver",
|
||||
supportAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(supportAxis, motorHighLimitFromDriver, liftHighLimit);
|
||||
|
||||
// Low limits from hardware
|
||||
plStatus =
|
||||
setDoubleParam(angleAxisNo, motorLowLimitFromDriver(), angleLowLimit);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorLowLimitFromDriver",
|
||||
angleAxisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus =
|
||||
setDoubleParam(liftAxisNo, motorLowLimitFromDriver(), liftLowLimit);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorLowLimitFromDriver",
|
||||
liftAxisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis, motorLowLimitFromDriver, angleLowLimit);
|
||||
setAxisParamChecked(liftAxis, motorLowLimitFromDriver, liftLowLimit);
|
||||
// Using the lift low limit for the support axis is done on purpose!
|
||||
plStatus =
|
||||
setDoubleParam(supportAxisNo, motorLowLimitFromDriver(), liftLowLimit);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorLowLimitFromDriver",
|
||||
supportAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(supportAxis, motorLowLimitFromDriver, liftLowLimit);
|
||||
|
||||
// Write the motor origin
|
||||
plStatus = setDoubleParam(angleAxisNo, motorOrigin(), angleOrigin);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorOrigin", angleAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = setDoubleParam(liftAxisNo, motorOrigin(), liftOrigin);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorOrigin", liftAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = setDoubleParam(supportAxisNo, motorOrigin(), supportOrigin);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "supportOrigin", supportAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis, motorOrigin, angleOrigin);
|
||||
setAxisParamChecked(liftAxis, motorOrigin, liftOrigin);
|
||||
setAxisParamChecked(supportAxis, motorOrigin, supportOrigin);
|
||||
|
||||
// Origin adjustment high limit
|
||||
plStatus =
|
||||
setDoubleParam(angleAxisNo, motorAdjustOriginHighLimitFromDriver(),
|
||||
setAxisParamChecked(angleAxis, motorAdjustOriginHighLimitFromDriver,
|
||||
angleAdjustOriginHighLimit);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorOriginHighLimitFromDriver",
|
||||
angleAxisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus =
|
||||
setDoubleParam(liftAxisNo, motorAdjustOriginHighLimitFromDriver(),
|
||||
setAxisParamChecked(liftAxis, motorAdjustOriginHighLimitFromDriver,
|
||||
liftAdjustOriginHighLimit);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorOriginHighLimitFromDriver",
|
||||
liftAxisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
// Using the lift high limit for the support axis is done on purpose!
|
||||
plStatus =
|
||||
setDoubleParam(supportAxisNo, motorAdjustOriginHighLimitFromDriver(),
|
||||
setAxisParamChecked(supportAxis, motorAdjustOriginHighLimitFromDriver,
|
||||
liftAdjustOriginHighLimit);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorOriginHighLimitFromDriver",
|
||||
supportAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
// Origin adjustment low limit
|
||||
plStatus =
|
||||
setDoubleParam(angleAxisNo, motorAdjustOriginLowLimitFromDriver(),
|
||||
setAxisParamChecked(angleAxis, motorAdjustOriginLowLimitFromDriver,
|
||||
angleAdjustOriginLowLimit);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus,
|
||||
"motorAdjustOriginLowLimitFromDriver",
|
||||
angleAxisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = setDoubleParam(liftAxisNo, motorAdjustOriginLowLimitFromDriver(),
|
||||
setAxisParamChecked(liftAxis, motorAdjustOriginLowLimitFromDriver,
|
||||
liftAdjustOriginLowLimit);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus,
|
||||
"motorAdjustOriginLowLimitFromDriver",
|
||||
liftAxisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
// Using the lift low limit for the support axis is done on purpose!
|
||||
plStatus =
|
||||
setDoubleParam(supportAxisNo, motorAdjustOriginLowLimitFromDriver(),
|
||||
setAxisParamChecked(supportAxis, motorAdjustOriginLowLimitFromDriver,
|
||||
liftAdjustOriginLowLimit);
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(
|
||||
plStatus, "motorAdjustOriginLowLimitFromDriver", supportAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
// Axes positions
|
||||
plStatus = angleAxis->setMotorPosition(angle);
|
||||
@ -1137,22 +931,9 @@ asynStatus detectorTowerController::pollDetectorAxes(
|
||||
one poll cycle, but are cleared afterwards. Persisting error messages will
|
||||
be recreated during each poll.
|
||||
*/
|
||||
plStatus = angleAxis->setStringParam(motorMessageText(), "");
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorMessageText_", angleAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = liftAxis->setStringParam(motorMessageText(), "");
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorMessageText_", liftAxisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
plStatus = supportAxis->setStringParam(motorMessageText(), "");
|
||||
if (plStatus != asynSuccess) {
|
||||
return paramLibAccessFailed(plStatus, "motorMessageText_",
|
||||
supportAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis, motorMessageText, "");
|
||||
setAxisParamChecked(liftAxis, motorMessageText, "");
|
||||
setAxisParamChecked(supportAxis, motorMessageText, "");
|
||||
|
||||
return pollStatus;
|
||||
}
|
||||
|
@ -111,11 +111,7 @@ asynStatus detectorTowerLiftAxis::init() {
|
||||
}
|
||||
|
||||
// Initialize the motorStatusMoving flag
|
||||
status = setIntegerParam(pC_->motorStatusMoving(), 0);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusMoving_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorStatusMoving, false);
|
||||
|
||||
// Check if we are currently in the changer position and update the PV
|
||||
// accordingly
|
||||
@ -126,11 +122,7 @@ asynStatus detectorTowerLiftAxis::init() {
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
status = setIntegerParam(pC_->changeStateRBV(), positionState == 2);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "changeStateRBV", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, changeStateRBV, positionState == 2);
|
||||
|
||||
return callParamCallbacks();
|
||||
}
|
||||
@ -146,13 +138,7 @@ asynStatus detectorTowerLiftAxis::poll(bool *moving) {
|
||||
status = pC_->pollDetectorAxes(moving, angleAxis(), this,
|
||||
angleAxis()->supportAxis());
|
||||
} else {
|
||||
status = pC_->getIntegerParam(axisNo(), pC_->motorStatusMoving(),
|
||||
(int *)moving);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusMoving",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
getAxisParamChecked(this, motorStatusMoving, &moving);
|
||||
}
|
||||
setWasMoving(*moving);
|
||||
return status;
|
||||
@ -172,13 +158,7 @@ asynStatus detectorTowerLiftAxis::doMove(double position, int relative,
|
||||
double acceleration) {
|
||||
|
||||
double motorRecResolution = 0.0;
|
||||
asynStatus plStatus = pC_->getDoubleParam(
|
||||
axisNo_, pC_->motorRecResolution(), &motorRecResolution);
|
||||
if (plStatus != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(plStatus, "motorRecResolution_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
getAxisParamChecked(this, motorRecResolution, &motorRecResolution);
|
||||
|
||||
// Signal to the deferredMovementCollectorLoop (of the
|
||||
// detectorTowerAngleAxis) that a movement should be started to the
|
||||
@ -208,12 +188,7 @@ asynStatus detectorTowerLiftAxis::adjustOrigin(double newOrigin) {
|
||||
|
||||
// =========================================================================
|
||||
|
||||
status =
|
||||
pC_->getIntegerParam(axisNo_, pC_->positionStateRBV(), &positionState);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "positionStateRBV_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
getAxisParamChecked(this, positionStateRBV, &positionState);
|
||||
|
||||
// If the axis is in changer position, it must be moved into working
|
||||
// position before any move can be started.
|
||||
@ -242,12 +217,7 @@ asynStatus detectorTowerLiftAxis::adjustOrigin(double newOrigin) {
|
||||
"lift origin %lf failed.\n",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
newOrigin);
|
||||
status = setIntegerParam(pC_->motorStatusProblem(), true);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusProblem_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorStatusProblem, true);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -1,11 +1,11 @@
|
||||
#ifndef detectorTowerLiftAxis_H
|
||||
#define detectorTowerLiftAxis_H
|
||||
#include "detectorTowerController.h"
|
||||
#include "turboPmacAxis.h"
|
||||
|
||||
// Forward declaration of the controller class to resolve the cyclic dependency
|
||||
// between the controller and the axis .h-file. See
|
||||
// https://en.cppreference.com/w/cpp/language/class.
|
||||
class detectorTowerController;
|
||||
class detectorTowerAngleAxis;
|
||||
|
||||
class detectorTowerLiftAxis : public turboPmacAxis {
|
||||
@ -110,6 +110,11 @@ class detectorTowerLiftAxis : public turboPmacAxis {
|
||||
*/
|
||||
asynStatus readEncoderType();
|
||||
|
||||
/**
|
||||
* @brief Return a pointer to the axis controller
|
||||
*/
|
||||
virtual detectorTowerController *pController() override { return pC_; };
|
||||
|
||||
protected:
|
||||
detectorTowerController *pC_;
|
||||
detectorTowerAngleAxis *angleAxis_;
|
||||
|
@ -111,11 +111,7 @@ asynStatus detectorTowerSupportAxis::init() {
|
||||
}
|
||||
|
||||
// Initialize the motorStatusMoving flag
|
||||
status = setIntegerParam(pC_->motorStatusMoving(), 0);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusMoving_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorStatusMoving, false);
|
||||
|
||||
// Check if we are currently in the changer position and update the PV
|
||||
// accordingly
|
||||
@ -126,12 +122,7 @@ asynStatus detectorTowerSupportAxis::init() {
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
status = setIntegerParam(pC_->changeStateRBV(), positionState == 2);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "changeStateRBV", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
setAxisParamChecked(this, changeStateRBV, positionState == 2);
|
||||
return callParamCallbacks();
|
||||
}
|
||||
|
||||
@ -147,13 +138,7 @@ asynStatus detectorTowerSupportAxis::poll(bool *moving) {
|
||||
status = pC_->pollDetectorAxes(moving, angleAxis(),
|
||||
angleAxis()->liftAxis(), this);
|
||||
} else {
|
||||
status = pC_->getIntegerParam(axisNo(), pC_->motorStatusMoving(),
|
||||
(int *)moving);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusMoving",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
getAxisParamChecked(this, motorStatusMoving, &moving);
|
||||
}
|
||||
setWasMoving(*moving);
|
||||
return status;
|
||||
@ -186,12 +171,7 @@ asynStatus detectorTowerSupportAxis::adjustOrigin(double newOrigin) {
|
||||
|
||||
// =========================================================================
|
||||
|
||||
status =
|
||||
pC_->getIntegerParam(axisNo_, pC_->positionStateRBV(), &positionState);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "positionStateRBV_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
getAxisParamChecked(this, positionStateRBV, &positionState);
|
||||
|
||||
// If the axis is in changer position, it must be moved into working
|
||||
// position before any move can be started.
|
||||
@ -220,12 +200,8 @@ asynStatus detectorTowerSupportAxis::adjustOrigin(double newOrigin) {
|
||||
"lift origin %lf failed.\n",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
newOrigin);
|
||||
status = setIntegerParam(pC_->motorStatusProblem(), true);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusProblem_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
setAxisParamChecked(this, motorStatusProblem, true);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -1,11 +1,11 @@
|
||||
#ifndef detectorTowerSupportAxis_H
|
||||
#define detectorTowerSupportAxis_H
|
||||
#include "detectorTowerController.h"
|
||||
#include "turboPmacAxis.h"
|
||||
|
||||
// Forward declaration of the controller class to resolve the cyclic dependency
|
||||
// between the controller and the axis .h-file. See
|
||||
// https://en.cppreference.com/w/cpp/language/class.
|
||||
class detectorTowerController;
|
||||
class detectorTowerAngleAxis;
|
||||
|
||||
/**
|
||||
@ -112,6 +112,11 @@ class detectorTowerSupportAxis : public turboPmacAxis {
|
||||
*/
|
||||
asynStatus readEncoderType();
|
||||
|
||||
/**
|
||||
* @brief Return a pointer to the axis controller
|
||||
*/
|
||||
virtual detectorTowerController *pController() override { return pC_; };
|
||||
|
||||
protected:
|
||||
detectorTowerController *pC_;
|
||||
detectorTowerAngleAxis *angleAxis_;
|
||||
|
Reference in New Issue
Block a user