Safety commit
This commit is contained in:
@@ -55,10 +55,6 @@ auxiliaryAxis::auxiliaryAxis(detectorTowerController *pC, int axisNo)
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// Initialize all member variables
|
||||
// Assumed to be not ready by default, this is overwritten in the next poll
|
||||
targetPosition_ = 0.0;
|
||||
|
||||
// Register the hook function during construction of the first axis object
|
||||
if (axes.empty()) {
|
||||
initHookRegister(&epicsInithookFunction);
|
||||
@@ -241,3 +237,5 @@ asynStatus auxiliaryAxis::stop(double acceleration) {
|
||||
|
||||
return rw_status;
|
||||
}
|
||||
|
||||
asynStatus auxiliaryAxis::reset() { return dTA_->reset(); };
|
||||
|
||||
@@ -63,10 +63,16 @@ class auxiliaryAxis : public turboPmacAxis {
|
||||
asynStatus doMove(double position, int relative, double min_velocity,
|
||||
double max_velocity, double acceleration);
|
||||
|
||||
/**
|
||||
* @brief Call the reset function of the associated `detectorTowerAxis`.
|
||||
*
|
||||
* @return asynStatus
|
||||
*/
|
||||
asynStatus reset();
|
||||
|
||||
protected:
|
||||
detectorTowerController *pC_;
|
||||
detectorTowerAxis *dTA_;
|
||||
double targetPosition_;
|
||||
|
||||
private:
|
||||
friend class detectorTowerAxis;
|
||||
|
||||
@@ -78,7 +78,6 @@ detectorTowerAxis::detectorTowerAxis(detectorTowerController *pC, int axisNo,
|
||||
// Initialize all member variables
|
||||
// Assumed to be not ready by default, this is overwritten in the next poll
|
||||
error_ = 0;
|
||||
targetPosition_ = 0.0;
|
||||
receivedTarget_ = false;
|
||||
startingDeferredMovement_ = false;
|
||||
deferredMovementWait_ = 0.1; // seconds
|
||||
@@ -191,17 +190,11 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) {
|
||||
}
|
||||
|
||||
// Read the previous motor position
|
||||
pl_status = pC_->getDoubleParam(axisNo_, pC_->motorPosition(),
|
||||
&previousBeamTiltAngle);
|
||||
pl_status = motorPosition(&previousBeamTiltAngle);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorPosition_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
return pl_status;
|
||||
}
|
||||
|
||||
// Transform from EPICS to motor coordinates (see comment in
|
||||
// turboPmacAxis::atFirstPoll)
|
||||
previousBeamTiltAngle = previousBeamTiltAngle * motorRecResolution;
|
||||
|
||||
/*
|
||||
Query the following information:
|
||||
- In-position flag
|
||||
@@ -224,7 +217,7 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) {
|
||||
&liftOffsetHighLimit, &liftOffsetLowLimit, &tiltOffsetHighLimit,
|
||||
&tiltOffsetLowLimit);
|
||||
if (nvals != 10) {
|
||||
return pC_->errMsgCouldNotParseResponse(command, response, axisNo_,
|
||||
return pC_->couldNotParseResponse(command, response, axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
@@ -712,12 +705,9 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) {
|
||||
double liftOffsetPosition =
|
||||
detectorHeight + detectorRadius * sin(beamTiltAngle);
|
||||
|
||||
pl_status = pC_->setDoubleParam(liftAxisNo, pC_->motorPosition(),
|
||||
liftOffsetPosition / motorRecResolution);
|
||||
pl_status = setMotorPosition(liftOffsetPosition);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorPosition_",
|
||||
liftAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
return pl_status;
|
||||
}
|
||||
pl_status = pC_->setDoubleParam(liftAxisNo, pC_->motorHighLimitFromDriver(),
|
||||
liftOffsetHighLimit);
|
||||
@@ -738,14 +728,9 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) {
|
||||
|
||||
// There exists no readback value for tiltOffsetAxis_, hence we just set the
|
||||
// current position to the target position.
|
||||
pl_status = tiltOffsetAxis_->setDoubleParam(
|
||||
pC_->motorPosition(),
|
||||
tiltOffsetAxis_->targetPosition_ / motorRecResolution);
|
||||
|
||||
tiltOffsetAxis_->setMotorPosition(tiltOffsetAxis_->targetPosition_);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorPosition_",
|
||||
tiltAxisNo, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
return pl_status;
|
||||
}
|
||||
pl_status = pC_->setDoubleParam(tiltAxisNo, pC_->motorHighLimitFromDriver(),
|
||||
tiltOffsetHighLimit);
|
||||
@@ -764,11 +749,9 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) {
|
||||
|
||||
// Transform from motor to EPICS coordinates (see comment in
|
||||
// turboPmacAxis::init())
|
||||
pl_status = setDoubleParam(pC_->motorPosition(),
|
||||
beamTiltAngle / motorRecResolution);
|
||||
pl_status = setMotorPosition(beamTiltAngle);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorPosition_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
return pl_status;
|
||||
}
|
||||
|
||||
pl_status = setIntegerParam(pC_->positionStateRBV(), positionState);
|
||||
@@ -988,7 +971,7 @@ detectorTowerAxis::toggleWorkingChangerState(bool toChangingPosition) {
|
||||
return rw_status;
|
||||
}
|
||||
|
||||
asynStatus detectorTowerAxis::reset() {
|
||||
asynStatus detectorTowerAxis::doReset() {
|
||||
|
||||
char response[pC_->MAXBUF_];
|
||||
asynStatus pl_status = asynSuccess;
|
||||
@@ -1106,10 +1089,6 @@ asynStatus detectorTowerCreateAxis(const char *portName, int axisDetectorTower,
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
/*
|
||||
Same procedure as for the CreateController function, but for the axis
|
||||
itself.
|
||||
*/
|
||||
static const iocshArg CreateAxisArg0 = {"Controller name (e.g. mcu1)",
|
||||
iocshArgString};
|
||||
static const iocshArg CreateAxisArg1 = {"Number of the detector angle axis",
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
// https://en.cppreference.com/w/cpp/language/class.
|
||||
class detectorTowerController;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
class detectorTowerAxis : public turboPmacAxis {
|
||||
public:
|
||||
/**
|
||||
@@ -97,12 +93,12 @@ class detectorTowerAxis : public turboPmacAxis {
|
||||
asynStatus toggleWorkingChangerState(bool toChangingPosition);
|
||||
|
||||
/**
|
||||
* @brief Reset the axis error
|
||||
* @brief Implementation of the `doReset` method of sinqAxis
|
||||
*
|
||||
* @param on
|
||||
* @return asynStatus
|
||||
*/
|
||||
asynStatus reset();
|
||||
asynStatus doReset();
|
||||
|
||||
// If true, either this axis or one of the auxiliaryAxis attached to it
|
||||
// received a movement command.
|
||||
@@ -121,7 +117,6 @@ class detectorTowerAxis : public turboPmacAxis {
|
||||
|
||||
protected:
|
||||
detectorTowerController *pC_;
|
||||
double targetPosition_;
|
||||
int error_;
|
||||
auxiliaryAxis *tiltOffsetAxis_;
|
||||
auxiliaryAxis *liftOffsetAxis_;
|
||||
|
||||
Reference in New Issue
Block a user