Closed ZLLentz closed 4 years ago
I've addressed Ken's comments, I will re-test for a bit, call this done, and then continue to hope for our Travis funding to exist.
I thought this was going to be done, but it seems like the motor record HOMF/HOMR do some... odd things, like setting the VAL field, and ask for extra moves to specific positions. I didn't notice these until I started modifying pcdsdevices to get a typhos screen going. Rather than debug that rabbit hole I'm going to redo this a tiny bit to work off of an auxiliary PV to trigger the homing.
This now works very well in my test setup! There were a few remaining edge cases related to the motor record status. I've made the fixes so that now:
Any more thoughts before I merge? @klauer @slacAWallace @ghalym
have to decide how we'll support these two versions
Right, that's annoying. I was planning to update the LFE/KFE/TMO plcs at PAMM, but that doesn't guarantee that everything is handled.
I'm going to merge this now
Implements the following:
.HOMF
and.HOMR
fields~:PLC:bHomeCmd
PVI'm going to do a writeup here and include much of the information that follows in the README.
To activate a homing routing, put 1 to the EPICS ~
.HOMF
or.HOMR
fields. As far as the TwinCAT program is concerned, these both mean the same thing: "home using our internal configuration".~:PLC:bHomeCmd
PV.To configure a homing routine, set the
fHomePosition
variable to the position to use after homing, and set thenHomingMode
variable to pick a strategy. These strategies are stored inENUM_EpicsHomeCmd
enum. All homing motion strategies move towards their destinations using the "Homing Velocity (towards plc cam)" parameter , then off of the switch using the "Homing velocity (off plc cam)" parameter. The normal options are:LOW_LIMIT
: Move to the low limit (backward) switch. Set home position at the first point we see as we leave the switch.HIGH_LIMIT
: Move to the high limit (forward) switch. Set home position at the first point we see as we leave the switch.HOME_VIA_LOW
: Move towards the low limit (backward) switch, seeking out the position wherebHome
isTRUE
. If we reach the limit switch without findingbHome
, reverse direction and try moving towards the high switch. Set home position to the point just above thebHome
signal.HOME_VIA_HIGH
: Move towards the high limit (forward) switch, seeking out the position wherebHome
isTRUE
. If we reach the limit switch without findingbHome
, reverse direction and try moving towards the low switch. Set home position to the point just below thebHome
signal.There are two additional special-case options:
ABSOLUTE_SET
: When we ask for a home, do not move the motor- simply declare the current position as "home". This is basically a manual homing routine.None
: Do not home! Ever! This is actually the default value, and the only one "implemented" prior to this PR.If the homing strategy is set to any value other than
None
, the library knows we have a motor that wants save/restore. In these cases, the last position of the motor will be saved on TwinCAT shutdown and restored on the first cycle of the PLC program. This prevents the location of your relatively encoded motor from being lost when the PLC is reconfigured.