Bug fix for target position (VAL/DVAL/RVAL) initialization error when the motor record is configured to do retries.

This commit is contained in:
Ron Sluiter
2015-07-29 15:50:23 +00:00
parent ac900b9061
commit 3090983c31
3 changed files with 46 additions and 10 deletions
+28 -2
View File
@@ -155,8 +155,8 @@ Modification Log for R6-10
Files modified: motorApp/MotorSrc/motorRecord.cc
motorApp/MotorSrc/motorRecord.dbd
2) Fix for OMS controllers not have the correct deceleration rate at the end
of a JOG. Bug introduced with item #9 under R6-6.
2) Fix for OMS controllers that do not have the correct deceleration rate at
the end of a JOG. Bug introduced with item #9 under R6-6.
File modified: OmsSrc/devOmsCom.cc
@@ -187,6 +187,32 @@ Modification Log for R6-10
motorApp/NewportSrc/Makefile
motorApp/NewportSrc/devNewport.dbd
5) Márcio Paduan Donadio (LNLS) fixed a bug with SYNC field processing. SYNC
was being ignored when URIP == True.
Files modified: syncTargetPosition() in motorRecord.cc
6) Kevin Peterson discovered an initialization bug when the motor record is
configured to do retries. When configured to do retries, the motor
record issues incremental rather than absolute moves. If the motor
behaves badly (e.g., a piezo stiction motor) the controller's absolute
step count can be far from its' absolute readback position. The motor
record initialization logic that determines how the target positions
are initialized at boot-up was not taking into consideration whether
or not the motor record is configured to do retries, and therefore,
whether or not absolute or incremental moves were issued by the motor
record. With this release, if the motor record is configured to do
retries, then the controller's absolute position is ignored (because
the controller's absolute position was "corrupted" by retries) and the
autosave/restore position is used to set the controllers position.
Switching between retries on and off (relative vs. absolute moves)
between reboots will cause unpredictable results and is not covered
by this bug fix.
Files modified: motor_init_record_com() in MotorSrc/motordevCom.cc
init_controller() in MotorSrc/devMotorAsyn.c
Modification Log for R6-9
=========================
+9 -2
View File
@@ -41,6 +41,11 @@
*
* .05 2014-09-11 RLS
* Moved CA posting of changes to the RMP, REP and RVEL fields from motor record to update_values().
*
* .06 2015-07-29 RLS
* Added "Use Relative" (use_rel) indicator to init_controller()'s "LOAD_POS" logic.
* See README R6-10 item #6 for details.
*
*/
#include <stddef.h>
@@ -177,14 +182,16 @@ static void init_controller(struct motorRecord *pmr, asynUser *pasynUser )
double position = pPvt->status.position;
double rdbd = (fabs(pmr->rdbd) < fabs(pmr->mres) ? fabs(pmr->mres) : fabs(pmr->rdbd) );
double encRatio[2] = {pmr->mres, pmr->eres};
int use_rel = (pmr->rtry != 0 && pmr->rmod != motorRMOD_I && (pmr->ueip || pmr->urip));
/*Before setting position, set the correct encoder ratio.*/
start_trans(pmr);
build_trans(SET_ENC_RATIO, encRatio, pmr);
end_trans(pmr);
if ((fabs(pmr->dval) > rdbd && pmr->mres != 0) &&
(fabs(position * pmr->mres) < rdbd))
if ((use_rel != 0) ||
((fabs(pmr->dval) > rdbd) && (pmr->mres != 0) && (fabs(position * pmr->mres) < rdbd))
)
{
double setPos = pmr->dval / pmr->mres;
epicsEventId initEvent = epicsEventCreate( epicsEventEmpty );
+9 -6
View File
@@ -59,6 +59,8 @@ HeadURL: $URL$
* .13 06/09/10 rls Set RA_PROBLEM instead of CNTRL_COMM_ERR when a NULL
* motor_state[] ptr is detected in motor_end_trans_com().
* .14 08/19/14 rls Moved RMP and REP posting from record to here.
* .15 07/29/15 rls Added "Use Relative" (use_rel) indicator to "init_pos" logic in
* motor_init_record_com(). See README R6-10 item #6 for details.
*/
@@ -159,9 +161,9 @@ LOGIC...
Set local encoder ratio to unity.
ENDIF
Set Initialize position indicator based on (|DVAL| > RDBD, AND, MRES != 0,
AND, the above |"get_axis_info()" position| < RDBD) [NOTE: |controller
position| >= RDBD takes precedence over save/restore position].
Set Initialize position indicator based on (Use Relative Moves indicator == TRUE, OR,
[|DVAL| > RDBD, AND, MRES != 0, AND, the above |"get_axis_info()" position| < RDBD)]
[NOTE: |controller position| >= RDBD takes precedence over save/restore position].
Set Command Primitive Initialization string indicator based on (non-NULL "init"
pointer, AND, non-zero string length.
@@ -203,6 +205,7 @@ motor_init_record_com(struct motorRecord *mr, int brdcnt, struct driver_table *t
double ep_mp[2]; /* encoder pulses, motor pulses */
int rtnStat;
msta_field msta;
bool use_rel = (mr->rtry != 0 && mr->rmod != motorRMOD_I && (mr->ueip || mr->urip));
/* allocate space for private field - an motor_trans structure */
mr->dpvt = (struct motor_trans *) malloc(sizeof(struct motor_trans));
@@ -294,9 +297,9 @@ motor_init_record_com(struct motorRecord *mr, int brdcnt, struct driver_table *t
else
ep_mp[0] = ep_mp[1] = 1.0;
initPos = (fabs(mr->dval) > mr->rdbd && mr->mres != 0 &&
fabs(axis_query.position * mr->mres) < mr->rdbd)
? true : false;
initPos = ((use_rel == true) ||
(fabs(mr->dval) > mr->rdbd && mr->mres != 0 && fabs(axis_query.position * mr->mres) < mr->rdbd)
) ? true : false;
/* Test for command primitive initialization string. */
initString = (mr->init != NULL && strlen(mr->init)) ? true : false;
/* Test for PID support. */