epics-modules / motor

APS BCDA synApps module: motor
https://epics-modules.github.io/motor/
20 stars 47 forks source link

Add field SPDB, "Set Point Dead Band" #114

Closed tboegi closed 5 years ago

tboegi commented 5 years ago

This is from Matthew Pearson, pearsonmr@ornl.gov

A number of users and staff have requested that the motor record have a setpoint deadband field (eg. SPDB), which prevents any motion from happening if the readback position is within SPDB. Without a SPDB we have issues with motors moving unnecessarily.

For example, if the RBV is 0.001 and we set VAL to 0.0, if we have a non-zero backlash correction then the motor will move unnecessarily to take out backlash. Even without backlash correction we often enable and disable the drive amplifier for no good reason.

Currently the effective setpoint deadband is equal to MRES, but this is often too small to be an effective setpoint deadband.

The new SPDB field would default to 0.0

The new code hooks into do_work(): When the new setpoint is within DPDB, set too_small and don't move.

The new code does not use snipptes like "abs(npos - rpos)", these already produce warnings on 64 bit sytems. abs() is declared to work on int, but we feed long values. Simply compare the coordinates in engineering units.

mp49 commented 5 years ago

That seems ok to me. The only difference from my version is comparing engineering units rather than counts, but if this avoids warnings then that's better.