From 5eb4b18d5c740554115fd59148a8b73377a93225 Mon Sep 17 00:00:00 2001 From: mp49 Date: Fri, 20 May 2011 16:00:30 +0000 Subject: [PATCH] motor: changed XPS driver to read back theoretical position as well as actual position. Now the default motorAxisPosition is the theory pos ition. This brings it into line with the PMAC driver. --- motorApp/NewportSrc/drvXPSAsyn.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/motorApp/NewportSrc/drvXPSAsyn.c b/motorApp/NewportSrc/drvXPSAsyn.c index 604ebd3e..0836100d 100644 --- a/motorApp/NewportSrc/drvXPSAsyn.c +++ b/motorApp/NewportSrc/drvXPSAsyn.c @@ -1178,6 +1178,7 @@ static void XPSPoller(XPSController *pController) int anyMoving; int forcedFastPolls=0; double actualVelocity, theoryVelocity, acceleration; + double theoryPosition=0; timeout = pController->idlePollPeriod; epicsEventSignal(pController->pollEventId); /* Force on poll at startup */ @@ -1296,16 +1297,22 @@ static void XPSPoller(XPSController *pController) } + status = GroupPositionSetpointGet(pAxis->pollSocket, + pAxis->positionerName, + 1, + &theoryPosition); + status = GroupPositionCurrentGet(pAxis->pollSocket, pAxis->positionerName, 1, &pAxis->currentPosition); + if (status != 0) { PRINT(pAxis->logParam, MOTOR_ERROR, "XPSPoller: error calling GroupPositionCurrentGet[%d,%d], status=%d\n", pAxis->card, pAxis->axis, status); motorParam->setInteger(pAxis->params, motorAxisCommError, 1); } else { motorParam->setInteger(pAxis->params, motorAxisCommError, 0); - motorParam->setDouble(pAxis->params, motorAxisPosition, (pAxis->currentPosition/pAxis->stepSize)); + motorParam->setDouble(pAxis->params, motorAxisPosition, (theoryPosition/pAxis->stepSize)); motorParam->setDouble(pAxis->params, motorAxisEncoderPosn, (pAxis->currentPosition/pAxis->stepSize)); }