Compare commits
9 Commits
static-dep
...
main
Author | SHA1 | Date | |
---|---|---|---|
dde15eb30d | |||
efccb26302 | |||
85d443a92b | |||
588ca158c1 | |||
3780dee24f | |||
c736c191d0 | |||
42784c2bff | |||
2636296539 | |||
b09f081db9 |
@ -19,11 +19,32 @@ seleneAngleAxis::seleneAngleAxis(seleneGuideController *pController, int axisNo,
|
||||
// Selene guide motors cannot be disabled
|
||||
status = pC_->setIntegerParam(axisNo_, pC_->motorCanDisable(), 0);
|
||||
if (status != asynSuccess) {
|
||||
pC_->paramLibAccessFailed(status, "motorCanDisable", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
pC_->stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// Even though this happens already in sinqAxis, a default value for
|
||||
// motorMessageText is set here again, because apparently the sinqAxis
|
||||
// constructor is not run before the string is accessed?
|
||||
status = setStringParam(pC_->motorMessageText(), "");
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
pC_->stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
seleneAngleAxis::~seleneAngleAxis() {}
|
||||
|
||||
asynStatus seleneAngleAxis::stop(double acceleration) {
|
||||
return liftAxis_->stop(acceleration);
|
||||
}
|
||||
@ -33,52 +54,37 @@ asynStatus seleneAngleAxis::doMove(double position, int relative,
|
||||
double acceleration) {
|
||||
double motorRecResolution = 0.0;
|
||||
|
||||
asynStatus pl_status = pC_->getDoubleParam(
|
||||
axisNo_, pC_->motorRecResolution(), &motorRecResolution);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorRecResolution_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
targetPosition_ = position * motorRecResolution;
|
||||
getAxisParamChecked(this, motorRecResolution, &motorRecResolution);
|
||||
setTargetPosition(position * motorRecResolution);
|
||||
targetSet_ = true;
|
||||
return liftAxis_->startCombinedMoveFromVirtualAxis();
|
||||
targetSet_ = false;
|
||||
}
|
||||
|
||||
asynStatus seleneAngleAxis::targetPosition(double *targetPosition) {
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
double seleneAngleAxis::targetPosition() {
|
||||
if (targetSet_) {
|
||||
*targetPosition = targetPosition_;
|
||||
return turboPmacAxis::targetPosition();
|
||||
} else {
|
||||
status = motorPosition(targetPosition);
|
||||
double targetPos = 0;
|
||||
motorPosition(&targetPos);
|
||||
return targetPos;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
asynStatus seleneAngleAxis::doPoll(bool *moving) {
|
||||
|
||||
char userMessage[pC_->MAXBUF_] = {0};
|
||||
char errorMessage[pC_->MAXBUF_] = {0};
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
// In the doPoll method of `seleneLiftAxis`, the parameters
|
||||
// `motorStatusMoving` and `motorStatusDone` of this axis have already been
|
||||
// set accordingly.
|
||||
int isMoving = 0;
|
||||
|
||||
asynStatus pl_status =
|
||||
pC_->getIntegerParam(axisNo(), pC_->motorStatusMoving(), &isMoving);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusMoving",
|
||||
axisNo(), __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
*moving = (isMoving != 0);
|
||||
getAxisParamChecked(this, motorStatusMoving, moving);
|
||||
|
||||
double motPos = 0.0;
|
||||
pl_status = motorPosition(&motPos);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pl_status;
|
||||
status = motorPosition(&motPos);
|
||||
if (status != asynSuccess) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -111,9 +117,9 @@ asynStatus seleneAngleAxis::doPoll(bool *moving) {
|
||||
double smallestHighLimit = std::numeric_limits<double>::infinity();
|
||||
double smallestLowLimit = std::numeric_limits<double>::infinity();
|
||||
double liftPosition = 0.0;
|
||||
pl_status = liftAxis_->motorPosition(&liftPosition);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pl_status;
|
||||
status = liftAxis_->motorPosition(&liftPosition);
|
||||
if (status != asynSuccess) {
|
||||
return status;
|
||||
}
|
||||
|
||||
for (int i = 0; i < liftAxis_->numAxes_; i++) {
|
||||
@ -122,9 +128,9 @@ asynStatus seleneAngleAxis::doPoll(bool *moving) {
|
||||
double leverArm = oAxis->xOffset() - liftAxis_->xPos();
|
||||
|
||||
double motPos = 0.0;
|
||||
pl_status = oAxis->motorPosition(&motPos);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pl_status;
|
||||
status = oAxis->motorPosition(&motPos);
|
||||
if (status != asynSuccess) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -161,52 +167,23 @@ asynStatus seleneAngleAxis::doPoll(bool *moving) {
|
||||
}
|
||||
}
|
||||
|
||||
pl_status = pC_->setDoubleParam(axisNo_, pC_->motorHighLimitFromDriver(),
|
||||
smallestHighLimit);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorHighLimitFromDriver",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
pl_status = pC_->setDoubleParam(axisNo_, pC_->motorLowLimitFromDriver(),
|
||||
smallestLowLimit);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorLowLimitFromDriver",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorHighLimitFromDriver, smallestHighLimit);
|
||||
setAxisParamChecked(this, motorLowLimitFromDriver, smallestLowLimit);
|
||||
|
||||
// This axis should always be seen as enabled, since it is automatically
|
||||
// enabled before each movement and disabled afterwards
|
||||
pl_status = setIntegerParam(pC_->motorEnableRBV(), 1);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorEnableRBV_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorEnableRBV, true);
|
||||
|
||||
// If an error message is set in the liftAxis_, copy this message into this
|
||||
// axis.
|
||||
pl_status =
|
||||
pC_->getStringParam(liftAxis_->axisNo(), pC_->motorMessageText(),
|
||||
sizeof(userMessage), userMessage);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText",
|
||||
liftAxis_->axisNo(),
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
getAxisParamChecked(liftAxis_, motorMessageText, &errorMessage);
|
||||
|
||||
if (strlen(userMessage) != 0) {
|
||||
pl_status = setStringParam(pC_->motorMessageText(), userMessage);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
if (strlen(errorMessage) != 0) {
|
||||
setAxisParamChecked(this, motorMessageText, errorMessage);
|
||||
return asynError;
|
||||
}
|
||||
|
||||
return pl_status;
|
||||
return status;
|
||||
}
|
||||
|
||||
asynStatus seleneAngleAxis::doReset() { return liftAxis_->reset(); }
|
||||
@ -214,13 +191,7 @@ asynStatus seleneAngleAxis::doReset() { return liftAxis_->reset(); }
|
||||
asynStatus seleneAngleAxis::enable(bool on) { return liftAxis_->enable(on); }
|
||||
|
||||
asynStatus seleneAngleAxis::readEncoderType() {
|
||||
asynStatus pl_status =
|
||||
setStringParam(pC_->encoderType(), IncrementalEncoder);
|
||||
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "encoderType_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, encoderType, IncrementalEncoder);
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#ifndef seleneAngleAxis_H
|
||||
#define seleneAngleAxis_H
|
||||
#include "seleneGuideController.h"
|
||||
#include "turboPmacAxis.h"
|
||||
|
||||
// Forward declaration of the seleneLiftAxis class to resolve the cyclic
|
||||
@ -7,10 +8,6 @@
|
||||
// See https://en.cppreference.com/w/cpp/language/class.
|
||||
class seleneLiftAxis;
|
||||
|
||||
// Forward declaration of the seleneGuideController class to resolve the cyclic
|
||||
// dependency. See https://en.cppreference.com/w/cpp/language/class.
|
||||
class seleneGuideController;
|
||||
|
||||
/**
|
||||
* @brief Virtual axis for setting the angle of the Selene guide
|
||||
*
|
||||
@ -32,6 +29,8 @@ class seleneAngleAxis : public turboPmacAxis {
|
||||
seleneAngleAxis(seleneGuideController *pController, int axisNo,
|
||||
seleneLiftAxis *liftAxis);
|
||||
|
||||
virtual ~seleneAngleAxis();
|
||||
|
||||
/**
|
||||
* @brief Implementation of the `stop` function from asynMotorAxis
|
||||
*
|
||||
@ -100,13 +99,11 @@ class seleneAngleAxis : public turboPmacAxis {
|
||||
double acceleration, int forwards);
|
||||
|
||||
/**
|
||||
* @brief Read the target position from the axis and write it into the
|
||||
* provided pointer.
|
||||
* @brief Override of the superclass method
|
||||
*
|
||||
* @param targetPosition
|
||||
* @return asynStatus
|
||||
* @return double
|
||||
*/
|
||||
asynStatus targetPosition(double *targetPosition);
|
||||
double targetPosition();
|
||||
|
||||
/**
|
||||
* @brief Set the offsets of axis 3 and 4 to zero and recalculate all other
|
||||
@ -140,6 +137,11 @@ class seleneAngleAxis : public turboPmacAxis {
|
||||
*/
|
||||
asynStatus rereadEncoder() { return asynSuccess; }
|
||||
|
||||
/**
|
||||
* @brief Return a pointer to the axis controller
|
||||
*/
|
||||
virtual seleneGuideController *pController() override { return pC_; };
|
||||
|
||||
protected:
|
||||
seleneGuideController *pC_;
|
||||
seleneLiftAxis *liftAxis_;
|
||||
|
@ -1,4 +1,7 @@
|
||||
#include "seleneGuideController.h"
|
||||
#include "seleneAngleAxis.h"
|
||||
#include "seleneLiftAxis.h"
|
||||
#include "seleneOffsetAxis.h"
|
||||
#include "turboPmacController.h"
|
||||
#include <epicsExport.h>
|
||||
#include <errlog.h>
|
||||
@ -48,6 +51,8 @@ seleneGuideController::seleneGuideController(
|
||||
}
|
||||
}
|
||||
|
||||
seleneGuideController::~seleneGuideController() {}
|
||||
|
||||
asynStatus seleneGuideController::writeInt32(asynUser *pasynUser,
|
||||
epicsInt32 value) {
|
||||
int function = pasynUser->reason;
|
||||
|
@ -8,11 +8,15 @@
|
||||
|
||||
#ifndef seleneGuideController_H
|
||||
#define seleneGuideController_H
|
||||
#include "seleneAngleAxis.h"
|
||||
#include "seleneLiftAxis.h"
|
||||
#include "seleneOffsetAxis.h"
|
||||
#include "turboPmacController.h"
|
||||
|
||||
// Forward declaration of the axis classes to resolve the cyclic
|
||||
// dependency between the seleneLiftAxis and the seleneAngleAxis .h-file.
|
||||
// See https://en.cppreference.com/w/cpp/language/class.
|
||||
class seleneAngleAxis;
|
||||
class seleneLiftAxis;
|
||||
class seleneOffsetAxis;
|
||||
|
||||
class seleneGuideController : public turboPmacController {
|
||||
|
||||
public:
|
||||
@ -34,6 +38,8 @@ class seleneGuideController : public turboPmacController {
|
||||
int numAxes, double movingPollPeriod,
|
||||
double idlePollPeriod, double comTimeout);
|
||||
|
||||
virtual ~seleneGuideController();
|
||||
|
||||
/**
|
||||
* @brief Overloaded function of turboPmacController
|
||||
*
|
||||
|
@ -96,11 +96,32 @@ seleneLiftAxis::seleneLiftAxis(seleneGuideController *pC, int axis1No,
|
||||
// Selene guide motors cannot be disabled
|
||||
status = pC_->setIntegerParam(axisNo_, pC_->motorCanDisable(), 0);
|
||||
if (status != asynSuccess) {
|
||||
pC_->paramLibAccessFailed(status, "motorCanDisable", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
pC_->stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// Even though this happens already in sinqAxis, a default value for
|
||||
// motorMessageText is set here again, because apparently the sinqAxis
|
||||
// constructor is not run before the string is accessed?
|
||||
status = setStringParam(pC_->motorMessageText(), "");
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
pC_->stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
seleneLiftAxis::~seleneLiftAxis() {}
|
||||
|
||||
asynStatus seleneLiftAxis::init() {
|
||||
|
||||
// Local variable declaration
|
||||
@ -135,44 +156,17 @@ asynStatus seleneLiftAxis::init() {
|
||||
}
|
||||
|
||||
// Assume the virtual axes are not moving at the start
|
||||
status = setIntegerParam(pC_->motorStatusMoving(), 0);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusMoving", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
status = setIntegerParam(pC_->motorStatusDone(), 1);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusDone", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorStatusMoving, false);
|
||||
setAxisParamChecked(this, motorStatusDone, true);
|
||||
|
||||
status = angleAxis_->setIntegerParam(pC_->motorStatusMoving(), 0);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusMoving",
|
||||
angleAxis_->axisNo(),
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
status = angleAxis_->setIntegerParam(pC_->motorStatusDone(), 1);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusDone",
|
||||
angleAxis_->axisNo(),
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis_, motorStatusMoving, false);
|
||||
setAxisParamChecked(angleAxis_, motorStatusDone, true);
|
||||
|
||||
// The virtual axes should always be seen as enabled, since the underlying
|
||||
// hardware is automatically enabled after sending a start command to the
|
||||
// controller and automatically disabled after the movement finished.
|
||||
status = setIntegerParam(pC_->motorEnableRBV(), 1);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorEnableRBV_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
status = angleAxis_->setIntegerParam(pC_->motorEnableRBV(), 1);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorEnableRBV_",
|
||||
angleAxis_->axisNo(),
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorEnableRBV, true);
|
||||
setAxisParamChecked(angleAxis_, motorEnableRBV, true);
|
||||
|
||||
status = normalizePositions();
|
||||
if (status != asynSuccess) {
|
||||
@ -261,12 +255,7 @@ asynStatus seleneLiftAxis::normalizePositions() {
|
||||
}
|
||||
|
||||
asynStatus seleneLiftAxis::doPoll(bool *moving) {
|
||||
|
||||
// Status of read-write-operations of ASCII commands to the controller
|
||||
asynStatus rw_status = asynSuccess;
|
||||
|
||||
// Status of parameter library operations
|
||||
asynStatus pl_status = asynSuccess;
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
char response[pC_->MAXBUF_] = {0};
|
||||
char userMessage[pC_->MAXBUF_] = {0};
|
||||
@ -277,18 +266,12 @@ asynStatus seleneLiftAxis::doPoll(bool *moving) {
|
||||
|
||||
// =========================================================================
|
||||
|
||||
pl_status =
|
||||
pC_->getIntegerParam(axisNo(), pC_->motorStatusDone(), &wasDone);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusMoving",
|
||||
axisNo(), __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
getAxisParamChecked(this, motorStatusDone, &wasDone);
|
||||
|
||||
const char *command = "P158";
|
||||
rw_status = pC_->writeRead(axisNo_, command, response, 1);
|
||||
if (rw_status != asynSuccess) {
|
||||
return rw_status;
|
||||
status = pC_->writeRead(axisNo_, command, response, 1);
|
||||
if (status != asynSuccess) {
|
||||
return status;
|
||||
}
|
||||
|
||||
nvals = sscanf(response, "%d", &axStatus);
|
||||
@ -299,31 +282,12 @@ asynStatus seleneLiftAxis::doPoll(bool *moving) {
|
||||
*moving = (axStatus != 0);
|
||||
|
||||
// Set the moving status of seleneLiftAxis
|
||||
pl_status = setIntegerParam(pC_->motorStatusMoving(), *moving);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusMoving",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
pl_status = setIntegerParam(pC_->motorStatusDone(), !(*moving));
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusDone", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorStatusMoving, *moving);
|
||||
setAxisParamChecked(this, motorStatusDone, !(*moving));
|
||||
|
||||
// Set the moving status of seleneAngleAxis
|
||||
pl_status = angleAxis_->setIntegerParam(pC_->motorStatusMoving(), *moving);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusMoving",
|
||||
angleAxis_->axisNo(),
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
pl_status = angleAxis_->setIntegerParam(pC_->motorStatusDone(), !(*moving));
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusDone",
|
||||
angleAxis_->axisNo(),
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(angleAxis_, motorStatusMoving, *moving);
|
||||
setAxisParamChecked(angleAxis_, motorStatusDone, !(*moving));
|
||||
|
||||
/*
|
||||
If an seleneOffsetAxis is moving, the positions of the virtual axes
|
||||
@ -342,22 +306,17 @@ asynStatus seleneLiftAxis::doPoll(bool *moving) {
|
||||
|
||||
double motorRecResolution = 0.0;
|
||||
|
||||
asynStatus pl_status = pC_->getDoubleParam(
|
||||
axisNo_, pC_->motorRecResolution(), &motorRecResolution);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorRecResolution_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
getAxisParamChecked(angleAxis_, motorRecResolution,
|
||||
&motorRecResolution);
|
||||
|
||||
status = offsetAxes_[2]->motorPosition(&offsetAx2Pos);
|
||||
if (status != asynSuccess) {
|
||||
return status;
|
||||
}
|
||||
|
||||
pl_status = offsetAxes_[2]->motorPosition(&offsetAx2Pos);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pl_status;
|
||||
}
|
||||
|
||||
pl_status = offsetAxes_[3]->motorPosition(&offsetAx3Pos);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pl_status;
|
||||
status = offsetAxes_[3]->motorPosition(&offsetAx3Pos);
|
||||
if (status != asynSuccess) {
|
||||
return status;
|
||||
}
|
||||
|
||||
deriveLiftAndAngle(
|
||||
@ -366,14 +325,14 @@ asynStatus seleneLiftAxis::doPoll(bool *moving) {
|
||||
&angle);
|
||||
|
||||
// Set the position values in the parameter library
|
||||
pl_status = setMotorPosition(lift);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pl_status;
|
||||
status = setMotorPosition(lift);
|
||||
if (status != asynSuccess) {
|
||||
return status;
|
||||
}
|
||||
|
||||
pl_status = angleAxis_->setMotorPosition(angle);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pl_status;
|
||||
status = angleAxis_->setMotorPosition(angle);
|
||||
if (status != asynSuccess) {
|
||||
return status;
|
||||
}
|
||||
|
||||
// Calculate the new liftPosition_ of all seleneOffsetAxis
|
||||
@ -398,45 +357,22 @@ asynStatus seleneLiftAxis::doPoll(bool *moving) {
|
||||
|
||||
// Set the limits for the lift axis
|
||||
double motPos = 0.0;
|
||||
pl_status = motorPosition(&motPos);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pl_status;
|
||||
status = motorPosition(&motPos);
|
||||
if (status != asynSuccess) {
|
||||
return status;
|
||||
}
|
||||
|
||||
pl_status = pC_->setDoubleParam(axisNo_, pC_->motorHighLimitFromDriver(),
|
||||
motPos + smallestDistHighLimit);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorHighLimitFromDriver_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
pl_status = pC_->setDoubleParam(axisNo_, pC_->motorLowLimitFromDriver(),
|
||||
motPos - smallestDistLowLimit);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorLowLimit_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorHighLimitFromDriver,
|
||||
motPos + smallestDistHighLimit);
|
||||
setAxisParamChecked(this, motorLowLimitFromDriver,
|
||||
motPos - smallestDistLowLimit);
|
||||
|
||||
// The virtual axes are in an error state, if at least one of the underlying
|
||||
// real axes is in an error state.
|
||||
for (int i = 0; i < numAxes_; i++) {
|
||||
pl_status = pC_->getStringParam(offsetAxes_[i]->axisNo(),
|
||||
pC_->motorMessageText(),
|
||||
sizeof(userMessage), userMessage);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText",
|
||||
offsetAxes_[i]->axisNo(),
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
setAxisParamChecked(offsetAxes_[i], motorMessageText, userMessage);
|
||||
if (strlen(userMessage) != 0) {
|
||||
pl_status = setStringParam(pC_->motorMessageText(), userMessage);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorMessageText, userMessage);
|
||||
return asynError;
|
||||
}
|
||||
}
|
||||
@ -448,30 +384,22 @@ asynStatus seleneLiftAxis::doMove(double position, int relative,
|
||||
double min_velocity, double max_velocity,
|
||||
double acceleration) {
|
||||
double motorRecResolution = 0.0;
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
status = pC_->getDoubleParam(axisNo_, pC_->motorRecResolution(),
|
||||
&motorRecResolution);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorRecResolution_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
targetPosition_ = position * motorRecResolution;
|
||||
getAxisParamChecked(this, motorRecResolution, &motorRecResolution);
|
||||
setTargetPosition(position * motorRecResolution);
|
||||
targetSet_ = true;
|
||||
status = startCombinedMoveFromVirtualAxis();
|
||||
asynStatus status = startCombinedMoveFromVirtualAxis();
|
||||
targetSet_ = false;
|
||||
return status;
|
||||
}
|
||||
|
||||
asynStatus seleneLiftAxis::targetPosition(double *targetPosition) {
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
double seleneLiftAxis::targetPosition() {
|
||||
if (targetSet_) {
|
||||
*targetPosition = targetPosition_;
|
||||
return turboPmacAxis::targetPosition();
|
||||
} else {
|
||||
status = motorPosition(targetPosition);
|
||||
double targetPos = 0;
|
||||
motorPosition(&targetPos);
|
||||
return targetPos;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
asynStatus seleneLiftAxis::startCombinedMove() {
|
||||
@ -480,34 +408,18 @@ asynStatus seleneLiftAxis::startCombinedMove() {
|
||||
char response[pC_->MAXBUF_] = {0};
|
||||
double liftTargetPosition = 0.0;
|
||||
double angleTargetPosition = 0.0;
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
// =========================================================================
|
||||
|
||||
status = targetPosition(&liftTargetPosition);
|
||||
if (status != asynSuccess) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = angleAxis_->targetPosition(&angleTargetPosition);
|
||||
if (status != asynSuccess) {
|
||||
return status;
|
||||
}
|
||||
|
||||
errlogPrintf("Target lift: %lf, Target angle: %lf\n", liftTargetPosition,
|
||||
angleTargetPosition);
|
||||
|
||||
liftTargetPosition = targetPosition();
|
||||
angleTargetPosition = angleAxis_->targetPosition();
|
||||
auto targetPositions =
|
||||
positionsFromLiftAndAngle(liftTargetPosition, angleTargetPosition);
|
||||
|
||||
// Apply the offsets of the individual offset axes
|
||||
for (int i = 0; i < numAxes_; i++) {
|
||||
double offsetTargetPosition = 0.0;
|
||||
status = offsetAxes_[i]->targetPosition(&offsetTargetPosition);
|
||||
if (status != asynSuccess) {
|
||||
return status;
|
||||
}
|
||||
targetPositions[i] = targetPositions[i] + offsetTargetPosition;
|
||||
targetPositions[i] =
|
||||
targetPositions[i] + offsetAxes_[i]->targetPosition();
|
||||
}
|
||||
|
||||
// Set all target positions and send the move command
|
||||
@ -516,42 +428,32 @@ asynStatus seleneLiftAxis::startCombinedMove() {
|
||||
targetPositions[0], targetPositions[1], targetPositions[2],
|
||||
targetPositions[3], targetPositions[4], targetPositions[5]);
|
||||
|
||||
errlogPrintf("%s\n", command);
|
||||
|
||||
// No answer expected
|
||||
return pC_->writeRead(axisNo_, command, response, 0);
|
||||
}
|
||||
|
||||
asynStatus seleneLiftAxis::stop(double acceleration) {
|
||||
// Status of read-write-operations of ASCII commands to the controller
|
||||
asynStatus rw_status = asynSuccess;
|
||||
|
||||
// Status of parameter library operations
|
||||
asynStatus pl_status = asynSuccess;
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
char response[pC_->MAXBUF_] = {0};
|
||||
|
||||
// =========================================================================
|
||||
|
||||
// Stop all axes
|
||||
rw_status = pC_->writeRead(axisNo_, "P150=8", response, 0);
|
||||
status = pC_->writeRead(axisNo_, "P150=8", response, 0);
|
||||
|
||||
if (rw_status != asynSuccess) {
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(
|
||||
pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d\nStopping the movement "
|
||||
"failed.\n",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||
|
||||
pl_status = setIntegerParam(pC_->motorStatusProblem(), true);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorStatusProblem, true);
|
||||
}
|
||||
|
||||
return rw_status;
|
||||
return status;
|
||||
}
|
||||
|
||||
asynStatus seleneLiftAxis::doReset() {
|
||||
@ -564,24 +466,13 @@ asynStatus seleneLiftAxis::doReset() {
|
||||
}
|
||||
|
||||
asynStatus seleneLiftAxis::enable(bool on) {
|
||||
asynStatus pl_status = setStringParam(pC_->motorMessageText(),
|
||||
"Axis cannot be enabled / disabled");
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
return pl_status;
|
||||
setAxisParamChecked(this, motorMessageText,
|
||||
"Axis cannot be enabled / disabled");
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
asynStatus seleneLiftAxis::readEncoderType() {
|
||||
asynStatus pl_status =
|
||||
setStringParam(pC_->encoderType(), IncrementalEncoder);
|
||||
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "encoderType_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, encoderType, IncrementalEncoder);
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,11 @@
|
||||
#ifndef seleneLiftAxis_H
|
||||
#define seleneLiftAxis_H
|
||||
#include "seleneAngleAxis.h"
|
||||
#include "seleneGuideController.h"
|
||||
#include "seleneOffsetAxis.h"
|
||||
#include "turboPmacAxis.h"
|
||||
#include <array>
|
||||
|
||||
// Forward declaration of the seleneGuideController class to resolve the cyclic
|
||||
// dependency. See https://en.cppreference.com/w/cpp/language/class.
|
||||
class seleneGuideController;
|
||||
|
||||
/**
|
||||
* @brief Virtual axis for setting the height of the center of a Selene guide
|
||||
*
|
||||
@ -39,6 +36,8 @@ class seleneLiftAxis : public turboPmacAxis {
|
||||
int axis3No, int axis4No, int axis5No, int axis6No,
|
||||
int liftAxisNo, int angleAxisNo);
|
||||
|
||||
virtual ~seleneLiftAxis();
|
||||
|
||||
/**
|
||||
* @brief Implementation of the `stop` function from asynMotorAxis
|
||||
*
|
||||
@ -254,13 +253,11 @@ class seleneLiftAxis : public turboPmacAxis {
|
||||
bool virtualAxisMovement() { return virtualAxisMovement_; }
|
||||
|
||||
/**
|
||||
* @brief Read the target position from the axis and write it into the
|
||||
* provided pointer.
|
||||
* @brief Override of the superclass method
|
||||
*
|
||||
* @param targetPosition
|
||||
* @return asynStatus
|
||||
* @return double
|
||||
*/
|
||||
asynStatus targetPosition(double *targetPosition);
|
||||
double targetPosition();
|
||||
|
||||
/**
|
||||
* @brief Access the position of the lift axis
|
||||
@ -278,6 +275,11 @@ class seleneLiftAxis : public turboPmacAxis {
|
||||
*/
|
||||
seleneOffsetAxis *offsetAxis(int idx);
|
||||
|
||||
/**
|
||||
* @brief Return a pointer to the axis controller
|
||||
*/
|
||||
virtual seleneGuideController *pController() override { return pC_; };
|
||||
|
||||
protected:
|
||||
std::array<seleneOffsetAxis *, numAxes_> offsetAxes_;
|
||||
|
||||
|
@ -50,18 +50,33 @@ seleneOffsetAxis::seleneOffsetAxis(seleneGuideController *pController,
|
||||
|
||||
status = pC_->setIntegerParam(axisNo_, pC_->motorStatusDone(), 1);
|
||||
if (status != asynSuccess) {
|
||||
pC_->paramLibAccessFailed(status, "motorStatusDone", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
pC_->stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
status = pC_->setIntegerParam(axisNo_, pC_->motorStatusMoving(), 0);
|
||||
if (status != asynSuccess) {
|
||||
pC_->paramLibAccessFailed(status, "motorStatusMoving", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
pC_->stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorEncoderPosition(), 0.0);
|
||||
if (status != asynSuccess) {
|
||||
pC_->paramLibAccessFailed(status, "motorEncoderPosition", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
pC_->stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// Register the hook function during construction of the first axis
|
||||
@ -77,11 +92,32 @@ seleneOffsetAxis::seleneOffsetAxis(seleneGuideController *pController,
|
||||
// Selene guide motors cannot be disabled
|
||||
status = pC_->setIntegerParam(axisNo_, pC_->motorCanDisable(), 0);
|
||||
if (status != asynSuccess) {
|
||||
pC_->paramLibAccessFailed(status, "motorCanDisable", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
pC_->stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// Even though this happens already in sinqAxis, a default value for
|
||||
// motorMessageText is set here again, because apparently the sinqAxis
|
||||
// constructor is not run before the string is accessed?
|
||||
status = setStringParam(pC_->motorMessageText(), "");
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
pC_->stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
seleneOffsetAxis::~seleneOffsetAxis() {}
|
||||
|
||||
asynStatus seleneOffsetAxis::init() {
|
||||
|
||||
// Local variable declaration
|
||||
@ -116,16 +152,8 @@ asynStatus seleneOffsetAxis::init() {
|
||||
}
|
||||
|
||||
// Read the initial limits from the paramlib
|
||||
status = pC_->getDoubleParam(axisNo_, pC_->motorHighLimit(), &highLimit_);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorHighLimit", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
status = pC_->getDoubleParam(axisNo_, pC_->motorLowLimit(), &lowLimit_);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorLowLimit", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
getAxisParamChecked(this, motorHighLimit, &highLimit_);
|
||||
getAxisParamChecked(this, motorLowLimit, &lowLimit_);
|
||||
|
||||
// The high limits read from the paramLib are divided by motorRecResolution,
|
||||
// hence we need to multiply them to undo this change.
|
||||
@ -135,15 +163,14 @@ asynStatus seleneOffsetAxis::init() {
|
||||
return status;
|
||||
}
|
||||
|
||||
asynStatus seleneOffsetAxis::targetPosition(double *targetPosition) {
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
double seleneOffsetAxis::targetPosition() {
|
||||
if (targetSet_) {
|
||||
*targetPosition = targetPosition_;
|
||||
return turboPmacAxis::targetPosition();
|
||||
} else {
|
||||
status = motorPosition(targetPosition);
|
||||
double targetPos = 0;
|
||||
motorPosition(&targetPos);
|
||||
return targetPos;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
asynStatus seleneOffsetAxis::doPoll(bool *moving) {
|
||||
@ -199,18 +226,10 @@ asynStatus seleneOffsetAxis::doPoll(bool *moving) {
|
||||
|
||||
// Update the parameter library
|
||||
if (error != 0) {
|
||||
status = setIntegerParam(pC_->motorStatusProblem(), true);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusProblem_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorMessageText, userMessage);
|
||||
setAxisParamChecked(this, motorStatusProblem, true);
|
||||
}
|
||||
|
||||
// TODO: To be removed, once the real limits are derived
|
||||
// highLimit = 10.0;
|
||||
// lowLimit = -10.0;
|
||||
|
||||
// Convert into lift coordinate system
|
||||
absoluteHighLimitLiftCS_ = highLimit - zOffset_;
|
||||
absoluteLowLimitLiftCS_ = lowLimit - zOffset_;
|
||||
@ -230,20 +249,8 @@ asynStatus seleneOffsetAxis::doPoll(bool *moving) {
|
||||
relLowLimit = lowLimit - encoderPosition;
|
||||
}
|
||||
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorHighLimitFromDriver(),
|
||||
relHighLimit);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorHighLimitFromDriver_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorLowLimitFromDriver(),
|
||||
relLowLimit);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorLowLimit_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorHighLimitFromDriver, relHighLimit);
|
||||
setAxisParamChecked(this, motorLowLimitFromDriver, relLowLimit);
|
||||
|
||||
/*
|
||||
If this axis is moving as a result of an individual move command to the axis
|
||||
@ -257,41 +264,22 @@ asynStatus seleneOffsetAxis::doPoll(bool *moving) {
|
||||
}
|
||||
}
|
||||
|
||||
status = setIntegerParam(pC_->motorStatusMoving(), *moving);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusMoving_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
status = setIntegerParam(pC_->motorStatusDone(), !(*moving));
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusDone_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorStatusMoving, *moving);
|
||||
setAxisParamChecked(this, motorStatusDone, !(*moving));
|
||||
|
||||
// Axis is always shown as enabled, since it is enabled automatically by the
|
||||
// controller when a move command P150=1 is sent and disabled once the
|
||||
// movement is completed.
|
||||
status = setIntegerParam(pC_->motorEnableRBV(), 1);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorEnableRBV_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorEnableRBV, true);
|
||||
|
||||
return errorStatus;
|
||||
}
|
||||
|
||||
asynStatus
|
||||
seleneOffsetAxis::setPositionsFromEncoderPosition(double encoderPosition) {
|
||||
asynStatus status = pC_->setDoubleParam(
|
||||
axisNo_, pC_->motorAbsolutePositionRBV(), encoderPosition);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorEncoderPosition",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
setAxisParamChecked(this, motorAbsolutePositionRBV, encoderPosition);
|
||||
absolutePositionLiftCS_ = encoderPosition - zOffset_;
|
||||
return status;
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
asynStatus seleneOffsetAxis::doMove(double position, int relative,
|
||||
@ -300,17 +288,10 @@ asynStatus seleneOffsetAxis::doMove(double position, int relative,
|
||||
double acceleration) {
|
||||
|
||||
double motorRecResolution = 0.0;
|
||||
|
||||
asynStatus pl_status = pC_->getDoubleParam(
|
||||
axisNo_, pC_->motorRecResolution(), &motorRecResolution);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorRecResolution_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
getAxisParamChecked(this, motorRecResolution, &motorRecResolution);
|
||||
|
||||
// Set the target position
|
||||
targetPosition_ = position * motorRecResolution;
|
||||
setTargetPosition(position * motorRecResolution);
|
||||
targetSet_ = true;
|
||||
asynStatus status = liftAxis_->startCombinedMoveFromOffsetAxis();
|
||||
targetSet_ = false;
|
||||
@ -318,14 +299,9 @@ asynStatus seleneOffsetAxis::doMove(double position, int relative,
|
||||
}
|
||||
|
||||
asynStatus seleneOffsetAxis::enable(bool on) {
|
||||
asynStatus pl_status = setStringParam(pC_->motorMessageText(),
|
||||
"Axis cannot be enabled / disabled");
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
return pl_status;
|
||||
setAxisParamChecked(this, motorMessageText,
|
||||
"Axis cannot be enabled / disabled");
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
asynStatus seleneOffsetAxis::normalizePositions() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef seleneOffsetAxis_H
|
||||
#define seleneOffsetAxis_H
|
||||
|
||||
#include "seleneGuideController.h"
|
||||
#include "turboPmacAxis.h"
|
||||
|
||||
// Forward declaration of the seleneLiftAxis class to resolve the cyclic
|
||||
@ -8,10 +9,6 @@
|
||||
// See https://en.cppreference.com/w/cpp/language/class.
|
||||
class seleneLiftAxis;
|
||||
|
||||
// Forward declaration of the seleneGuideController class to resolve the cyclic
|
||||
// dependency. See https://en.cppreference.com/w/cpp/language/class.
|
||||
class seleneGuideController;
|
||||
|
||||
/**
|
||||
* @brief Virtual axis for setting the offset of a motor of the Selene guide
|
||||
*
|
||||
@ -30,6 +27,8 @@ class seleneOffsetAxis : public turboPmacAxis {
|
||||
seleneOffsetAxis(seleneGuideController *pController, int axisNo,
|
||||
double xPos, double zPos);
|
||||
|
||||
virtual ~seleneOffsetAxis();
|
||||
|
||||
/**
|
||||
* @brief Initialize this offset axis
|
||||
*
|
||||
@ -79,13 +78,11 @@ class seleneOffsetAxis : public turboPmacAxis {
|
||||
asynStatus setPositionsFromEncoderPosition(double encoderPosition);
|
||||
|
||||
/**
|
||||
* @brief Read the target position from the axis and write it into the
|
||||
* provided pointer.
|
||||
* @brief Override of the superclass method
|
||||
*
|
||||
* @param targetPosition
|
||||
* @return asynStatus
|
||||
* @return double
|
||||
*/
|
||||
asynStatus targetPosition(double *targetPosition);
|
||||
double targetPosition();
|
||||
|
||||
/**
|
||||
* @brief Set the offsets of axis 3 and 4 to zero and recalculate all other
|
||||
@ -126,6 +123,11 @@ class seleneOffsetAxis : public turboPmacAxis {
|
||||
*/
|
||||
double absoluteLowLimitLiftCS() { return absoluteLowLimitLiftCS_; }
|
||||
|
||||
/**
|
||||
* @brief Return a pointer to the axis controller
|
||||
*/
|
||||
virtual seleneGuideController *pController() override { return pC_; };
|
||||
|
||||
protected:
|
||||
// True, if the target has been set from this axis
|
||||
bool targetSet_;
|
||||
|
Submodule turboPmac updated: 2f83060ec1...f423002d23
Reference in New Issue
Block a user