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