Changed to the "motorPosition" and "setMotorPosition" functions provided
by sinqMotor.
This commit is contained in:
2
Makefile
2
Makefile
@ -13,7 +13,7 @@ REQUIRED+=sinqMotor
|
||||
motorBase_VERSION=7.2.2
|
||||
|
||||
# Specify the version of sinqMotor we want to build against
|
||||
sinqMotor_VERSION=0.9.0
|
||||
sinqMotor_VERSION=mathis_s
|
||||
|
||||
# These headers allow to depend on this library for derived drivers.
|
||||
HEADERS += src/masterMacsAxis.h
|
||||
|
@ -1,5 +1,7 @@
|
||||
# masterMacs
|
||||
|
||||
## <span style="color:red">Please read the documentation of sinqMotor first: https://git.psi.ch/sinq-epics-modules/sinqmotor</span>
|
||||
|
||||
## Overview
|
||||
|
||||
This is a driver for the masterMacs motion controller with the SINQ communication protocol. It is based on the sinqMotor shared library (https://git.psi.ch/sinq-epics-modules/sinqmotor). The header files contain detailed documentation for all public functions. The headers themselves are exported when building the library to allow other drivers to depend on this one.
|
||||
|
@ -190,7 +190,7 @@ asynStatus masterMacsAxis::init() {
|
||||
}
|
||||
nvals = sscanf(response, "%lf", &motorPosition);
|
||||
if (nvals != 1) {
|
||||
return pC_->errMsgCouldNotParseResponse("R12", response, axisNo_,
|
||||
return pC_->couldNotParseResponse("R12", response, axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ asynStatus masterMacsAxis::init() {
|
||||
}
|
||||
nvals = sscanf(response, "%lf", &motorVelocity);
|
||||
if (nvals != 1) {
|
||||
return pC_->errMsgCouldNotParseResponse("R05", response, axisNo_,
|
||||
return pC_->couldNotParseResponse("R05", response, axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ asynStatus masterMacsAxis::init() {
|
||||
}
|
||||
nvals = sscanf(response, "%lf", &motorVmax);
|
||||
if (nvals != 1) {
|
||||
return pC_->errMsgCouldNotParseResponse("R26", response, axisNo_,
|
||||
return pC_->couldNotParseResponse("R26", response, axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ asynStatus masterMacsAxis::init() {
|
||||
}
|
||||
nvals = sscanf(response, "%lf", &motorAccel);
|
||||
if (nvals != 1) {
|
||||
return pC_->errMsgCouldNotParseResponse("R06", response, axisNo_,
|
||||
return pC_->couldNotParseResponse("R06", response, axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
@ -232,15 +232,10 @@ asynStatus masterMacsAxis::init() {
|
||||
// MasterMACS.
|
||||
lastSetSpeed_ = motorVelocity;
|
||||
|
||||
// Transform from motor to parameter library coordinates
|
||||
motorPosition = motorPosition / motorRecResolution;
|
||||
|
||||
// Store these values in the parameter library
|
||||
pl_status =
|
||||
pC_->setDoubleParam(axisNo_, pC_->motorPosition(), motorPosition);
|
||||
// Store the motor position in the parameter library
|
||||
pl_status = setMotorPosition(motorPosition);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorPosition_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
return pl_status;
|
||||
}
|
||||
|
||||
// Write to the motor record fields
|
||||
@ -338,7 +333,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
||||
|
||||
nvals = sscanf(response, "%lf", &handshakePerformed);
|
||||
if (nvals != 1) {
|
||||
return pC_->errMsgCouldNotParseResponse(
|
||||
return pC_->couldNotParseResponse(
|
||||
"R86", response, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
@ -379,17 +374,11 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
||||
}
|
||||
|
||||
// Read the previous motor position
|
||||
pl_status =
|
||||
pC_->getDoubleParam(axisNo_, pC_->motorPosition(), &previousPosition);
|
||||
pl_status = motorPosition(&previousPosition);
|
||||
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
|
||||
// masterMacsAxis::readConfig())
|
||||
previousPosition = previousPosition * motorRecResolution;
|
||||
|
||||
// Update the axis status
|
||||
rw_status = readAxisStatus();
|
||||
if (rw_status != asynSuccess) {
|
||||
@ -411,7 +400,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
||||
}
|
||||
nvals = sscanf(response, "%lf", ¤tPosition);
|
||||
if (nvals != 1) {
|
||||
return pC_->errMsgCouldNotParseResponse("R12", response, axisNo_,
|
||||
return pC_->couldNotParseResponse("R12", response, axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
@ -619,7 +608,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
||||
}
|
||||
nvals = sscanf(response, "%lf", &lowLimit);
|
||||
if (nvals != 1) {
|
||||
return pC_->errMsgCouldNotParseResponse(
|
||||
return pC_->couldNotParseResponse(
|
||||
"R34", response, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
@ -629,7 +618,7 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
||||
}
|
||||
nvals = sscanf(response, "%lf", &highLimit);
|
||||
if (nvals != 1) {
|
||||
return pC_->errMsgCouldNotParseResponse(
|
||||
return pC_->couldNotParseResponse(
|
||||
"R33", response, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
@ -719,14 +708,9 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
// Transform from motor to EPICS coordinates (see comment in
|
||||
// masterMacsAxis::init())
|
||||
currentPosition = currentPosition / motorRecResolution;
|
||||
|
||||
pl_status = setDoubleParam(pC_->motorPosition(), currentPosition);
|
||||
pl_status = setMotorPosition(currentPosition);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorPosition_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
return pl_status;
|
||||
}
|
||||
|
||||
return poll_status;
|
||||
@ -894,7 +878,7 @@ asynStatus masterMacsAxis::stop(double acceleration) {
|
||||
return rw_status;
|
||||
}
|
||||
|
||||
asynStatus masterMacsAxis::reset() {
|
||||
asynStatus masterMacsAxis::doReset() {
|
||||
// Status of read-write-operations of ASCII commands to the controller
|
||||
asynStatus rw_status = asynSuccess;
|
||||
|
||||
@ -994,7 +978,7 @@ asynStatus masterMacsAxis::readEncoderType() {
|
||||
|
||||
nvals = sscanf(response, "%d", &encoder_id);
|
||||
if (nvals != 1) {
|
||||
return pC_->errMsgCouldNotParseResponse(command, response, axisNo_,
|
||||
return pC_->couldNotParseResponse(command, response, axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
@ -1154,7 +1138,7 @@ asynStatus masterMacsAxis::readAxisStatus() {
|
||||
float axisStatus = 0;
|
||||
int nvals = sscanf(response, "%f", &axisStatus);
|
||||
if (nvals != 1) {
|
||||
return pC_->errMsgCouldNotParseResponse(
|
||||
return pC_->couldNotParseResponse(
|
||||
"R10", response, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
@ -1175,7 +1159,7 @@ asynStatus masterMacsAxis::readAxisError() {
|
||||
float axisError = 0;
|
||||
int nvals = sscanf(response, "%f", &axisError);
|
||||
if (nvals != 1) {
|
||||
return pC_->errMsgCouldNotParseResponse(
|
||||
return pC_->couldNotParseResponse(
|
||||
"R11", response, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
axisError_ = toBitset(axisError);
|
||||
|
@ -70,12 +70,12 @@ class masterMacsAxis : public sinqAxis {
|
||||
asynStatus stop(double acceleration);
|
||||
|
||||
/**
|
||||
* @brief Reset the axis error
|
||||
* @brief Implementation of the `doReset` function from sinqAxis.
|
||||
*
|
||||
* @param on
|
||||
* @return asynStatus
|
||||
*/
|
||||
asynStatus reset();
|
||||
asynStatus doReset();
|
||||
|
||||
/**
|
||||
* @brief Readout of some values from the controller at IOC startup
|
||||
|
Reference in New Issue
Block a user