Draft velocity mode
Some checks failed
Test And Build / Lint (push) Failing after 4s
Test And Build / Build (push) Successful in 7s

See TODO in src/masterMacsAxis.cpp, line 552. The velocity readback is
the only thing that doesn't work properly, everything else does work.
Once a solution has been found here, this can be a new minor release.
This commit is contained in:
2026-02-10 12:31:01 +01:00
parent 0e1f95a94b
commit eadce0f594

View File

@@ -455,7 +455,6 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
double previousPosition = 0.0; double previousPosition = 0.0;
double motorRecResolution = 0.0; double motorRecResolution = 0.0;
double handshakePerformed = 0; double handshakePerformed = 0;
double actualVelocity = 0.0;
// ========================================================================= // =========================================================================
@@ -532,10 +531,28 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
return rwStatus; return rwStatus;
} }
// If moving in velocity mode, read out the current speed. Otherwise, read rwStatus = pC_->read(axisNo_, 12, response);
// out the current position if (rwStatus != asynSuccess) {
return rwStatus;
}
nvals = sscanf(response, "%lf", &currentPosition);
if (nvals != 1) {
return pC_->couldNotParseResponse("R12", response, axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = setMotorPosition(currentPosition);
if (plStatus != asynSuccess) {
return plStatus;
}
setAxisParamChecked(this, motorEncoderPosition, currentPosition);
if (pMasterMacsA_->lastMoveCommand == velocityMode && !speedEqualZero()) { if (pMasterMacsA_->lastMoveCommand == velocityMode && !speedEqualZero()) {
// TODO: Not sure whether the RVEL field of the motor record does not
// work - has to be clarified
double actualVelocity = 0.0;
rwStatus = pC_->read(axisNo_, 14, response); rwStatus = pC_->read(axisNo_, 14, response);
if (rwStatus != asynSuccess) { if (rwStatus != asynSuccess) {
return rwStatus; return rwStatus;
@@ -554,21 +571,6 @@ asynStatus masterMacsAxis::doPoll(bool *moving) {
} else { } else {
rwStatus = pC_->read(axisNo_, 12, response);
if (rwStatus != asynSuccess) {
return rwStatus;
}
nvals = sscanf(response, "%lf", &currentPosition);
if (nvals != 1) {
return pC_->couldNotParseResponse("R12", response, axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = setMotorPosition(currentPosition);
if (plStatus != asynSuccess) {
return plStatus;
}
// If we wait for a handshake, but the motor was moving in its last poll // If we wait for a handshake, but the motor was moving in its last poll
// cycle and has reached its target, it is not moving. Otherwise it is // cycle and has reached its target, it is not moving. Otherwise it is
// considered moving, even if we're still waiting for the handshake. // considered moving, even if we're still waiting for the handshake.