Open djvine opened 3 years ago
The motor record expects the controller to not be power-cycled while the IOC is running. Autosave (https://github.com/epics-modules/autosave) can restore the position of a motor to a controller that has been power-cycled when the IOC starts.
The motor record doesn't know about the connected state of the asyn port that is used to communicate with the controller. The asynMotor{Controller,Axis} classes don't have a flag that indicates a disconnect/reconnect cycle occured. asynPortDriver does have connect/disconnect methods that could be overridden by the MCS2 driver to add controller-specific reconnect functionality.
I regularly disconnect EPICS IOCs from motor controllers so that I can talk to them with vendor software. How would you distinguish between a user-initiated disconnect and a disconnect because the controller was power-cycled? You wouldn't want to redefine the position if the controller wasn't power-cycled.
asyn has exception callbacks:
@MarkRivers, should motor drivers create asyn exception callbacks to handle re-initialization on reconnect from a power-cycle while the IOC is running?
@MarkRivers, should motor drivers create asyn exception callbacks to handle re-initialization on reconnect from a power-cycle while the IOC is running?
Our approach to networked motor controllers at GSECARS is to have each one controlled by its own dedicated IOC running on Linux, so it can be quickly restarted with no side-effects on other devices.
Power-cycling the controller without rebooting the IOC is a fairly complex topic.
I am currently working on a similar problem for areaDetector. There are 2 problems to solve:
When the MCS2 controller is power cycled it resets the position to zero.
Is there a way to have the motor record restore the position on a connect/reconnect event?
Alternatively, is there a flag that indicates a disconnect/reconnect cycle occurred and that the user should rehome the stages?