-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add field RSTM: Restore Mode #160
Add field RSTM: Restore Mode #160
Conversation
@tboegi, I have a few questions:
|
However, do we want the 6.10 behavior as a preferred solution ? |
I have one beamline that depends on the 6.10 behavior (documented in item 6 in the comments of this commit: 3090983). I would bet there are others that don't realize they rely on it. The travis builds don't like the initial value:
I assume the default needs to be |
I'm comfortable inconveniencing people in this situation. They would have already been inconvenienced in the same way if they upgraded from 6.9 to a newer version of the motor in the last few years. |
Hej @kmpeters ; |
d23f014
to
d2214ab
Compare
motorApp/MotorSrc/devMotorAsyn.c
Outdated
{ | ||
if ((use_rel != 0) || | ||
((fabs(pmr->dval) > rdbd) && (pmr->mres != 0) && (fabs(position * pmr->mres) < rdbd)) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If "Conditional" includes a check on use_rel, then there is no longer a way to maintain the original (6.9) motor record behaviour - I feel this should still be available, so another RSTM option? Maybe the choices are something like "WhenZero", "Conditional", "Always", "Never" (would "WhenZeroOrRelative" be another option for "Conditional"). Using "Zero" is not strictly accurate, but I couldn't think of a better word, unless you used words like "Original" or "Motor69" etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point - I agree that both should be available.
Motor69 is so un-intuitive that people need to read the documentation.
I like that.
Then we have Motor69 and Motor610 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"NearZero" is more accurate than "WhenZero," but I don't love it. I think "Conditional" is better than "WhenZeroOrRelative," because it is less likely to need to be changed in the future when other corner cases arise. I'll make it clear in the documentation and the release notes what "Conditional" means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The essence of the original behaviour was to only restore position if the motor record thought the controller had been powered on / reset, which it did by checking for counters being near zero. Do we just need to find a word that encapsulates that better? PowerOn / PowerUp / OnReset / … or could that lead to future confusion if a controller can power on and remember position /not be zero and it is better to stick to "NearZero" as that describes when it really does it as opposed to usually does? May be leaning to "NearZero" ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Counters cleared"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "NearZero" requires the least explanation so far. I wouldn't know what "counters" are in the context of a motor controller and I would feel compelled to read the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also very comfortable with the label "Conditional" now. This option leaves it up to device support do decide when to restore the position. The vague name seems appropriate for what will be increasingly complicated decision-making under the hood.
The other three options are easy to understand and probably don't require reading the documentation: "NearZero", "Always", "Never".
A user who doesn't want to read the documentation can safely pick one of the other three options and be confident the position will be restored as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My question about that is what is near zero – it could mean the motor is near it's Home position, or probably several other similar things. Note that I'm just responding as a very naive user here, feel free to ignore me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NearZero = within the retry deadband of zero.
I haven't tested this yet, but I will soon. |
Also, I think the logic in 3090983 needs to be improved. The cases where URIP and UEIP are YES should be handled differently. I'll create an issue for those improvements after this pull request is closed, since that will be modifying the "Conditional" logic. |
Do we have an agreement about |
@tboegi, "Conditional" instead of "Condition" and yes, I agree. I think it's also OK to make "NearZero" the default. The number of problems that have been caused by the conditional behavior is greater than the number of cases I know that have benefited from it. I'll add a big warning to the release notes for the next version of motor. Is it possible to use flashing text in github markdown? |
I've begun testing this pull request. Changing RSTM from
Without this change caget and dbpr show the integer value:
The output with this change is more user friendly:
|
There is a typo (two instances of motor/motorApp/MotorSrc/motordevCom.cc Line 300 in c59aa1a
Also, in both |
Thanks @kmpeters |
Thanks. I've tested autosaving the RSTM field and it works as expected: the autosaved value of RSTM determines the restore behavior for the motor's position. |
@kmpeters Thanks for testing - |
@tboegi, the travis builds are failing because of the extra |
Partly revert the following commit: commit 3090983 Author: Ron Sluiter <[email protected]> Date: Wed Jul 29 15:50:23 2015 +0000 Bug fix for target position (VAL/DVAL/RVAL) initialization error when the motor record is configured to do retries. And from the release notes: 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 Commit 3090983 improves the situation for setups where autosave is used, and makes things worse when autosave is not used. When autosave is not used and the motor is configured to do retries, the the DVAL field is loaded into the controller regardless. And because DVAL is 0.0 at startup, the controller position is lost. The first issue report is found here: "Problem with R6-10 issue 6 fix - controller position can be lost on reboot" epics-modules#85 And the we have another issue report here: "IOC zeroes encoder on startup" motorapp/Galil#13 A possible way forward is discussed here: "Add a field to the motor record to allow always restoring the autosaved position" epics-modules#151 This commit adds the "RSTM" field: - 0 Disables restoring the autosaved position - 1 Always restores the autosaved position - 2 Uses the same logic as motorRecord 6.9 (or older) - 3 Uses the same logic as motorRecord 6.10 This numbering maps 0 and 1 somewhat to false/true, uses 2/3 for special handlings and leaves room for more choices. E.g. "use the encoder value, if valid, fall back to autosave if not. Or "use the URIP/RDBL" if possible. I am getting off-topic, those improvements should be done in later commits anyway.
@kmpeters |
@tboegi, thanks for these changes. |
Partly revert the following commit:
commit 3090983
Author: Ron Sluiter [email protected]
Date: Wed Jul 29 15:50:23 2015 +0000
Bug fix for target position (VAL/DVAL/RVAL) initialization error
when the motor record is configured to do retries.
And from the release notes:
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
Commit 3090983 improves the situation for setups where autosave is
used, and makes things worse for setups where autosave is not used.
When autosave is not used and the motor is configured to do retries,
the the DVAL field is loaded into the controller regardless.
And because DVAL is 0.0 at startup, the controller position is lost.
The first issue report is found here:
"Problem with R6-10 issue 6 fix - controller position can be lost on reboot"
#85
And the we have another issue report here:
"IOC zeroes encoder on startup"
motorapp/Galil#13
A possible way forward is discussed here:
"Add a field to the motor record to allow always restoring the
autosaved position"
#151
This commit add the "RSTM" field:
relative movements to do retries or not