bluesky / ophyd

hardware abstraction in Python with an emphasis on EPICS
https://blueskyproject.io/ophyd
BSD 3-Clause "New" or "Revised" License
51 stars 79 forks source link

Improve how EpicsMotor deals with `.velocity` and `.acceleration` #1122

Open tacaswell opened 1 year ago

tacaswell commented 1 year ago

Lifting a comment from slack from @dperl-dls .

If you try to set the velocity of an EpicsMotor out of bounds via yield from bps.mv(mtr.velocity, target) it will hang (I assume that the IOC clips the velocity to its valid range).

I think there are 3 things that can fix this and we probably should do all three.

  1. set "sensible" limit on the velocity and acceleration components of EpicsMotor (simplest)
  2. make at least the read and write timeouts runtime mutable (also simple, but has broader consequences)
  3. write a EpicsMotorVelocity(EpicsSignal) class that knows how to dig out VMAX (and add VMAX to EpicsMotor) and use that to check limits (bit of work, but most correct, lets us give better error messages, fail before we touch hardwore to reduce clean up, etc)
coretl commented 1 year ago

I believe if you do a caput callback on the velocity it will return quickly, then you can caget the value to see whether it got clipped...

tacaswell commented 1 year ago

Moving to using put-complete + checking is a better option than 1 and 2 and complimentary with 3.